bayesian inference i 4/23/12 law of total probability bayes rule section 11.2 (pdf)pdf professor...

23
Bayesian Inference I 4/23/12 • Law of total probability • Bayes Rule Section 11.2 (pdf ) Professor Kari Lock Morgan Duke University

Upload: magnus-watts

Post on 02-Jan-2016

218 views

Category:

Documents


0 download

TRANSCRIPT

Bayesian Inference I4/23/12

• Law of total probability• Bayes Rule

Section 11.2 (pdf) Professor Kari Lock MorganDuke University

• Project 2 Paper (Wednesday, 4/25)

• FINAL: Monday, 4/30, 9 – 12

To Do

• Conditions apply to overall model; not each variable individually

• R2 is the proportion of variability in the response that is explained by the explanatory variables (not adjusted R2)

• Coefficients and significance of categorical variables are in reference to the reference level (the category left out)

• Don’t take significant predictors out of your model!

Comments on Projects

FINALMONDAY, APRIL 30th

9 – 12 pmBring:• A calculator• 3 double-sided pages of notes, prepared only by you

• The final will cover material from the entire course

• The format will be similar to the two in-class exams we’ve had so far, only longer

• No make-up exam will be given; 0 if you do not take it• STINFs do NOT apply for the final

Disjoint and IndependentAssuming that P(A) > 0 and P(B) > 0, then disjoint events are

a) Independentb) Not independentc) Need more information to determine

whether the events are also independent

Law of Total Probability

• If events B1 through Bk are disjoint and together make up all possibilities, then

1 2( and ) ( and ) ... ( an) d )( kP A B P A B P AP A B

A

B1 B2B3

Sexual Orientation

P(bisexual) = P(bisexual and male) + P(bisexual and female)= 66/5042 + 92/5042 = 158/5042

Male Female TotalHeterosexual 2325 2348 4673Homosexual 105 23 128Bisexual 66 92 158Other 25 58 83Total 2521 2521 5042

Craps

• Let’s put it all together!

•What’s the probability of winning at Craps?

Craps Rules• Each role consists of rolling two dice

• On the first role:• You lose (crap out) if your sum is 2, 3, or 12• You win if your sum is 7 or 11• Otherwise, your total is your point and you keep on

rolling

• On subsequent roles:• You win if the sum equals your point (your total from

the first role)• You lose if you role a 7• Otherwise, you keep rolling

Play a game!

Craps

Option 1: Simulation

Did you win?

(a) Yes(b) No

Option 2: Probability rules. (see handout)

Is it smart to play craps?

(a) Yes

(b) No

Craps

First Role 2 3 4 5 6 7 8 9 10 11 12

P(Win if first role = ___) 0 0 3/9 4/10 5/11 1 5/11 4/10 3/9 1 0

(win if first role = 4) P= (4 if (4 or 7)) P

(4 and (4 or 7))=

(4 or 7)

P

P(4)

(4) (7) (4 and 7)

P

P P P

(4)

(4) (7)

P

P P

3 / 36 3 1

3 / 36 6 / 36 9 3

(win if first role = point)

(point) =

(point) (7)

P

P

P P

1. Find P(win if first role = ___) for each of the possibilities.  

Craps

First Role 2 3 4 5 6 7 8 9 10 11 12

P(Win and first role = ___) 0 0 .028 .044 .063 .167 .063 .044 .028 .056 0

(win and first role = 4) P= (win if first role = (first role 4 ) 4) = P P

3=

9

3

36

10.028

36 (win and first role = point)

= (win if first role = point) (first role = nt) poiP

P

P

2. Find P(win and first role = ___) for each of the possibilities.  

Craps

First Role 2 3 4 5 6 7 8 9 10 11 12

P(Win and first role = ___) 0 0 .028 .044 .063 .167 .063 .044 .028 .056 0

(win) (win and first role = 2) + ... (win and first role = 12) P P P

= 0 0 0.028 0.044 0.063 0.167 0.063 0.044 0.028 0.056 0

0.493

3. Use the law of total probability to find P(win).

4. Assuming you win the same amount you bet, is it smart to play Craps?

No. You are more likely to lose than win.

15

A 40-year old woman participates in routine screening and has a positive mammography. What’s the probability she has cancer?

a) 0-10%b) 10-25%c) 25-50%d) 50-75%e) 75-100%

Breast Cancer Screening

16

• 1% of women at age 40 who participate in routine screening have breast cancer.

• 80% of women with breast cancer get positive mammographies.

• 9.6% of women without breast cancer get positive mammographies.

• A 40-year old woman participates in routine screening and has a positive mammography. What’s the probability she has cancer?

Breast Cancer Screening

17

A 40-year old woman participates in routine screening and has a positive mammography. What’s the probability she has cancer?

a) 0-10%b) 10-25%c) 25-50%d) 50-75%e) 75-100%

Breast Cancer Screening

Breast Cancer ScreeningA 40-year old woman participates in routine screening and has a positive mammography. What’s the probability she has cancer?

What is this asking for?

a) P(cancer if positive mammography)b) P(positive mammography if cancer)c) P(positive mammography if no cancer)d) P(positive mammography)e) P(cancer)

Bayes Rule

( if(

) (

)f )

)

(i

P B A PB

AA

PP

B

• We know P(positive mammography if cancer)… how do we get to P(cancer if positive mammography)?

• How do we go from P(A if B) to P(B if A)?

20

Bayes Rule( and )

( if )( )

P A BP A B

P B

( and ) ( if ) ( )P A B P A B P B ( and ) ( if ) ( )P A B P B A P A

( and ) ( if ) ( )( if )

( ) ( )

P A B P B A P AP A B

P B P B

( if ) ( )( if )

( )

P B A P AP A B

P B <- Bayes

Rule

Rev. Thomas Bayes

1702 - 1761

Breast Cancer Screening(positive if cancer) (cancer)

(cancer if positive)(positive)

P PP

P

• 1% of women at age 40 who participate in routine screening have breast cancer.

• 80% of women with breast cancer get positive mammographies.

• 9.6% of women without breast cancer get positive mammographies.

0.8(cancer if positive)

(positive)

0.01P

P

P(positive)

1. Use the law of total probability to find P(positive).

2. Find P(cancer if positive)

0.8(cancer if positive)

(positive)

0.01P

P

(positive) (positive and cancer) + (positive and no cancer)P P P

0.8 0.01 0.096 0.99 0.103

0.010.8 0.8(cancer if positive) 0.078

(pos

0.0

itive) 0

1

.103P

P

= (positive if cancer) (positive if no cancer)(cancer) + (no cancer) P PP P