Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Bayes' theorem
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===Drug testing=== Suppose, a particular test for whether someone has been using cannabis is 90% [[Sensitivity (tests)|sensitive]], meaning the [[true positive rate]] (TPR) = 0.90. Therefore, it leads to 90% true positive results (correct identification of drug use) for cannabis users. The test is also 80% [[Specificity (tests)|specific]], meaning [[true negative rate]] (TNR) = 0.80. Therefore, the test correctly identifies 80% of non-use for non-users, but also generates 20% false positives, or [[false positive rate]] (FPR) = 0.20, for non-users. Assuming 0.05 [[prevalence]], meaning 5% of people use cannabis, what is the [[probability]] that a random person who tests positive is really a cannabis user? The [[Positive predictive value]] (PPV) of a test is the proportion of persons who are actually positive out of all those testing positive, and can be calculated from a sample as: :PPV = True positive / Tested positive If sensitivity, specificity, and prevalence are known, PPV can be calculated using Bayes' theorem. Let <math>P(\text{User}\vert \text{Positive}) </math> mean "the probability that someone is a cannabis user given that they test positive", which is what PPV means. We can write: :<math> \begin{align} P(\text{User}\vert \text{Positive}) &= \frac{P(\text{Positive}\vert \text{User}) P(\text{User})}{P(\text{Positive})} \\ &= \frac{P(\text{Positive}\vert\text{User}) P(\text{User})}{P(\text{Positive}\vert\text{User}) P(\text{User}) + P(\text{Positive}\vert\text{Non-user}) P(\text{Non-user})} \\[8pt] &= \frac{0.90 \times 0.05}{0.90 \times 0.05 + 0.20 \times 0.95} = \frac{0.045}{0.045 + 0.19} \approx 19\% \end{align}</math> The denominator <math> P(\text{Positive}) = P(\text{Positive}\vert\text{User}) P(\text{User}) + P(\text{Positive}\vert\text{Non-user}) P(\text{Non-user}) </math> is a direct application of the [[Law of Total Probability]]. In this case, it says that the probability that someone tests positive is the probability that a user tests positive times the probability of being a user, plus the probability that a non-user tests positive, times the probability of being a non-user. This is true because the classifications user and non-user form a [[partition of a set]], namely the set of people who take the drug test. This combined with the definition of [[conditional probability]] results in the above statement. In other words, if someone tests positive, the probability that they are a cannabis user is only 19%—because in this group, only 5% of people are users, and most positives are false positives coming from the remaining 95%. [[File:Bayes-rule3.png|thumb|right|Using a frequency box to show <math>P(\text{User}\vert \text{Positive}) </math> visually by comparison of shaded areas. Note how small the pink area of true positives is compared to the blue area of false positives.]] If 1,000 people were tested: * 950 are non-users and 190 of them give false positive (0.20 × 950) * 50 of them are users and 45 of them give true positive (0.90 × 50) The 1,000 people thus have 235 positive tests, of which only 45 are genuine, about 19%. ====Sensitivity or specificity==== The importance of [[Specificity (tests)|specificity]] can be seen by showing that even if sensitivity is raised to 100% and specificity remains at 80%, the probability that someone who tests positive is a cannabis user rises only from 19% to 21%, but if the sensitivity is held at 90% and the specificity is increased to 95%, the probability rises to 49%. {| class="wikitable" style="display:inline-table;" ! {{diagonal split header|Actual|Test}} ! style="width:5ex;"|Positive ! style="width:5ex;"|Negative ! rowspan="5" style="padding:0;"| ! Total |- ! User | style="text-align:right" | '''45''' | style="text-align:right" | 5 | style="text-align:right" | 50 |- ! Non-user | style="text-align:right" | 190 | style="text-align:right" | 760 | style="text-align:right" | 950 |- | colspan="5" style="padding:0;"| |- ! Total | style="text-align:right" | '''235''' | style="text-align:right" | 765 | style="text-align:right" | 1000 |- | colspan="5" style="padding:0 0 1ex 0;border:none;background:transparent;"| 90% sensitive, 80% specific, PPV=45/235 ≈ 19% |} {| class="wikitable" style="display:inline-table;" ! {{diagonal split header|Actual|Test}} ! style="width:5ex;"|Positive ! style="width:5ex;"|Negative ! rowspan="5" style="padding:0;"| ! Total |- ! User | style="text-align:right" | '''50''' | style="text-align:right" | 0 | style="text-align:right" | 50 |- ! Non-user | style="text-align:right" | 190 | style="text-align:right" | 760 | style="text-align:right" | 950 |- | colspan="5" style="padding:0;"| |- ! Total | style="text-align:right" | '''240''' | style="text-align:right" | 760 | style="text-align:right" | 1000 |- | colspan="5" style="padding:0 0 1ex 0;border:none;background:transparent;"| 100% sensitive, 80% specific, PPV=50/240 ≈ 21% |} {| class="wikitable" style="display:inline-table;" ! {{diagonal split header|Actual|Test}} ! style="width:5ex;"|Positive ! style="width:5ex;"|Negative ! rowspan="5" style="padding:0;"| ! Total |- ! User | style="text-align:right" | '''45''' | style="text-align:right" | 5 | style="text-align:right" | 50 |- ! Non-user | style="text-align:right" | 47 | style="text-align:right" | 903 | style="text-align:right" | 950 |- | colspan="5" style="padding:0;"| |- ! Total | style="text-align:right" | '''92''' | style="text-align:right" | 908 | style="text-align:right" | 1000 |- | colspan="5" style="padding:0 0 1ex 0;border:none;background:transparent;"| 90% sensitive, 95% specific, PPV=45/92 ≈ 49% |}
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)