# Bayesian Statistics

Rafael A. Irizarry
October 16, 2014

### Cystic Fibrosis Test

• A test for cystic fibrosis has an accuracy of 99%:

$\mbox{Prob}(+|D)=0.99, \mbox{Prob}(-|\mbox{no } D)=0.99,$

• If we select random person and they test postive what is probability of positive test?

• We write this as $$\mbox{Prob}(D|+)?$$

• cystic fibrosis rate is 1 in 3,900, $$\mbox{Prob}(D)=0.0025$$

### Bayes Rule

$\mbox{Pr}(A|B) = \frac{\mbox{Pr}(B|A)\mbox{Pr}(A)}{\mbox{Pr}(B)}$

### Bayes Rule

$\begin{eqnarray*} \mbox{Prob}(D|+) & = & \frac{ P(+|D) \cdot P(D)} {\mbox{Prob}(+)} \\ & = & \frac{\mbox{Prob}(+|D)\cdot P(D)} {\mbox{Prob}(+|D) \cdot P(D) + \mbox{Prob}(+|\mbox{no } D) \mbox{Prob}(\mbox{no } D)} \\ \end{eqnarray*}$

### Bayes Rule

$\begin{eqnarray*} \mbox{Prob}(D|+) & = & \frac{ P(+|D) \cdot P(D)} {\mbox{Prob}(+)} \\ & = & \frac{\mbox{Prob}(+|D)\cdot P(D)} {\mbox{Prob}(+|D) \cdot P(D) + \mbox{Prob}(+|\mbox{no } D) \mbox{Prob}(\mbox{no } D)} \\ & = & \frac{0.99 \cdot 0.0025}{0.99 \cdot 0.0025 + 0.01 \cdot (.9975)} \\ & = & 0.02 \;\;\; \mbox{not} \; \; \; 0.99 \end{eqnarray*}$