+ - 0:00:00
Notes for current slide
Notes for next slide

Conditional Probability

Bora Jin

1 / 19

Material

🎥 Watch Conditional Probability

🎥 Watch Simpson's Paradox

2 / 19

Today's Goal

  • Define marginal, joint, and conditional probabilities, and calculate each “manually” and in a reproducible way
  • Identify when events are independent
  • Apply Bayes' theorem to examine COVID-19 test specificity
3 / 19

Quiz

Q - Find the correct term, a mathematical notation with events A and B, and an example for each of the following descriptions.

"The probability an event occurs regardless of values of the other event"

4 / 19

Quiz

Q - Find the correct term, a mathematical notation with events A and B, and an example for each of the following descriptions.

"The probability an event occurs regardless of values of the other event"

  • Marginal probability
4 / 19

Quiz

Q - Find the correct term, a mathematical notation with events A and B, and an example for each of the following descriptions.

"The probability an event occurs regardless of values of the other event"

  • Marginal probability

  • P(A) or P(B)

4 / 19

Quiz

Q - Find the correct term, a mathematical notation with events A and B, and an example for each of the following descriptions.

"The probability an event occurs regardless of values of the other event"

  • Marginal probability

  • P(A) or P(B)

  • The probability that a randomly selected student in STA199 favors dogs over cats.

4 / 19

Quiz

Q - Find the correct term, a mathematical notation with events A and B, and an example for each of the following descriptions.

"The probability two or more events simultaneously occur"

5 / 19

Quiz

Q - Find the correct term, a mathematical notation with events A and B, and an example for each of the following descriptions.

"The probability two or more events simultaneously occur"

  • Joint probability
5 / 19

Quiz

Q - Find the correct term, a mathematical notation with events A and B, and an example for each of the following descriptions.

"The probability two or more events simultaneously occur"

  • Joint probability

  • P(AB)

5 / 19

Quiz

Q - Find the correct term, a mathematical notation with events A and B, and an example for each of the following descriptions.

"The probability two or more events simultaneously occur"

  • Joint probability

  • P(AB)

  • The probability that a randomly selected student in STA199 favors dogs and their favorite movie genre is drama.

5 / 19

Quiz

Q - Find the correct term, a mathematical notation with events A and B, and an example for each of the following descriptions.

"The probability an event occurs given the other has occurred"

6 / 19

Quiz

Q - Find the correct term, a mathematical notation with events A and B, and an example for each of the following descriptions.

"The probability an event occurs given the other has occurred"

  • Conditional probability
6 / 19

Quiz

Q - Find the correct term, a mathematical notation with events A and B, and an example for each of the following descriptions.

"The probability an event occurs given the other has occurred"

  • Conditional probability

  • P(A|B)=P(AB)P(B) or P(B|A)

6 / 19

Quiz

Q - Find the correct term, a mathematical notation with events A and B, and an example for each of the following descriptions.

"The probability an event occurs given the other has occurred"

  • Conditional probability

  • P(A|B)=P(AB)P(B) or P(B|A)

  • The probability that a randomly selected student in STA199 favors dogs given their favorite movie genre is drama.

6 / 19

Quiz

Q - Find the correct term, a mathematical notation with events A and B, and an example for each of the following descriptions.

"The probability an event occurs given the other has occurred"

  • Conditional probability

  • P(A|B)=P(AB)P(B) or P(B|A)

  • The probability that a randomly selected student in STA199 favors dogs given their favorite movie genre is drama.

  • A given B restricts our attention to B from the whole sample space Ω.

6 / 19

Quiz

Q - What is the multiplicative rule of probability?

7 / 19

Quiz

Q - What is the multiplicative rule of probability?

P(AB)=P(A|B)P(B)

Comes directly from definition of conditional probability.

7 / 19

Quiz

Q - What is the multiplicative rule of probability?

P(AB)=P(A|B)P(B)

Comes directly from definition of conditional probability.

Q - What is the law of total probability?

7 / 19

Quiz

Q - What is the multiplicative rule of probability?

P(AB)=P(A|B)P(B)

Comes directly from definition of conditional probability.

Q - What is the law of total probability?

P(A)=P(A|B)P(B)+P(A|Bc)P(Bc)=P(AB)+P(ABc)

Let's verify it with a Venn Diagram!

7 / 19

Quiz

Q - What are the independent events?

8 / 19

Quiz

Q - What are the independent events?

  • Knowing one event has occurred does not lead to any change in the probability we assign to another event.
8 / 19

Quiz

Q - What are the independent events?

  • Knowing one event has occurred does not lead to any change in the probability we assign to another event.

  • P(A|B)=P(A) or P(B|A)=P(B)

  • P(AB)=P(A)P(B) if A and B are independent.

8 / 19

Quiz

Q - What are the independent events?

  • Knowing one event has occurred does not lead to any change in the probability we assign to another event.

  • P(A|B)=P(A) or P(B|A)=P(B)

  • P(AB)=P(A)P(B) if A and B are independent.

  • P(animal|movie) = P(animal)

  • Knowing one's movie taste tells us nothing about his/her preference of dogs over cats.

8 / 19

Quiz

Q - Are two disjoint events with positive marginal probability independent?

9 / 19

Quiz

Q - Are two disjoint events with positive marginal probability independent?

No

P(A)P(B)>0 while P(AB)=0 and thus P(AB)P(A)P(B).

9 / 19

