image: mattbuck - stanford university · juniors p(c|j)= p(cj) p(j) =? /65 16/65 c: event that...
TRANSCRIPT
![Page 1: image: mattbuck - Stanford University · Juniors P(C|J)= P(CJ) P(J) =? /65 16/65 C: event that randomly chosen student comes to class J: event that randomly chosen student is a junior](https://reader035.vdocuments.mx/reader035/viewer/2022071112/5fe82f48abe8da61e6569343/html5/thumbnails/1.jpg)
Conditional Probability
Will MonroeJuly 3, 2017
with materials byMehran Sahamiand Chris Piech
image: mattbuck
![Page 2: image: mattbuck - Stanford University · Juniors P(C|J)= P(CJ) P(J) =? /65 16/65 C: event that randomly chosen student comes to class J: event that randomly chosen student is a junior](https://reader035.vdocuments.mx/reader035/viewer/2022071112/5fe82f48abe8da61e6569343/html5/thumbnails/2.jpg)
Announcements: Problem Set #1
Due this Wednesday!
4.c is particularly challenging.
![Page 3: image: mattbuck - Stanford University · Juniors P(C|J)= P(CJ) P(J) =? /65 16/65 C: event that randomly chosen student comes to class J: event that randomly chosen student is a junior](https://reader035.vdocuments.mx/reader035/viewer/2022071112/5fe82f48abe8da61e6569343/html5/thumbnails/3.jpg)
Announcements: Python!
Handout on website
Tutorial: Wed. 7/5, 2:30pm
![Page 4: image: mattbuck - Stanford University · Juniors P(C|J)= P(CJ) P(J) =? /65 16/65 C: event that randomly chosen student comes to class J: event that randomly chosen student is a junior](https://reader035.vdocuments.mx/reader035/viewer/2022071112/5fe82f48abe8da61e6569343/html5/thumbnails/4.jpg)
P(E)=limn→∞
# (E)
n
Review: What is a probability?
![Page 5: image: mattbuck - Stanford University · Juniors P(C|J)= P(CJ) P(J) =? /65 16/65 C: event that randomly chosen student comes to class J: event that randomly chosen student is a junior](https://reader035.vdocuments.mx/reader035/viewer/2022071112/5fe82f48abe8da61e6569343/html5/thumbnails/5.jpg)
Review: Meaning of probability
A quantification of ignorance
image: Frank Derks
![Page 6: image: mattbuck - Stanford University · Juniors P(C|J)= P(CJ) P(J) =? /65 16/65 C: event that randomly chosen student comes to class J: event that randomly chosen student is a junior](https://reader035.vdocuments.mx/reader035/viewer/2022071112/5fe82f48abe8da61e6569343/html5/thumbnails/6.jpg)
Review: Meaning of probability
A quantification of ignorance
image: www.yourbestdigs.com
![Page 7: image: mattbuck - Stanford University · Juniors P(C|J)= P(CJ) P(J) =? /65 16/65 C: event that randomly chosen student comes to class J: event that randomly chosen student is a junior](https://reader035.vdocuments.mx/reader035/viewer/2022071112/5fe82f48abe8da61e6569343/html5/thumbnails/7.jpg)
Review: Axioms of probability
0≤P(E)≤1
P(S)=1
P(E∪F)=P(E)+P(F)If E∩F=∅ , then
(1)
(2)
(3)
(Sum rule, but with probabilities!)
![Page 8: image: mattbuck - Stanford University · Juniors P(C|J)= P(CJ) P(J) =? /65 16/65 C: event that randomly chosen student comes to class J: event that randomly chosen student is a junior](https://reader035.vdocuments.mx/reader035/viewer/2022071112/5fe82f48abe8da61e6569343/html5/thumbnails/8.jpg)
Review: Corollaries
P(Ec)=1−P(E)
P(E∪F)=P(E)+P(F)−P(EF)
If E⊆F , then P(E)≤P(F)
(Principle of inclusion/exclusion, but with probabilities!)
![Page 9: image: mattbuck - Stanford University · Juniors P(C|J)= P(CJ) P(J) =? /65 16/65 C: event that randomly chosen student comes to class J: event that randomly chosen student is a junior](https://reader035.vdocuments.mx/reader035/viewer/2022071112/5fe82f48abe8da61e6569343/html5/thumbnails/9.jpg)
Review: Inclusion/exclusion withmore than two sets
P(⋃i=1
n
Ei)=∑r=1
n
(−1)(r+1) ∑
i1<⋯< ir
P(⋂j=1
r
Ei j)
prob. ofOR
sum oversubsetsizes
add orsubtract
(based on size)
prob. ofAND
sum overall subsetsof that size
![Page 10: image: mattbuck - Stanford University · Juniors P(C|J)= P(CJ) P(J) =? /65 16/65 C: event that randomly chosen student comes to class J: event that randomly chosen student is a junior](https://reader035.vdocuments.mx/reader035/viewer/2022071112/5fe82f48abe8da61e6569343/html5/thumbnails/10.jpg)
Equally likely outcomes
Coin flip
Two coin flips
Roll of 6-sided die
S = {Heads, Tails}
S = {(H, H), (H, T), (T, H), (T, T)}
S = {1, 2, 3, 4, 5, 6}
P(Each outcome)=1|S|
P(E)=|E|
|S|(counting!)
![Page 11: image: mattbuck - Stanford University · Juniors P(C|J)= P(CJ) P(J) =? /65 16/65 C: event that randomly chosen student comes to class J: event that randomly chosen student is a junior](https://reader035.vdocuments.mx/reader035/viewer/2022071112/5fe82f48abe8da61e6569343/html5/thumbnails/11.jpg)
Review: How do I get started?
For word problems involving probability,start by defining events!
![Page 12: image: mattbuck - Stanford University · Juniors P(C|J)= P(CJ) P(J) =? /65 16/65 C: event that randomly chosen student comes to class J: event that randomly chosen student is a junior](https://reader035.vdocuments.mx/reader035/viewer/2022071112/5fe82f48abe8da61e6569343/html5/thumbnails/12.jpg)
Review: Getting rid of ORs
Finding the probability of an OR of events can be nasty. Try using De Morgan's laws to turn it into an AND!
P(A∪B∪⋯∪Z )=1−P(Ac Bc⋯Zc
)
E F
S
![Page 14: image: mattbuck - Stanford University · Juniors P(C|J)= P(CJ) P(J) =? /65 16/65 C: event that randomly chosen student comes to class J: event that randomly chosen student is a junior](https://reader035.vdocuments.mx/reader035/viewer/2022071112/5fe82f48abe8da61e6569343/html5/thumbnails/14.jpg)
Review: Flipping cards● Shuffle deck.
● Reveal cards from the top until we get an Ace. Put Ace aside.
● What is P(next card is the Ace of Spades)?
● P(next card is the 2 of Clubs)?
P(Ace of Spades) = P(2 of Clubs)
![Page 15: image: mattbuck - Stanford University · Juniors P(C|J)= P(CJ) P(J) =? /65 16/65 C: event that randomly chosen student comes to class J: event that randomly chosen student is a junior](https://reader035.vdocuments.mx/reader035/viewer/2022071112/5fe82f48abe8da61e6569343/html5/thumbnails/15.jpg)
Definition of conditional probability
The conditional probability P(E | F) is the probability that E happens, given that F has happened. F is the new sample space.
P(E|F )=P(EF)
P(F)
E F
S
EF
![Page 16: image: mattbuck - Stanford University · Juniors P(C|J)= P(CJ) P(J) =? /65 16/65 C: event that randomly chosen student comes to class J: event that randomly chosen student is a junior](https://reader035.vdocuments.mx/reader035/viewer/2022071112/5fe82f48abe8da61e6569343/html5/thumbnails/16.jpg)
Equally likely outcomes
If all outcomes are equally likely:
P(E|F )=|EF|
|F|
E F
S
EF
![Page 17: image: mattbuck - Stanford University · Juniors P(C|J)= P(CJ) P(J) =? /65 16/65 C: event that randomly chosen student comes to class J: event that randomly chosen student is a junior](https://reader035.vdocuments.mx/reader035/viewer/2022071112/5fe82f48abe8da61e6569343/html5/thumbnails/17.jpg)
Rolling two dice
D1 D2
E: {all outcomes such that the sum of the two dice is 4}
What should you hope for D1 to be?
A) 2B) 1 and 3 are equally goodC) 1, 2, 3 are equally goodD) other
https://bit.ly/1a2ki4G → https://b.socrative.com/login/student/Room: CS109SUMMER17
![Page 18: image: mattbuck - Stanford University · Juniors P(C|J)= P(CJ) P(J) =? /65 16/65 C: event that randomly chosen student comes to class J: event that randomly chosen student is a junior](https://reader035.vdocuments.mx/reader035/viewer/2022071112/5fe82f48abe8da61e6569343/html5/thumbnails/18.jpg)
Rolling two dice
D1 D2
E: {all outcomes such that the sum of the two dice is 4}
P(D1+D2=4)=?
![Page 19: image: mattbuck - Stanford University · Juniors P(C|J)= P(CJ) P(J) =? /65 16/65 C: event that randomly chosen student comes to class J: event that randomly chosen student is a junior](https://reader035.vdocuments.mx/reader035/viewer/2022071112/5fe82f48abe8da61e6569343/html5/thumbnails/19.jpg)
Rolling two dice
P(D1+D2=4)=3
36=
112D1 D2
S = {(1, 1), (1, 2), (1, 3), (1, 4), (1, 5), (1, 6),
S = {(2, 1), (2, 2), (2, 3), (2, 4), (2, 5), (2, 6),
S = {(3, 1), (3, 2), (3, 3), (3, 4), (3, 5), (3, 6),
S = {(4, 1), (4, 2), (4, 3), (4, 4), (4, 5), (4, 6),
S = {(5, 1), (5, 2), (5, 3), (5, 4), (5, 5), (5, 6),
S = {(6, 1), (6, 2), (6, 3), (6, 4), (6, 5), (6, 6)}
|S|=36
|E|=3
![Page 20: image: mattbuck - Stanford University · Juniors P(C|J)= P(CJ) P(J) =? /65 16/65 C: event that randomly chosen student comes to class J: event that randomly chosen student is a junior](https://reader035.vdocuments.mx/reader035/viewer/2022071112/5fe82f48abe8da61e6569343/html5/thumbnails/20.jpg)
Rolling two dice
P(D1+D2=4|D1=2)=?D1 D2
E: {all outcomes such that the sum of the two dice is 4}
F: {all outcomes such that the first die is 2}
![Page 21: image: mattbuck - Stanford University · Juniors P(C|J)= P(CJ) P(J) =? /65 16/65 C: event that randomly chosen student comes to class J: event that randomly chosen student is a junior](https://reader035.vdocuments.mx/reader035/viewer/2022071112/5fe82f48abe8da61e6569343/html5/thumbnails/21.jpg)
Rolling two dice
P(E|F)=?D1 D2
E: {all outcomes such that the sum of the two dice is 4}
F: {all outcomes such that the first die is 2}
![Page 22: image: mattbuck - Stanford University · Juniors P(C|J)= P(CJ) P(J) =? /65 16/65 C: event that randomly chosen student comes to class J: event that randomly chosen student is a junior](https://reader035.vdocuments.mx/reader035/viewer/2022071112/5fe82f48abe8da61e6569343/html5/thumbnails/22.jpg)
Rolling two dice
D1 D2S = {(1, 1), (1, 2), (1, 3), (1, 4), (1, 5), (1, 6),
S = {(2, 1), (2, 2), (2, 3), (2, 4), (2, 5), (2, 6),
S = {(3, 1), (3, 2), (3, 3), (3, 4), (3, 5), (3, 6),
S = {(4, 1), (4, 2), (4, 3), (4, 4), (4, 5), (4, 6),
S = {(5, 1), (5, 2), (5, 3), (5, 4), (5, 5), (5, 6),
S = {(6, 1), (6, 2), (6, 3), (6, 4), (6, 5), (6, 6)}
P(E|F)=?
![Page 23: image: mattbuck - Stanford University · Juniors P(C|J)= P(CJ) P(J) =? /65 16/65 C: event that randomly chosen student comes to class J: event that randomly chosen student is a junior](https://reader035.vdocuments.mx/reader035/viewer/2022071112/5fe82f48abe8da61e6569343/html5/thumbnails/23.jpg)
Rolling two dice
P(E|F)=16D1 D2
S = {(1, 1), (1, 2), (1, 3), (1, 4), (1, 5), (1, 6),
S = {(2, 1), (2, 2), (2, 3), (2, 4), (2, 5), (2, 6),
S = {(3, 1), (3, 2), (3, 3), (3, 4), (3, 5), (3, 6),
S = {(4, 1), (4, 2), (4, 3), (4, 4), (4, 5), (4, 6),
S = {(5, 1), (5, 2), (5, 3), (5, 4), (5, 5), (5, 6),
S = {(6, 1), (6, 2), (6, 3), (6, 4), (6, 5), (6, 6)}
|F|=6
|EF|=1
![Page 24: image: mattbuck - Stanford University · Juniors P(C|J)= P(CJ) P(J) =? /65 16/65 C: event that randomly chosen student comes to class J: event that randomly chosen student is a junior](https://reader035.vdocuments.mx/reader035/viewer/2022071112/5fe82f48abe8da61e6569343/html5/thumbnails/24.jpg)
Definition of conditional probability
The conditional probability P(E | F) is the probability that E happens, given that F has happened. F is the new sample space.
P(E|F )=P(EF)
P(F)
E F
S
EF
![Page 25: image: mattbuck - Stanford University · Juniors P(C|J)= P(CJ) P(J) =? /65 16/65 C: event that randomly chosen student comes to class J: event that randomly chosen student is a junior](https://reader035.vdocuments.mx/reader035/viewer/2022071112/5fe82f48abe8da61e6569343/html5/thumbnails/25.jpg)
Rolling two dice
P(E|F)=16=
1/366 /36D1 D2
S = {(1, 1), (1, 2), (1, 3), (1, 4), (1, 5), (1, 6),
S = {(2, 1), (2, 2), (2, 3), (2, 4), (2, 5), (2, 6),
S = {(3, 1), (3, 2), (3, 3), (3, 4), (3, 5), (3, 6),
S = {(4, 1), (4, 2), (4, 3), (4, 4), (4, 5), (4, 6),
S = {(5, 1), (5, 2), (5, 3), (5, 4), (5, 5), (5, 6),
S = {(6, 1), (6, 2), (6, 3), (6, 4), (6, 5), (6, 6)}
|F|=6
|EF|=1
![Page 26: image: mattbuck - Stanford University · Juniors P(C|J)= P(CJ) P(J) =? /65 16/65 C: event that randomly chosen student comes to class J: event that randomly chosen student is a junior](https://reader035.vdocuments.mx/reader035/viewer/2022071112/5fe82f48abe8da61e6569343/html5/thumbnails/26.jpg)
Juniors
P(C|J )=P(CJ )
P(J )=
? /6516 /65
C: event that randomly chosen student comes to classJ: event that randomly chosen student is a junior
What is the probability that a randomly chosen (rising) junior in CS 109 comes to class?
![Page 27: image: mattbuck - Stanford University · Juniors P(C|J)= P(CJ) P(J) =? /65 16/65 C: event that randomly chosen student comes to class J: event that randomly chosen student is a junior](https://reader035.vdocuments.mx/reader035/viewer/2022071112/5fe82f48abe8da61e6569343/html5/thumbnails/27.jpg)
What if P(F) = 0?
Congratulations! You've observed the impossible!
P(E|F )=P(EF)
P(F)ZeroDivisionError: float division by zero
![Page 28: image: mattbuck - Stanford University · Juniors P(C|J)= P(CJ) P(J) =? /65 16/65 C: event that randomly chosen student comes to class J: event that randomly chosen student is a junior](https://reader035.vdocuments.mx/reader035/viewer/2022071112/5fe82f48abe8da61e6569343/html5/thumbnails/28.jpg)
Definition of conditional probability
The conditional probability P(E | F) is the probability that E happens, given that F has happened. F is the new sample space.
P(E|F )=P(EF)
P(F)
E F
S
EF
![Page 29: image: mattbuck - Stanford University · Juniors P(C|J)= P(CJ) P(J) =? /65 16/65 C: event that randomly chosen student comes to class J: event that randomly chosen student is a junior](https://reader035.vdocuments.mx/reader035/viewer/2022071112/5fe82f48abe8da61e6569343/html5/thumbnails/29.jpg)
Chain rule of probability
The probability of both events happeningis the probability of one happening times the probability of the other happening given the first one.
P(EF )=P (F)P(E|F )
E F
S
EF F
S
EF Fx=
![Page 30: image: mattbuck - Stanford University · Juniors P(C|J)= P(CJ) P(J) =? /65 16/65 C: event that randomly chosen student comes to class J: event that randomly chosen student is a junior](https://reader035.vdocuments.mx/reader035/viewer/2022071112/5fe82f48abe8da61e6569343/html5/thumbnails/30.jpg)
General chain rule of probability
The probability of all events happeningis the probability of the first happeningtimes the prob. of the second given the firsttimes the prob. of the third given the first two...etc.
P(EFG…)=P(E)P(F|E)P(G|EF)…
![Page 31: image: mattbuck - Stanford University · Juniors P(C|J)= P(CJ) P(J) =? /65 16/65 C: event that randomly chosen student comes to class J: event that randomly chosen student is a junior](https://reader035.vdocuments.mx/reader035/viewer/2022071112/5fe82f48abe8da61e6569343/html5/thumbnails/31.jpg)
Four piles of cards
● Divide deck randomly into 4 piles of 13 cards each.
● What is P(one Ace in each pile)?
|S|=( 5213,13,13,13)
|E|=4 !⋅( 4812,12,12,12)
P(E)=|E|
|S|≈0.105
S: ways of labeling 52 cards with 4 types of labelsE: ways resulting in all Aces getting different labels
![Page 32: image: mattbuck - Stanford University · Juniors P(C|J)= P(CJ) P(J) =? /65 16/65 C: event that randomly chosen student comes to class J: event that randomly chosen student is a junior](https://reader035.vdocuments.mx/reader035/viewer/2022071112/5fe82f48abe8da61e6569343/html5/thumbnails/32.jpg)
Four piles of cards
● Divide deck randomly into 4 piles of 13 cards each.
● What is P(one Ace in each pile)?
P(E)=P (E1 E2 E3 E4)=P (E1)P(E2|E1)P(E3|E1 E2)P(E4|E1 E2 E3)
E1: Ace of Spades goes in any one pile
E2: Ace of Clubs goes in different pile from Spades
E3: Ace of Hearts goes in different pile from first two
E4: Ace of Diamonds goes in different pile from first three
=5252
⋅3951
⋅2650
⋅1349
≈0.105
![Page 33: image: mattbuck - Stanford University · Juniors P(C|J)= P(CJ) P(J) =? /65 16/65 C: event that randomly chosen student comes to class J: event that randomly chosen student is a junior](https://reader035.vdocuments.mx/reader035/viewer/2022071112/5fe82f48abe8da61e6569343/html5/thumbnails/33.jpg)
Law of total probability
You can compute an overall probability by adding up the case when an event happens and when it doesn't happen.
P(F )=P(EF)+P(EC F)
P(F )=P(E)P(F|E)+P(EC)P(F|EC
)
EF +F
S
=
S
EcF
S
![Page 34: image: mattbuck - Stanford University · Juniors P(C|J)= P(CJ) P(J) =? /65 16/65 C: event that randomly chosen student comes to class J: event that randomly chosen student is a junior](https://reader035.vdocuments.mx/reader035/viewer/2022071112/5fe82f48abe8da61e6569343/html5/thumbnails/34.jpg)
Majoring in CS
P(M )=|M|
|S|=
765
What is the probability that a randomly chosen student in CS 109 is a (declared) CS major (M)?
![Page 35: image: mattbuck - Stanford University · Juniors P(C|J)= P(CJ) P(J) =? /65 16/65 C: event that randomly chosen student comes to class J: event that randomly chosen student is a junior](https://reader035.vdocuments.mx/reader035/viewer/2022071112/5fe82f48abe8da61e6569343/html5/thumbnails/35.jpg)
Majoring in CS
P(M )=P(J M )+P(JC M )
What is the probability that a randomly chosen student in CS 109 is a (declared) CS major (M)?
=|J M|
|S|+|JC M|
|S|
juniors(J)
=365
+4
65=
765
![Page 36: image: mattbuck - Stanford University · Juniors P(C|J)= P(CJ) P(J) =? /65 16/65 C: event that randomly chosen student comes to class J: event that randomly chosen student is a junior](https://reader035.vdocuments.mx/reader035/viewer/2022071112/5fe82f48abe8da61e6569343/html5/thumbnails/36.jpg)
Majoring in CS
P(M )=P(J )P(M|J )
What is the probability that a randomly chosen student in CS 109 is a (declared) CS major (M)?
+P(JC)P(M|JC
)juniors(J)
=1665
⋅316
+4965
⋅449
=765
![Page 37: image: mattbuck - Stanford University · Juniors P(C|J)= P(CJ) P(J) =? /65 16/65 C: event that randomly chosen student comes to class J: event that randomly chosen student is a junior](https://reader035.vdocuments.mx/reader035/viewer/2022071112/5fe82f48abe8da61e6569343/html5/thumbnails/37.jpg)
General law of total probability
You can compute an overall probability by summing over mutually exclusive and exhaustive sub-cases.
P(F )=∑i
P(Ei F )
E1
FS
P(F )=∑i
P(E i)P(F|Ei)
E2
E3
E4
E2F
E3FE
4F
E1F
![Page 38: image: mattbuck - Stanford University · Juniors P(C|J)= P(CJ) P(J) =? /65 16/65 C: event that randomly chosen student comes to class J: event that randomly chosen student is a junior](https://reader035.vdocuments.mx/reader035/viewer/2022071112/5fe82f48abe8da61e6569343/html5/thumbnails/38.jpg)
Majoring in CS
P(M )=P(J )P(M|J )
What is the probability that a randomly chosen student in CS 109 is a (declared) CS major (M)?
+P(JC)P(M|JC
)juniors(J)
=1665
⋅316
+4965
⋅449
=765
![Page 39: image: mattbuck - Stanford University · Juniors P(C|J)= P(CJ) P(J) =? /65 16/65 C: event that randomly chosen student comes to class J: event that randomly chosen student is a junior](https://reader035.vdocuments.mx/reader035/viewer/2022071112/5fe82f48abe8da61e6569343/html5/thumbnails/39.jpg)
Majoring in CSWhat is the probability that a randomly chosen student in CS 109 is a (declared) CS major (M)?
juniors(J)juniors(J)
sophomores (Σ)
seniors (S)
other(O)
grads(G)
P(M )=P(M Σ)+P(M J )
+P(M S)+P(M G)
+P(M O)
=065
+365
+265
+265
+065
=765
![Page 40: image: mattbuck - Stanford University · Juniors P(C|J)= P(CJ) P(J) =? /65 16/65 C: event that randomly chosen student comes to class J: event that randomly chosen student is a junior](https://reader035.vdocuments.mx/reader035/viewer/2022071112/5fe82f48abe8da61e6569343/html5/thumbnails/40.jpg)
Majoring in CSWhat is the probability that a randomly chosen student in CS 109 is a (declared) CS major (M)?
juniors(J)juniors(J)
sophomores (Σ)
seniors (S)
other(O)
grads(G)
P(M )=P(Σ)P(M|Σ)
+P(J )P (M|J )
+P(S)P(M|S)
=07⋅
765
+3
16⋅
1665
+25⋅
565
+2
23⋅
2365
+0
14⋅
1465
=765
+P(G)P(M|G)
+P(O)P(M|O)
![Page 41: image: mattbuck - Stanford University · Juniors P(C|J)= P(CJ) P(J) =? /65 16/65 C: event that randomly chosen student comes to class J: event that randomly chosen student is a junior](https://reader035.vdocuments.mx/reader035/viewer/2022071112/5fe82f48abe8da61e6569343/html5/thumbnails/41.jpg)
General law of total probability
You can compute an overall probability by summing over mutually exclusive and exhaustive sub-cases.
P(F )=∑i
P(Ei F )
E1
FS
P(F )=∑i
P(E i)P(F|Ei)
E2
E3
E4
E2F
E3FE
4F
E1F
![Page 42: image: mattbuck - Stanford University · Juniors P(C|J)= P(CJ) P(J) =? /65 16/65 C: event that randomly chosen student comes to class J: event that randomly chosen student is a junior](https://reader035.vdocuments.mx/reader035/viewer/2022071112/5fe82f48abe8da61e6569343/html5/thumbnails/42.jpg)
Break time!
![Page 43: image: mattbuck - Stanford University · Juniors P(C|J)= P(CJ) P(J) =? /65 16/65 C: event that randomly chosen student comes to class J: event that randomly chosen student is a junior](https://reader035.vdocuments.mx/reader035/viewer/2022071112/5fe82f48abe8da61e6569343/html5/thumbnails/43.jpg)
Bayes' theorem
You can “flip” a conditional probability if you multiply by the probability of the hypothesis and divide by the probability of the observation.
P(E|F )=P(F|E)P (E)
P(F )
![Page 44: image: mattbuck - Stanford University · Juniors P(C|J)= P(CJ) P(J) =? /65 16/65 C: event that randomly chosen student comes to class J: event that randomly chosen student is a junior](https://reader035.vdocuments.mx/reader035/viewer/2022071112/5fe82f48abe8da61e6569343/html5/thumbnails/44.jpg)
Probabilistic inference
Unobserved truth
E
F
Evidence
P(E|F)
Beliefs
![Page 45: image: mattbuck - Stanford University · Juniors P(C|J)= P(CJ) P(J) =? /65 16/65 C: event that randomly chosen student comes to class J: event that randomly chosen student is a junior](https://reader035.vdocuments.mx/reader035/viewer/2022071112/5fe82f48abe8da61e6569343/html5/thumbnails/45.jpg)
Probabilistic inference
E
F
P(E|F)
P(E|F )=P(EF)
P(F)
P(E|F )=P(F|E)P (E)
P(F )
definition ofconditionalprobability
chain rule(aka same def'n,
plus algebra)
![Page 46: image: mattbuck - Stanford University · Juniors P(C|J)= P(CJ) P(J) =? /65 16/65 C: event that randomly chosen student comes to class J: event that randomly chosen student is a junior](https://reader035.vdocuments.mx/reader035/viewer/2022071112/5fe82f48abe8da61e6569343/html5/thumbnails/46.jpg)
Finding the denominator
If you don't know P(F) on the bottom,try using the law of total probability.
P(E|F )=P(F|E)P(E)
P(F|E)P (E)+P(F|Ec)P(Ec
)
P(E|F )=P(F|E)P(E)
∑i
P(F|Ei)P(Ei)
![Page 47: image: mattbuck - Stanford University · Juniors P(C|J)= P(CJ) P(J) =? /65 16/65 C: event that randomly chosen student comes to class J: event that randomly chosen student is a junior](https://reader035.vdocuments.mx/reader035/viewer/2022071112/5fe82f48abe8da61e6569343/html5/thumbnails/47.jpg)
Zika testing0.08% of people have Zika
90% of people with Zika test positive
7% of people without Zika test positive
Someone tests positive. What's the probability they have Zika?
Z: event that person has ZikaT: event that person tests positive
P(Z )=0.0008
P(T|Z )=0.90
P(T|ZC)=0.07
P(Z|T )=P (T|Z)P (Z)
P(T )
?
![Page 48: image: mattbuck - Stanford University · Juniors P(C|J)= P(CJ) P(J) =? /65 16/65 C: event that randomly chosen student comes to class J: event that randomly chosen student is a junior](https://reader035.vdocuments.mx/reader035/viewer/2022071112/5fe82f48abe8da61e6569343/html5/thumbnails/48.jpg)
Zika testing0.08% of people have Zika
90% of people with Zika test positive
7% of people without Zika test positive
Someone tests positive. What's the probability they have Zika?
Z: event that person has ZikaT: event that person tests positive
P(Z )=0.0008
P(T|Z )=0.90
P(T|ZC)=0.07
P(Z|T )=P(T|Z )P(Z)
P (T|Z)P (Z )+P (T|ZC)P (ZC
)
![Page 49: image: mattbuck - Stanford University · Juniors P(C|J)= P(CJ) P(J) =? /65 16/65 C: event that randomly chosen student comes to class J: event that randomly chosen student is a junior](https://reader035.vdocuments.mx/reader035/viewer/2022071112/5fe82f48abe8da61e6569343/html5/thumbnails/49.jpg)
Zika testing0.08% of people have Zika
90% of people with Zika test positive
7% of people without Zika test positive
Someone tests positive. What's the probability they have Zika?
Z: event that person has ZikaT: event that person tests positive
P(Z )=0.0008
P(T|Z )=0.90
P(T|ZC)=0.07
P(Z|T )=P(T|Z )P(Z)
P (T|Z)P (Z )+P (T|ZC)P (ZC
)=
0.90⋅0.00080.90⋅0.0008+0.07⋅0.9992
≈0.01
![Page 50: image: mattbuck - Stanford University · Juniors P(C|J)= P(CJ) P(J) =? /65 16/65 C: event that randomly chosen student comes to class J: event that randomly chosen student is a junior](https://reader035.vdocuments.mx/reader035/viewer/2022071112/5fe82f48abe8da61e6569343/html5/thumbnails/50.jpg)
Bayes: Terminology
P(Z|T )=P(T|Z )P(Z)
P(T )
hypothesis
observation
![Page 51: image: mattbuck - Stanford University · Juniors P(C|J)= P(CJ) P(J) =? /65 16/65 C: event that randomly chosen student comes to class J: event that randomly chosen student is a junior](https://reader035.vdocuments.mx/reader035/viewer/2022071112/5fe82f48abe8da61e6569343/html5/thumbnails/51.jpg)
Bayes: Terminology
P(Z|T )=P(T|Z )P(Z)
P(T )posterior
priorlikelihood
normalizingconstant
![Page 52: image: mattbuck - Stanford University · Juniors P(C|J)= P(CJ) P(J) =? /65 16/65 C: event that randomly chosen student comes to class J: event that randomly chosen student is a junior](https://reader035.vdocuments.mx/reader035/viewer/2022071112/5fe82f48abe8da61e6569343/html5/thumbnails/52.jpg)
Bayes' theorem
You can “flip” a conditional probability if you multiply by the probability of the hypothesis and divide by the probability of the observation.
P(E|F )=P(F|E)P (E)
P(F )
![Page 53: image: mattbuck - Stanford University · Juniors P(C|J)= P(CJ) P(J) =? /65 16/65 C: event that randomly chosen student comes to class J: event that randomly chosen student is a junior](https://reader035.vdocuments.mx/reader035/viewer/2022071112/5fe82f48abe8da61e6569343/html5/thumbnails/53.jpg)
Thomas Bayes
Rev. Thomas Bayes (~1701-1761):British mathematician and Presbyterian minister
[citation needed]
images: (left) unknown, (right) Martin ormazabal
![Page 54: image: mattbuck - Stanford University · Juniors P(C|J)= P(CJ) P(J) =? /65 16/65 C: event that randomly chosen student comes to class J: event that randomly chosen student is a junior](https://reader035.vdocuments.mx/reader035/viewer/2022071112/5fe82f48abe8da61e6569343/html5/thumbnails/54.jpg)
Implicatures
Work is work.
Examples adapted from Grice (1970)
![Page 55: image: mattbuck - Stanford University · Juniors P(C|J)= P(CJ) P(J) =? /65 16/65 C: event that randomly chosen student comes to class J: event that randomly chosen student is a junior](https://reader035.vdocuments.mx/reader035/viewer/2022071112/5fe82f48abe8da61e6569343/html5/thumbnails/55.jpg)
Implicatures
Will produced a series of sounds that corresponded closely to the tune of “Hey Jude.”
Examples adapted from Grice (1970)
![Page 56: image: mattbuck - Stanford University · Juniors P(C|J)= P(CJ) P(J) =? /65 16/65 C: event that randomly chosen student comes to class J: event that randomly chosen student is a junior](https://reader035.vdocuments.mx/reader035/viewer/2022071112/5fe82f48abe8da61e6569343/html5/thumbnails/56.jpg)
Implicatures: Grice's maxims
● “Make your contribution as informative as required [...]
● Do not make your contribution more informative than is required. [...]
● Do not say what you believe to be false. [...]
● Avoid obscurity of expression.
● Avoid ambiguity.● Be brief (avoid unnecessary prolixity).”
(Grice, 1970)
Image credit: Siobhan Chapman
![Page 57: image: mattbuck - Stanford University · Juniors P(C|J)= P(CJ) P(J) =? /65 16/65 C: event that randomly chosen student comes to class J: event that randomly chosen student is a junior](https://reader035.vdocuments.mx/reader035/viewer/2022071112/5fe82f48abe8da61e6569343/html5/thumbnails/57.jpg)
Implicatures: Grice's maxims
Work is work.
“Make your contribution as informative as required”
![Page 58: image: mattbuck - Stanford University · Juniors P(C|J)= P(CJ) P(J) =? /65 16/65 C: event that randomly chosen student comes to class J: event that randomly chosen student is a junior](https://reader035.vdocuments.mx/reader035/viewer/2022071112/5fe82f48abe8da61e6569343/html5/thumbnails/58.jpg)
Implicatures: Grice's maxims
Will produced a series of sounds that corresponded closely to the tune of “Hey Jude.”
“Be brief (avoid unnecessary prolixity).”
![Page 59: image: mattbuck - Stanford University · Juniors P(C|J)= P(CJ) P(J) =? /65 16/65 C: event that randomly chosen student comes to class J: event that randomly chosen student is a junior](https://reader035.vdocuments.mx/reader035/viewer/2022071112/5fe82f48abe8da61e6569343/html5/thumbnails/59.jpg)
Implicatures: Grice's maxims
How do you likemy new haircut?
...It's shorter inthe back!
“Be relevant.”
Image credit: Gage Skidmore
![Page 60: image: mattbuck - Stanford University · Juniors P(C|J)= P(CJ) P(J) =? /65 16/65 C: event that randomly chosen student comes to class J: event that randomly chosen student is a junior](https://reader035.vdocuments.mx/reader035/viewer/2022071112/5fe82f48abe8da61e6569343/html5/thumbnails/60.jpg)
Implicatures
1 2 3
Image credit: Chris Potts
![Page 61: image: mattbuck - Stanford University · Juniors P(C|J)= P(CJ) P(J) =? /65 16/65 C: event that randomly chosen student comes to class J: event that randomly chosen student is a junior](https://reader035.vdocuments.mx/reader035/viewer/2022071112/5fe82f48abe8da61e6569343/html5/thumbnails/61.jpg)
Implicatures
“glasses”
Image credit: Chris Potts
1 2 3
![Page 62: image: mattbuck - Stanford University · Juniors P(C|J)= P(CJ) P(J) =? /65 16/65 C: event that randomly chosen student comes to class J: event that randomly chosen student is a junior](https://reader035.vdocuments.mx/reader035/viewer/2022071112/5fe82f48abe8da61e6569343/html5/thumbnails/62.jpg)
Implicatures
“person”
Image credit: Chris Potts
1 2 3
![Page 63: image: mattbuck - Stanford University · Juniors P(C|J)= P(CJ) P(J) =? /65 16/65 C: event that randomly chosen student comes to class J: event that randomly chosen student is a junior](https://reader035.vdocuments.mx/reader035/viewer/2022071112/5fe82f48abe8da61e6569343/html5/thumbnails/63.jpg)
RSA: Bayesian pragmatic reasoning
“hat”
“glasses”
“person”
![Page 64: image: mattbuck - Stanford University · Juniors P(C|J)= P(CJ) P(J) =? /65 16/65 C: event that randomly chosen student comes to class J: event that randomly chosen student is a junior](https://reader035.vdocuments.mx/reader035/viewer/2022071112/5fe82f48abe8da61e6569343/html5/thumbnails/64.jpg)
RSA: Bayesian pragmatic reasoning
1
0.5
0.33
“hat”
“glasses”
“person”
0
0
0.33
0
0.5
0.33
literal(naive)listener
![Page 65: image: mattbuck - Stanford University · Juniors P(C|J)= P(CJ) P(J) =? /65 16/65 C: event that randomly chosen student comes to class J: event that randomly chosen student is a junior](https://reader035.vdocuments.mx/reader035/viewer/2022071112/5fe82f48abe8da61e6569343/html5/thumbnails/65.jpg)
RSA: Bayesian pragmatic reasoning
0.33
0.33
0.33
“hat”
“glasses”
“person”
0
0
1
0
0.5
0.5
literal(naive)
speaker
![Page 66: image: mattbuck - Stanford University · Juniors P(C|J)= P(CJ) P(J) =? /65 16/65 C: event that randomly chosen student comes to class J: event that randomly chosen student is a junior](https://reader035.vdocuments.mx/reader035/viewer/2022071112/5fe82f48abe8da61e6569343/html5/thumbnails/66.jpg)
RSA: Bayesian pragmatic reasoning
1
0.4
0.18
“hat”
“glasses”
“person”
0
0
0.55
0
0.6
0.27
t
m
L(t∣m)=
S (m∣t)P(t )P(m)
pragmatic listener
(Frank and Goodman, 2012)
![Page 67: image: mattbuck - Stanford University · Juniors P(C|J)= P(CJ) P(J) =? /65 16/65 C: event that randomly chosen student comes to class J: event that randomly chosen student is a junior](https://reader035.vdocuments.mx/reader035/viewer/2022071112/5fe82f48abe8da61e6569343/html5/thumbnails/67.jpg)
Conditional probabilitiesare still probabilities
Everything you know about some set of events is still trueif you condition consistently on some other event!
0≤P(E)≤1
![Page 68: image: mattbuck - Stanford University · Juniors P(C|J)= P(CJ) P(J) =? /65 16/65 C: event that randomly chosen student comes to class J: event that randomly chosen student is a junior](https://reader035.vdocuments.mx/reader035/viewer/2022071112/5fe82f48abe8da61e6569343/html5/thumbnails/68.jpg)
Conditional probabilitiesare still probabilities
Everything you know about some set of events is still trueif you condition consistently on some other event!
0≤P(E|G)≤1
![Page 69: image: mattbuck - Stanford University · Juniors P(C|J)= P(CJ) P(J) =? /65 16/65 C: event that randomly chosen student comes to class J: event that randomly chosen student is a junior](https://reader035.vdocuments.mx/reader035/viewer/2022071112/5fe82f48abe8da61e6569343/html5/thumbnails/69.jpg)
Conditional probabilitiesare still probabilities
Everything you know about some set of events is still trueif you condition consistently on some other event!
P(E)=1−P(Ec)
![Page 70: image: mattbuck - Stanford University · Juniors P(C|J)= P(CJ) P(J) =? /65 16/65 C: event that randomly chosen student comes to class J: event that randomly chosen student is a junior](https://reader035.vdocuments.mx/reader035/viewer/2022071112/5fe82f48abe8da61e6569343/html5/thumbnails/70.jpg)
Conditional probabilitiesare still probabilities
Everything you know about some set of events is still trueif you condition consistently on some other event!
P(E|G)=1−P(Ec|G)
![Page 71: image: mattbuck - Stanford University · Juniors P(C|J)= P(CJ) P(J) =? /65 16/65 C: event that randomly chosen student comes to class J: event that randomly chosen student is a junior](https://reader035.vdocuments.mx/reader035/viewer/2022071112/5fe82f48abe8da61e6569343/html5/thumbnails/71.jpg)
Conditional probabilitiesare still probabilities
Everything you know about some set of events is still trueif you condition consistently on some other event!
P(E|G)=1−P(Ec|G)
must bethe same!
![Page 72: image: mattbuck - Stanford University · Juniors P(C|J)= P(CJ) P(J) =? /65 16/65 C: event that randomly chosen student comes to class J: event that randomly chosen student is a junior](https://reader035.vdocuments.mx/reader035/viewer/2022071112/5fe82f48abe8da61e6569343/html5/thumbnails/72.jpg)
Conditional probabilitiesare still probabilities
Everything you know about some set of events is still trueif you condition consistently on some other event!
P(EF )=P (E|F)P(F )
![Page 73: image: mattbuck - Stanford University · Juniors P(C|J)= P(CJ) P(J) =? /65 16/65 C: event that randomly chosen student comes to class J: event that randomly chosen student is a junior](https://reader035.vdocuments.mx/reader035/viewer/2022071112/5fe82f48abe8da61e6569343/html5/thumbnails/73.jpg)
Conditional probabilitiesare still probabilities
Everything you know about some set of events is still trueif you condition consistently on some other event!
P(EF|G)=P(E|FG)P(F|G)
![Page 74: image: mattbuck - Stanford University · Juniors P(C|J)= P(CJ) P(J) =? /65 16/65 C: event that randomly chosen student comes to class J: event that randomly chosen student is a junior](https://reader035.vdocuments.mx/reader035/viewer/2022071112/5fe82f48abe8da61e6569343/html5/thumbnails/74.jpg)
Conditional probabilitiesare still probabilities
Everything you know about some set of events is still trueif you condition consistently on some other event!
P(EF|G)=P(E|FG)P(F|G)
same as P((E|F) | G)
“conditioning twice” =conditioning on AND
![Page 75: image: mattbuck - Stanford University · Juniors P(C|J)= P(CJ) P(J) =? /65 16/65 C: event that randomly chosen student comes to class J: event that randomly chosen student is a junior](https://reader035.vdocuments.mx/reader035/viewer/2022071112/5fe82f48abe8da61e6569343/html5/thumbnails/75.jpg)
Conditional probabilitiesare still probabilities
Everything you know about some set of events is still trueif you condition consistently on some other event!
P(E|F )=P(F|E)P (E)
P(F )
![Page 76: image: mattbuck - Stanford University · Juniors P(C|J)= P(CJ) P(J) =? /65 16/65 C: event that randomly chosen student comes to class J: event that randomly chosen student is a junior](https://reader035.vdocuments.mx/reader035/viewer/2022071112/5fe82f48abe8da61e6569343/html5/thumbnails/76.jpg)
Conditional probabilitiesare still probabilities
Everything you know about some set of events is still trueif you condition consistently on some other event!
P(E|FG)=P(F|EG)P (E|G)
P(F|G)
![Page 77: image: mattbuck - Stanford University · Juniors P(C|J)= P(CJ) P(J) =? /65 16/65 C: event that randomly chosen student comes to class J: event that randomly chosen student is a junior](https://reader035.vdocuments.mx/reader035/viewer/2022071112/5fe82f48abe8da61e6569343/html5/thumbnails/77.jpg)
Let's play a game
$1 $20 $1
![Page 78: image: mattbuck - Stanford University · Juniors P(C|J)= P(CJ) P(J) =? /65 16/65 C: event that randomly chosen student comes to class J: event that randomly chosen student is a junior](https://reader035.vdocuments.mx/reader035/viewer/2022071112/5fe82f48abe8da61e6569343/html5/thumbnails/78.jpg)
Let's Make a Deal
A has $20(P = 1/3):
stayingwins
B has $20(P = 1/3):
switchingwins
C has $20(P = 1/3):
switchingwins
Important assumption: host must open a $1!