24
Bayesian Statistics

Bayesian Statistics. the theory that would not die how Bayes' rule cracked the enigma code, hunted down Russian submarines, and emerged triumphant

Embed Size (px)

Citation preview

Page 1: Bayesian Statistics. the theory that would not die how Bayes' rule cracked the enigma code, hunted down Russian submarines, and emerged triumphant

Bayesian Statistics

Page 2: Bayesian Statistics. the theory that would not die how Bayes' rule cracked the enigma code, hunted down Russian submarines, and emerged triumphant
Page 3: Bayesian Statistics. the theory that would not die how Bayes' rule cracked the enigma code, hunted down Russian submarines, and emerged triumphant
Page 4: Bayesian Statistics. the theory that would not die how Bayes' rule cracked the enigma code, hunted down Russian submarines, and emerged triumphant
Page 5: Bayesian Statistics. the theory that would not die how Bayes' rule cracked the enigma code, hunted down Russian submarines, and emerged triumphant

the theory that would not die

how Bayes' rule cracked the enigma code,hunted down Russian submarines, andemerged triumphant from two centuries ofcontroversy

McGrayne, S. B., Yale University Press, 2011

Page 6: Bayesian Statistics. the theory that would not die how Bayes' rule cracked the enigma code, hunted down Russian submarines, and emerged triumphant

You are sitting in front of a doctor and she says …

Page 7: Bayesian Statistics. the theory that would not die how Bayes' rule cracked the enigma code, hunted down Russian submarines, and emerged triumphant

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 intravenousdrugs recreationally or partake of risky sexual practices)

What is the probability that you actually have an HIV infection?

Page 8: Bayesian Statistics. the theory that would not die how Bayes' rule cracked the enigma code, hunted down Russian submarines, and emerged triumphant

4 million – HIV- 1,400 – HIV+

3,960,000- 40,000+ 1,386+14-

3,960,000- 40,000+ 1,386+14-

P(HIV+|Test+) = 1,386/ (40,000 + 1,386)

= 3.35%P(HIV+|Test-) = 14/ (3,960,000 + 14)

= 3.5x10-4%

P(HIV+) = 1,400 / (1,400 + 4,000,000) = 0.035%

Before the test

Page 9: Bayesian Statistics. the theory that would not die how Bayes' rule cracked the enigma code, hunted down Russian submarines, and emerged triumphant

P(Test+|HIV+)

P(HIV+|Test+)

P(HIV+) – Hypothesis (hidden) = 0.03%

P(Data) - data (observed)

what we wantbut is hard toget to

99%

Page 10: Bayesian Statistics. the theory that would not die how Bayes' rule cracked the enigma code, hunted down Russian submarines, and emerged triumphant

P(Data|Hyp)

P(Hyp|Data)

P(Hyp) – Hypothesis (hidden)

P(Data) - data (observed)

what we wantbut is hard toget to

easy to reason about

Page 11: Bayesian Statistics. the theory that would not die how Bayes' rule cracked the enigma code, hunted down Russian submarines, and emerged triumphant

What is Bayes’ rule

P(Data|Hyp) P(Hyp) P(Hyp|Data) =

AnswerNormalization

PriorModel

∑ P(Data|H’) P(H’)

Page 12: Bayesian Statistics. the theory that would not die how Bayes' rule cracked the enigma code, hunted down Russian submarines, and emerged triumphant

P(Data|Hyp) P(Hyp) P(Hyp|Data) =

∑ P(Data|H’) P(H’)

P(Test+|HIV+) P(HIV+)

P(HIV+|Test+) = P(Test+|HIV+) P(HIV+)+P(Test+|HIV-) P(HIV-)

99% x1,400/(1,400 + 4,000,000) P(HIV+|Test+) =

99% x1,400/(1,400 + 4,000,000)+ 1% x4,000,000/(1,400 + 4,000,000)

= 99% x1,400

99% x1,400+ 1% x4,000,000

1,386

1,386+ 40,000=

= 3.3%

Page 13: Bayesian Statistics. the theory that would not die how Bayes' rule cracked the enigma code, hunted down Russian submarines, and emerged triumphant

P(Data|Hyp)

DataHyp Test- Test+HIV- 99% 1%HIV+ 1% 99%

P(Hyp)

HIV+ 0.035%HIV- 99.965%

Page 14: Bayesian Statistics. the theory that would not die how Bayes' rule cracked the enigma code, hunted down Russian submarines, and emerged triumphant

P(Data|Hyp) P(Hyp) P(Hyp|Data) =

∑ P(Data|H’) P(H’)

P(Test+|HIV+) P(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%

Page 15: Bayesian Statistics. the theory that would not die how Bayes' rule cracked the enigma code, hunted down Russian submarines, and emerged triumphant

Spreadsheet

Page 16: Bayesian Statistics. the theory that would not die how Bayes' rule cracked the enigma code, hunted down Russian submarines, and emerged triumphant

P(Data|Hyp) P(Hyp) P(Hyp|Data) =

∑ P(Data|H’) P(H’)

P(Data|Hyp) P(Hyp) P(Hyp|Data) =

P(Data)

P(Data)=∑ P(Data|H’) P(H’)

P(Hyp|Data)P(Data)=P(Data|Hyp) P(Hyp)

Page 17: Bayesian Statistics. the theory that would not die how Bayes' rule cracked the enigma code, hunted down Russian submarines, and emerged triumphant

P(Data|Hyp)

DataHyp A CA 99% 1%C 1% 99%

P(Hyp)

A 99.9%C 0.1%

Reference A

C Read

Page 18: Bayesian Statistics. the theory that would not die how Bayes' rule cracked the enigma code, hunted down Russian submarines, and emerged triumphant

Reference A

C

A 99.9% C 0.1%

A -> A 98.9% A->C 0.999% C -> C 0.099%10-3%

A->C 0.999% C -> C 0.099%

Read

C

A->C 91% C -> C 9%

A->C -> A C->C->AA->C->C 0.91% C->C->C 8.9%

C->C->C 8.9%

A->C->C 9.25% C->C->C 90.75%

A->C->C 0.91%

Page 19: Bayesian Statistics. the theory that would not die how Bayes' rule cracked the enigma code, hunted down Russian submarines, and emerged triumphant

P(Data|Hyp) P(Hyp)=

P(Hyp) P(D1|Hyp) P(D2|Hyp)…P(Dn|Hyp)

Page 20: Bayesian Statistics. the theory that would not die how Bayes' rule cracked the enigma code, hunted down Russian submarines, and emerged triumphant

Spreadsheet

Page 21: Bayesian Statistics. the theory that would not die how Bayes' rule cracked the enigma code, hunted down Russian submarines, and emerged triumphant

P(Data|Hyp)

DataHyp A CAA 99% 1%AC 50% 50%CC 1% 99%

P(Hyp)

AA 99.9%AC 0.075%CC 0.025%

Page 22: Bayesian Statistics. the theory that would not die how Bayes' rule cracked the enigma code, hunted down Russian submarines, and emerged triumphant

Spreadsheet

Page 23: Bayesian Statistics. the theory that would not die how Bayes' rule cracked the enigma code, hunted down Russian submarines, and emerged triumphant

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

Page 24: Bayesian Statistics. the theory that would not die how Bayes' rule cracked the enigma code, hunted down Russian submarines, and emerged triumphant