Bayesian Statistics the theory that would not die
Bayesian Statistics
the theory that would not die how Bayes' rule cracked the enigma code, hunted down Russian submarines, and emerged triumphant from two centuries of controversy Mc. Grayne, S. B. , Yale University Press, 2011
You are sitting in front of a doctor and she says …
4 million – HIV- 1, 400 – HIV+ Test has a 1% error rate If don’t have HIV then 1% of time it says you have it If you do have HIV then 1% of time it says you don’t have it You have been told that you have a positive test (and you don’t use intravenous drugs recreationally or partake of risky sexual practices) What is the probability that you actually have an HIV infection?
4 million – HIV 3, 960, 000 - 1, 400 – HIV+ 40, 000+ 14 - 1, 386+ 40, 000+ 1, 386+ P(HIV+|Test+) = 1, 386/ (40, 000 + 1, 386) = 3. 35% P(HIV+|Test-) = 14/ (3, 960, 000 + 14) = 3. 5 x 10 -4% Before the test P(HIV+) = 1, 400 / (1, 400 + 4, 000) = 0. 035%
P(HIV+) – Hypothesis (hidden) = 0. 03% P(HIV+|Test+) P(Test+|HIV+) 99% what we want but is hard to get to P(Data) - data (observed)
P(Hyp) – Hypothesis (hidden) P(Hyp|Data) P(Data|Hyp) easy to reason about what we want but is hard to get to P(Data) - data (observed)
What is Bayes’ rule Model P(Hyp|Data) = Answer Prior P(Data|Hyp) P(Hyp) ∑ P(Data|H’) P(H’) Normalization
P(Data|Hyp) P(Hyp|Data) = ∑ P(Data|H’) P(Test+|HIV+) P(HIV+|Test+) = P(Test+|HIV+) P(HIV+)+P(Test+|HIV-) P(HIV-) 99% x 1, 400/(1, 400 + 4, 000) P(HIV+|Test+) = 99% x 1, 400/(1, 400 + 4, 000)+ 1% x 4, 000/(1, 400 + 4, 000) 99% x 1, 400 = 99% x 1, 400+ 1% x 4, 000 = 1, 386+ 40, 000 = 3. 3%
P(Hyp) HIV+ HIV- 0. 035% 99. 965% P(Data|Hyp) Data Hyp Test- Test+ HIV- 99% 1% HIV+ 1% 99%
P(Hyp|Data) = P(Data|Hyp) P(Hyp) ∑ P(Data|H’) P(Test+|HIV+) P(HIV+|Test+) = P(Test+|HIV+) P(HIV+)+P(Test+|HIV-) P(HIV-) 99% x 0. 035% P(HIV+|Test+) = 99% x 0. 035%+ 1% x 99. 965% 0. 0346% = 0. 0346% + 0. 99965% = 0. 0346% 1. 034% = 3. 35%
Spreadsheet
P(Hyp|Data) = P(Data|Hyp) P(Hyp) ∑ P(Data|H’) P(Data)=∑ P(Data|H’) P(Hyp|Data) = P(Data|Hyp) P(Data) P(Hyp|Data)P(Data)=P(Data|Hyp) P(Hyp)
P(Hyp) A C 99. 9% 0. 1% Reference A P(Data|Hyp) Hyp A C Data A C 99% 1% 1% 99% Read C
Reference A Read C C A 99. 9% A -> A 98. 9% C 0. 1% A->C 0. 999% 10 -3% A->C 0. 999% C -> C 0. 099% A->C 91% A->C -> A C -> C 9% A->C->C 0. 91% A->C->C 9. 25% C -> C 0. 099% C->C->A C->C->C 8. 9% C->C->C 90. 75%
P(Data|Hyp) P(Hyp)= P(Hyp) P(D 1|Hyp) P(D 2|Hyp)…P(Dn|Hyp)
Spreadsheet
P(Hyp) AA AC CC 99. 9% 0. 075% 0. 025% P(Data|Hyp) Hyp AA AC CC Data A C 99% 1% 50% 1% 99%
Spreadsheet
Bayesian Statistics • Simple mathematical basis • Long period before it was used widely conceptual problems computationally difficult (Hyp can get very large) • Technique useful for many otherwise intractable problems
- Slides: 24