- Bayes rule flips a conditional probability: get P(A∣B) from P(B∣A)
- this is the theorem as a tool for solving probability problems; for the school of statistics that treats it as the foundation of probability, see Bayesian Inference
- derivation: write the intersection both ways with the multiplication rule ( Probability Rules )
P(A∩B)=P(A)P(B∣A)=P(B)P(A∣B)⇒P(A∣B)=P(B)P(B∣A)P(A)
- then partition P(B) over A and Ac, the law of total probability: P(B)=P(B∣A)P(A)+P(B∣Ac)P(Ac)
P(A∣B)=P(B∣A)P(A)+P(B∣Ac)P(Ac)P(B∣A)P(A)
- with more than two parts A1,…,An the denominator is ∑iP(B∣Ai)P(Ai)
- example: a disease has 1% prevalence, the test catches 99% of cases and false alarms 5% of the time; P(D∣+)?
- P(D∣+)=0.99⋅0.01+0.05⋅0.990.99⋅0.01=0.05940.0099≈0.17
- only 1 in 6 positives is real: the false alarms on the 99% healthy swamp the true hits, the prior matters