Q - Are dying and abstaining from coffee independent events?

Let A be the event that a man died and B be the event that a man was a non-coffee drinker.

Did not die Died
Does not drink coffee 5438 1039
Drinks coffee occasionally 25369 4440
Drinks coffee regularly 24934 3601
10 / 19

Q - Are dying and abstaining from coffee independent events?

Let A be the event that a man died and B be the event that a man was a non-coffee drinker.

Did not die Died
Does not drink coffee 5438 1039
Drinks coffee occasionally 25369 4440
Drinks coffee regularly 24934 3601
  • P(A)=9080/64821
  • P(B)=6477/64821
  • P(AB)=1039/64821
10 / 19

Q - Are dying and abstaining from coffee independent events?

Let A be the event that a man died and B be the event that a man was a non-coffee drinker.

Did not die Died
Does not drink coffee 5438 1039
Drinks coffee occasionally 25369 4440
Drinks coffee regularly 24934 3601
  • P(A)=9080/64821
  • P(B)=6477/64821
  • P(AB)=1039/64821
  • P(A)P(B)=0.014P(AB)=0.016
10 / 19

Q - Are dying and abstaining from coffee independent events?

Let A be the event that a man died and B be the event that a man was a non-coffee drinker.

Did not die Died
Does not drink coffee 5438 1039
Drinks coffee occasionally 25369 4440
Drinks coffee regularly 24934 3601
  • P(A)=9080/64821
  • P(B)=6477/64821
  • P(AB)=1039/64821
  • P(A)P(B)=0.014P(AB)=0.016 They are independent!
10 / 19

Quiz

Q - What is the probability that a man was a non-coffee drinker given he died?

  • P(A)=9080/64821
  • P(B)=6477/64821
  • P(AB)=1039/64821
11 / 19

Quiz

Q - What is the probability that a man was a non-coffee drinker given he died?

  • P(A)=9080/64821
  • P(B)=6477/64821
  • P(AB)=1039/64821

P(B|A)=P(BA)/P(A)=1039/9080=0.114

11 / 19

Quiz

Q - What is the probability that a man died given he was a non-coffee drinker?

  • P(A)=9080/64821
  • P(B)=6477/64821
  • P(AB)=1039/64821
12 / 19

Quiz

Q - What is the probability that a man died given he was a non-coffee drinker?

  • P(A)=9080/64821
  • P(B)=6477/64821
  • P(AB)=1039/64821

P(A|B)=P(AB)/P(B)=1039/6477=0.160

12 / 19

Quiz

Q - P(A|B) and P(B|A) are not the same. Are they related in some way?

13 / 19

Quiz

Q - P(A|B) and P(B|A) are not the same. Are they related in some way?

Yes - According to Bayes' theorem,

P(A|B)=P(B|A)P(A)P(B). If we know marginal probabilities and one conditional probability, we can always compute the other conditional probability!

This can be viewed as updating prior belief P(A) to posterior belief P(A|B) after seeing new information B.

13 / 19

Quiz

Q - Let's recompute P(A|B) using Bayes' theorem.

  • P(A)=9080/64821
  • P(B)=6477/64821
  • P(B|A)=1039/9080
14 / 19

Quiz

Q - Let's recompute P(A|B) using Bayes' theorem.

  • P(A)=9080/64821
  • P(B)=6477/64821
  • P(B|A)=1039/9080

P(A|B)=P(B|A)P(A)P(B)=1039/9080×9080/648216477/64821=10396477=0.160

14 / 19

Quiz

Q - What is Simpson's paradox?

15 / 19

Quiz

Q - What is Simpson's paradox?

The effect where the inclusion of a third variable in the analysis can change the apparent relationship between the other two variables

15 / 19

Quiz

Q - What is Simpson's paradox?

The effect where the inclusion of a third variable in the analysis can change the apparent relationship between the other two variables

Q - Explain Simpson's paradox in UC Berkeley admission data in mathematical expressions.

15 / 19

Quiz

Q - What is Simpson's paradox?

The effect where the inclusion of a third variable in the analysis can change the apparent relationship between the other two variables

Q - Explain Simpson's paradox in UC Berkeley admission data in mathematical expressions.

Overall, P(Admit|Female) < P(Admit|Male)

However, P(Admit|Dept, Female) P(Admit|Dept, Male) or even P(Admit|Dept, Female) > P(Admit|Dept, Male)

15 / 19

Quiz

Q - The effect of the function group_by() applies to all the subsequent operations. What function do we need to undo grouping?

16 / 19

Quiz

Q - The effect of the function group_by() applies to all the subsequent operations. What function do we need to undo grouping?

  • ungroup()

  • summarize() also peels off one layer of grouping by default; if there were multiple grouping variables, then the dataset would still be grouped even after summarize.

16 / 19

Questions?

17 / 19

Let's Practice Together!

Go to AE 11: Conditional Probability

18 / 19

Bulletin

19 / 19

Material

🎥 Watch Conditional Probability

🎥 Watch Simpson's Paradox

2 / 19
Paused

Help

Keyboard shortcuts

, , Pg Up, k Go to previous slide
, , Pg Dn, Space, j Go to next slide
Home Go to first slide
End Go to last slide
Number + Return Go to specific slide
b / m / f Toggle blackout / mirrored / fullscreen mode
c Clone slideshow
p Toggle presenter mode
t Restart the presentation timer
?, h Toggle this help
Esc Back to slideshow