Unit 02 - Conditional Probability - 1 Per Page (1)

download Unit 02 - Conditional Probability - 1 Per Page (1)

of 37

Transcript of Unit 02 - Conditional Probability - 1 Per Page (1)

  • 8/9/2019 Unit 02 - Conditional Probability - 1 Per Page (1)

    1/37

    1

    Stat S110

    Unit 2: Conditional ProbabilityChapter 2 in the text

  • 8/9/2019 Unit 02 - Conditional Probability - 1 Per Page (1)

    2/37

    2

    Unit 2 Outline

    Conditional Probability Definition

    Bayes Rule

    Independence

    The Gamblers Ruin

    Conditionally Paradoxical

  • 8/9/2019 Unit 02 - Conditional Probability - 1 Per Page (1)

    3/37

    3

    Why is conditional probability important? Conditional probability always us to update a probability

    statement given other information that is related. Suppose you have plans to attend the Red Sox game (or a

    picnic, an outdoor concert, etc) tonight, and you are tryingto determine whether it will rain later in the day.

    Before any information is gathered, you may put a probability on the event that is will rain: P ( R).

    However, you may look at the window and see that it is verycloudy. You certainly would want to update the probability

    of rain given this information: P ( R | C ). You may gather more information throughout the day, so

    your conditional probability may change: P ( R | A B C ). By conditioning on known information, we can improve our

    probability predictions!

  • 8/9/2019 Unit 02 - Conditional Probability - 1 Per Page (1)

    4/37

    4

    Definition: Conditional Probability conditional probabil ity : the probability of one event occurring

    under the condition that we know the outcome of another event Let A and B be two events in a sample space, with P ( B) > 0. The

    conditional probability of event A, given that B has occurred,written P ( A|B ), is:

    P ( A|B ) is read as probability of A, given B has happened, or probability of A if B is true.

    P ( A) ignoring B is often called the prior probability, and P ( A|B ) is often called the posterior probabilityincorporating knowledge/information of event B.

    Weve essentially been using conditional probability

    already (sampling without replacement).

    )()and()|( B P

    B A P B A P

  • 8/9/2019 Unit 02 - Conditional Probability - 1 Per Page (1)

    5/37

    5

    Conditional probability in Pebble World

    We are trying to determine P ( A| B). On the left is the entire sample space. But we do not need

    to incorporate anything in BC to determine P ( A| B). So in the end, we just restrict ourselves to only considering

    the outcomes in B and asking: how much of B does A takeup?

  • 8/9/2019 Unit 02 - Conditional Probability - 1 Per Page (1)

    6/37

    6

    Key Concept

    Conditional probability is probability! So all of the rules/axioms, results, and properties hold. For example:

    And many more

    )|(1)|( E A P E A P C 0)|(,1)|( E P E S P

    )|()|()|()|( E B A P E B P E A P E B A P

    )|()|and()|(

    E B P E B A P E B A P

  • 8/9/2019 Unit 02 - Conditional Probability - 1 Per Page (1)

    7/37

    A: the first ball drawn is blackB : the second ball drawn is black

    Simplest Example

    21

    6/46/2

    )()(

    )()B(

    )|( Black is Ball First P

    Black are Balls Both P

    A P

    A P A B P

    First Ball

    Second Ball

    There is a bag with 3 balls in it: 1 is red, and 2 are black

    You draw two balls out of the bag, one at a time (withoutreplacement). What is the probability the second ball is

    black given the first ball is black? Define the events:

    What is the probability the 1 st ball was black given the2nd is black?

  • 8/9/2019 Unit 02 - Conditional Probability - 1 Per Page (1)

    8/378

    Very tricky

    The Monty Hall ProblemThere are prizes behind 3 doors: two are worthless (anant farm) and one is expensive (like a new car)You are asked to choose one of the 3 doorsThen, Monty Hall (from Lets Make a Deal) opens oneof the other 2 doors and shows you a worthless prize

    Should you switch doors?

    NYTimes take:http://www.nytimes.com/2008/04/08/science/08monty.html

  • 8/9/2019 Unit 02 - Conditional Probability - 1 Per Page (1)

    9/379

    A general multiplication rule

    (from conditional probability) Suppose A and B are two events in a sample space (not

    necessarily independent). Then P ( A B) = P ( B | A ) P ( A) = P ( A) P ( B | A ) P ( A B C ) = P ( A) P ( B | A ) P (C | A B) In fact, for general A1,, An:

    P ( A1 An)=P ( A1) P ( A2|A1) P ( A3|A1 A2) P ( An|An-1 A1)

    The first relationship is a simple algebraic rearrangement of thedefinition of conditional probability:

    )()and(

    )|( A P

    A B P A B P

  • 8/9/2019 Unit 02 - Conditional Probability - 1 Per Page (1)

    10/3710

    A Personable ExampleIt is known that approximately 20% of men and 3% of women are tallerthan 6 feet in the US .

    Let F = the event that someone is female and T = taller than 6 feet .

    a) What is P( T | F )? What is P( T | F C)?

    b) What is the probability that the next person walking through the dooris a woman and 6 feet tall?

    c) What is the probability that the next person walking through the dooris 6 feet tall?

  • 8/9/2019 Unit 02 - Conditional Probability - 1 Per Page (1)

    11/37

    11

    Example (cont.)c) What is the probability that the next person walking through the

    door is 6 feet tall?

    Two ways for this to happen: (T and F) or (T and F c) [Think Venn Diagrams]

    )()()( C F T P F T P T P )()|()()|( C C F P F T P F P F T P

    115.050.020.050.003.0

  • 8/9/2019 Unit 02 - Conditional Probability - 1 Per Page (1)

    12/37

    2-way tables can help organize your thinking

    Tall (6' or more)

    Yes No

    Female

    Yes

    No

    P(F)*P(T | F)

    P(F)*P(not T | F)= (0.5)*(0.97)= 0.485

    P(not F)*P(T | not F)= (0.5)*(0.20)= 0.100

    P(not F)*P(not T | not F)= (0.5)*(0.80)= 0.400

    = (0.5)*(0.03)= 0.015

    P(F T)

  • 8/9/2019 Unit 02 - Conditional Probability - 1 Per Page (1)

    13/37

    13

    Law of Total Probability

    Let A1,, An be a partition of the sample space S (that is,the Ai are disjoint and their union makes up the entire S )with P ( Ai) > 0 for all Ai. Then:

    Illustration of law of total probability:

    n

    i

    ii

    n

    i

    i A P A B P A B P B P

    11

    )()|()()(

  • 8/9/2019 Unit 02 - Conditional Probability - 1 Per Page (1)

    14/37

    14

    Unit 2 Outline

    Conditional Probability

    Bayes Rule

    Independence

    The Gamblers Ruin

    Conditionally Paradoxical

  • 8/9/2019 Unit 02 - Conditional Probability - 1 Per Page (1)

    15/37

    15

    Bayes Rule Bayes rule (formula) provides a way to go from P ( B | A)

    to P ( A | B) (they are in general not equal)

    If A and B are two events whose probabilities arenot 0 or 1, then:

    It is often written using the law of total probability:

    Or:

    )()()|(

    )|( B P A P A B P

    B A P

    )()|()()|(

    )()|()|( C C

    A P A B P A P A B P

    A P A B P B A P

    n

    i

    ii A P A B P

    A P A B P B A P

    1

    111

    )()|(

    )()|()|(

  • 8/9/2019 Unit 02 - Conditional Probability - 1 Per Page (1)

    16/37

    d) What is the probability that a person known to be 6 feet

    tall is a woman?

    130.0100.0015.0

    015.0)(

    )()|(

    T P

    T and F P T F P

    Pretty Simple from the 2x2 table

    130.0)5.0(2.0)5.0(03.0

    )5.0(03.0

    )()|()()|()()|(

    )|( C C F P F T P F P F T P F P F T P

    T F P

    Bayes Rule Directly:

  • 8/9/2019 Unit 02 - Conditional Probability - 1 Per Page (1)

    17/37

    17

    Bayes Rule Example: Random Coin You have one fair coin, and one biased coin which lands

    Heads with probability 3/4. You pick one of the coins atrandom and flip it three times. It lands Heads all threetimes. Given this information, what is the probabilitythat the coin you picked is the fair one?

    So what?

    23.0)2/1()4/3()2/1()2/1(

    )2/1()2/1(

    )()|()()|()()|(

    )|(

    33

    3

    C C F P F A P F P F A P

    F P F A P A F P

  • 8/9/2019 Unit 02 - Conditional Probability - 1 Per Page (1)

    18/37

    18

    Random Coin Continued

    Suppose that we have now seen our chosen coin landHeads three times. If we toss the coin a fourth time, whatis the probability that it will land Heads once more?

    69.0)77.0)(4/3(23.0)2/1(

    )|(),|()|(),|()|( A F P A F H P A F P A F H P A H P C C

  • 8/9/2019 Unit 02 - Conditional Probability - 1 Per Page (1)

    19/37

    19

    Unit 2 Outline

    Conditional Probability Definition

    Bayes Rule

    Independence

    The Gamblers Ruin

    Conditionally Paradoxical

  • 8/9/2019 Unit 02 - Conditional Probability - 1 Per Page (1)

    20/37

    20

    Independent events

    Two events A and B are independent if and only if knowingthat one event occurs does not change the probability that theother event occurs. What does that mean for the conditional

    probabilities?

    The following are equivalent definitions of independence:

    Note: it takes care to draw independence in a Venn Diagram

    )()|( A P B A P

    )()()( B P A P B A P

    )()|( B P A B P )|()|(

    C

    B A P B A P

  • 8/9/2019 Unit 02 - Conditional Probability - 1 Per Page (1)

    21/37

    21

    An Example

    There is a bag with 3 balls in it: 1 is red, and 2 are black You draw two balls out of the bag, one at a time (without

    replacement). Define the events:A: the first ball drawn is blackB : the second ball drawn is black

    Are A and B independent? How do you know?

  • 8/9/2019 Unit 02 - Conditional Probability - 1 Per Page (1)

    22/37

    22

    Ultrasound is often used to determine the sex of an unborn baby.

    However, because the procedure relies on visual detection ofanatomic differences between male and female babies, the error ratesdiffer according to whether the baby is a boy or a girl.

    P (ultrasound predicts male | baby is male) = 75% P (ultrasound predicts female | baby is female) = 90%

    (a) Consider an individual woman who comes to the clinic for anultrasound to predict her babys sex. What is the probability that theultrasound gives the wrong result?

    (b) Suppose a clinic performs 10 ultrasounds a day, and the ultrasoundresults are independent. What is the probability of one or moreincorrect sex determinations?

    (c) What is the probability that a baby is male, given that the ultrasound predicts a male?

    A practice problem

  • 8/9/2019 Unit 02 - Conditional Probability - 1 Per Page (1)

    23/37

    23

    SolutionLet B = {baby is a boy}, BC = {baby is a girl}

    A = {ultrasound predicts boy}, AC = {ultrasound predicts girl}

    (a)

    (b)

    (c)

    175.0)50.0(25.0)50.0(10.0

    )()|()()|()()()(

    B P B A P B P B A P Band A P Band A P result Wrong P

    C C C

    C C

    854.0146.01)825.0(1

    )s predictioncorrect10(1)s predictionwrong0(1)s predictionwrongare10of out1leastat(

    10

    P P P

    882.0425.0/375.0)]50.0(10.0)50.0(75.0/[)]50.0(75.0[

    )]()|()()|(/[)()|(

    )]()(/[)()(/)(

    )|()|(

    C C

    C

    B P B A P B P B A P B P B A P

    Aand B P Aand B P Aand B P A P Aand B P

    A B P boy predictsultrasound boy P

  • 8/9/2019 Unit 02 - Conditional Probability - 1 Per Page (1)

    24/37

    24

    Independence of 3 events

    Three events A, B, and C are independent if and only if all ofthe following hold:

    If the first 3 conditions hold, then we say A, B, and C are

    pairwise independent , but this does not mean that 4 th condition holds. Example: A = first toss is heads, B = secondtoss is heads, C = both tosses have the same result.

    Independence of 4+ events gets unwieldy very quickly

    )()()( B P A P B A P )()()( C P A P C A P )()()( C P B P C B P

    )()()()( C P B P A P C B A P

  • 8/9/2019 Unit 02 - Conditional Probability - 1 Per Page (1)

    25/37

    25

    Conditional Independence

    Two events A and B are condi tionall y i ndependent given E ifand only if:

    Two events can be conditionally independent given E, but notindependent themselves. And vice versa. Its easy to makeeither mistake.

    For example (conditional independence given E vs. given E C ):Suppose there are 2 types of classes: good classes ( G) and badclasses. In a good class, if you work hard ( W ) you are likelyto get an A ( A). In bad classes the professor randomly assignsgrades to students. Then W and A are conditionallyindependent of GC , but not given G.

    )|()|()|( E B P E A P E B A P

  • 8/9/2019 Unit 02 - Conditional Probability - 1 Per Page (1)

    26/37

    26

    Unit 2 Outline

    Conditional Probability Definition

    Bayes Rule

    Independence

    The Gamblers Ruin

    Conditionally Paradoxical

  • 8/9/2019 Unit 02 - Conditional Probability - 1 Per Page (1)

    27/37

    27

    The Gamblers Ruin Suppose there are two gamblers, A and B (B could be the

    house ), and they make a sequence of $1 bets. For each bet,gambler A has probability p of winning, and gambler B has

    probability q = 1 p of winning. Gambler A starts with i dollars and gambler B starts with N i dollars.

    The amount of money that gambler A has can be viewed as arandom walk on the integers 0 through N, with probability p of going to the right in a given step and probability q = 1 p

    of going to the left. Visually:

  • 8/9/2019 Unit 02 - Conditional Probability - 1 Per Page (1)

    28/37

    28

    The Gamblers Ruin

    What is the probability that A walks away with all the money?

    Key: define W = event that A wins all the money, p i = probability that A wins all the money for a value of i,condition on the first step, use LOTP, and reset your starting

    point. Thus:

    q p p p

    qi AW P pi AW P

    qi AW P pi AW P p

    ii

    st st

    i

    11

    )1atstarts|()1atstarts|(

    )round1loses,atstarts|()round1wins,atstarts|(

  • 8/9/2019 Unit 02 - Conditional Probability - 1 Per Page (1)

    29/37

    29

    The Gamblers Ruin

    This is a difference equation , which can be solved based onthe fact that p i will have the form of xi (see Math Review formore details). This can then be reduced to the polynomial:

    px2

    x + q = 0, which has two roots: 1 and q/ p. So unless q = p = , the general solution is:

    Since we know that p0 = 0 and p

    N = 1, we can solve the above

    to find the values of a and b. Specifically:

    q p p p piii

    11

    i

    ii p

    qba p

    1

    N

    p

    qba

    1

    1

  • 8/9/2019 Unit 02 - Conditional Probability - 1 Per Page (1)

    30/37

    30

    The Gamblers Ruin

    What about when p = ? There is only one root, and it is ofthe form:

    And again solving for the boundary condition, we find that

    a = 0 and b = 1/ N . So the probability that A wins when starting with i dollars is:

    How do these two conditions make sense? In what way arethey consistent with each other?

    iii iba p 11

    2/1if /

    2/1if 11

    p N i

    p pq

    pq

    p

    N i

    i

  • 8/9/2019 Unit 02 - Conditional Probability - 1 Per Page (1)

    31/37

    31

    The Gamblers Ruin: Take -Home

    So whats the take home message? Well first lets explore the probability of B winning all the

    money. By symmetry, we just need to change the startingwealth to N i and switch the roles of q and p.

    So for all values of both i and p, it can be shown thatP(A wins) + P(B wins) = 1.

    What does this mean?

    This means the game is guaranteed to end! The game cannever be stuck in neverending oscillation!

  • 8/9/2019 Unit 02 - Conditional Probability - 1 Per Page (1)

    32/37

    32

    Unit 2 Outline

    Conditional Probability Definition

    Bayes Rule

    Independence The Gamblers Ruin

    Conditionally Paradoxical

  • 8/9/2019 Unit 02 - Conditional Probability - 1 Per Page (1)

    33/37

    33

    Prosecutors Fallacy (http://en.wikipedia.org/wiki/Sally_Clark)

    In 1998 Sally Clark was arrested and tried for murder after hertwo sons died shortly after birth (possibly due to suddeninfant death syndrome, or SIDS). During the trial an expertwitness testified that 1/8500 newborns die of SIDS, so the

    probability of two babies in the same fanily dying in a row ofSIDS was (1/8500) 2 1 in 73 million. The expert continuedand said the probability of Clarks innocence was 1 in 73million.

    What are two major problems with this line of reasoning?1) Independence of children dying of SIDS2) Incorrectly interpreting conditional probability (not using

    Bayes rule to flip the conditioning).

  • 8/9/2019 Unit 02 - Conditional Probability - 1 Per Page (1)

    34/37

    34

    Simpsons Paradox

    Two doctors, Dr. Hibbert and Dr. Nick, each perform twotypes of surgeries: heart surgery and band-aid removal, withthe following results:

    What is the overall probability of success for each doctor? What is the probability of success of each surgery type

    separately, for each doctor? Which doctor would you see?

  • 8/9/2019 Unit 02 - Conditional Probability - 1 Per Page (1)

    35/37

    35

    Simpsons Paradox

    For events A, B, and C , we have a Simpsons paradox if:

    but,

    What are events A, B, and C in the Dr. Hibbert v. Dr. Nickexample?

    ),|(),|(

    ),|(),|(C C C

    C

    C B A P C B A P

    C B A P C B A P

    )|()|( C B A P B A P

  • 8/9/2019 Unit 02 - Conditional Probability - 1 Per Page (1)

    36/37

    36

    UC Berkeley 1973 Sex Bias Casehttp://en.wikipedia.org/wiki/Simpson%27s_paradox

    UC Berkeley sued in 1973for sex bias in admissions tograduate schools.

    Women appeared to have

    lower acceptance rates thanmen.

    Key idea: important tocondition on the correct

    events/variables. UCBerkeley was admittingstudents based onSchool/Major, so that should

    be taken into account.

  • 8/9/2019 Unit 02 - Conditional Probability - 1 Per Page (1)

    37/37

    Last Word: The other Simpsons Paradox

    HOMER: Hey, I got a question for you. (pulls out a piece of paper) "CouldJesus microwave a burrito so hot that he himself could not eat it?"

    NED: Well sir, of course, he could, but then again... wow, as melon- scratchers go that's a honey-doodle.