Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions _subfiles/_sol-base-rate.qmd
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
::: {#sol-base-rate}

Write $S$ for having the disease and $+$ for a positive test.
Write $S$ for having the disease and $\posclass$ for a positive test.
The three given numbers are

$$\Pr(+ \mid S) = 0.99, \qquad \Pr(+ \mid \text{not } S) = 0.01, \qquad \Pr(S) = 0.001$$
$$\Pr(\posclass \mid S) = 0.99, \qquad \Pr(\posclass \mid \text{not } S) = 0.01, \qquad \Pr(S) = 0.001$$

@eq-bayes needs $\Pr(+)$, the overall chance of a positive result.
@eq-bayes needs $\Pr(\posclass)$, the overall chance of a positive result.
Assemble it with @thm-total-prob, splitting on whether the person is
sick:

$$\begin{aligned}
\Pr(+) &= \Pr(+ \mid S)\Pr(S) + \Pr(+ \mid \text{not } S)\Pr(\text{not } S) \\
\Pr(\posclass) &= \Pr(\posclass \mid S)\Pr(S) + \Pr(\posclass \mid \text{not } S)\Pr(\text{not } S) \\
&= (0.99)(0.001) + (0.01)(0.999) \\
&= 0.00099 + 0.00999 \\
&= 0.01098
Expand All @@ -20,8 +20,8 @@ Then

$$
\begin{aligned}
\Pr(S \mid +)
&= \frac{\Pr(+ \mid S)\,\Pr(S)}{\Pr(+)} \\
\Pr(S \mid \posclass)
&= \frac{\Pr(\posclass \mid S)\,\Pr(S)}{\Pr(\posclass)} \\
&= \frac{0.00099}{0.01098} \\
&\approx 0.0902
\end{aligned}
Expand Down
14 changes: 7 additions & 7 deletions _subfiles/_thm-bayes.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,16 @@ Suppose a disease test has 99% sensitivity and 99% specificity,
and the prevalence of the disease in the population is 7%.

Let $D$ be the event "person has the disease"
and $+$ be the event "test is positive".
and $\posclass$ be the event "test is positive".
Then:

- $\Pr(+ \mid D) = 0.99$ (sensitivity)
- $\Pr(\neg + \mid \neg D) = 0.99$ (specificity),
- $\Pr(\posclass \mid D) = 0.99$ (sensitivity)
- $\Pr(\negclass \mid \neg D) = 0.99$ (specificity),
so the false positive rate is

$$
\begin{aligned}
\Pr(+ \mid \neg D) &= 1 - 0.99 \\
\Pr(\posclass \mid \neg D) &= 1 - 0.99 \\
&= 0.01
\end{aligned}
$$
Expand All @@ -56,10 +56,10 @@ By @thm-bayes, with the denominator expanded by the

$$
\ba
\Pr(D \mid +)
&= \frac{\Pr(+ \mid D) \cd \Pr(D)}{\Pr(+)}
\Pr(D \mid \posclass)
&= \frac{\Pr(\posclass \mid D) \cd \Pr(D)}{\Pr(\posclass)}
&& \text{(Bayes' theorem)} \\
&= \frac{\Pr(+ \mid D) \cd \Pr(D)}{\Pr(+ \mid D) \cd \Pr(D) + \Pr(+ \mid \neg D) \cd \Pr(\neg D)}
&= \frac{\Pr(\posclass \mid D) \cd \Pr(D)}{\Pr(\posclass \mid D) \cd \Pr(D) + \Pr(\posclass \mid \neg D) \cd \Pr(\neg D)}
&& \text{(law of total probability)} \\
&= \frac{0.99 \cd 0.07}{0.99 \cd 0.07 + 0.01 \cd 0.93}
&& \text{(substitute the given values)} \\
Expand Down
2 changes: 2 additions & 0 deletions inst/WORDLIST
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ glitchy
homoskedasticity
lintr
navbar
negclass
posclass
probabilitybook
qwt
renormalizing
Expand Down
2 changes: 1 addition & 1 deletion latex-macros
Loading