540 likes | 553 Views
Explore the concept of conditional probability and independence using the scenario of drawing objects from a magical hat.
E N D
Three draws from a magic hat. • Note: Draws are without replacement • Space of possible ‘3 draws’ from the hat:
Three draws from a magic hat. • What is the chance that • we get an on the 2nd draw, • if we got a on the 1st draw?
Three draws from a magic hat. p p p p p P(*I*|R**)=1/2 p
Three draws from a magic hat. • What is the chance that • we get an on the 1st draw, • if we got a on the 2nd draw?
Three draws from a magic hat. p p p p p P(I**|*R*)=1/2 p
Counting formula.Under the uniform distribution: P(A|B)= #(AB)/#(B)
Frequency interpretation • In a long sequence of trials, among those which belong to B, the proportion of those that also belong to A should be about P(A|B).
Three draws from a magic hat. Let’s make 3 draws from the magic hat many times: #(AB)/#B = 4/7¼ 1/2
Conditional probability in general: Let A and B be two events in a general probability space. The conditional probability ofAgivenB is denoted by P(A | B). It is given by: P(A | B) = P(AÅB) / P(B)
Example: Rich & Famous Example: Rich & Famous In a certain town 10% of the inhabitants are rich, 5% are famous and 3% are rich and famous. Neither If a town’s person is chosen at random and she is rich what is the probability she is famous? Famous Rich
Example: Rich & Famous Example: Rich & Famous In a certain town 10% of the inhabitants are rich, 5% are famous and 3% are rich and famous. Neither • P(R) = 0.1 • P(R & F) = 0.03 • P(F | R) = =0.03/0.1 • = 0.3 Famous Rich
Example: Relative areas • A point is picked uniformly at random from the big rectangle whose area is 1. • Suppose that we are told that the point is in B, what is the chance that it is in A? A B
Example: Relative areas AB B • In other words: Given that the point is in B, what is the conditional probability that it is in A? ) ( Area A B = 1/2 ( ) Area
Multiplication Rule • For all events A and B such that P(B) 0: • P(AB)=P(B)P(A|B)
Box then ball 1 5 2 4 3 • Consider the following experiment: • we first pick one of the two boxes; • , • and next we pick a ball from the boxed that we picked. • What’s the chance of getting a 2?
Tree diagrams 1 5 2 4 3 1 5 2 4 3 P(Box 1) = 1/2 P(Box 2) = 1/2 P(4 | Box 2) =1/2 P(2 | Box 2) = 1/2 1/3 1/3 1/3 1/4 1/4 1/6 1/6 1/6 P(2) = P(2 Å Box2) = P(Box2) P(2|Box2) = ½*1/2 = 1/4
Consider the Partition B1 B4 Bn B3 B2 Bn-1 B1t B2t … t Bn = W A AB1t AB2t … t ABn = A P(AB1)+P(AB2)+…+P(ABn) = P(A)
Rule of Average Conditional Probabilities If B1,…,Bn is a disjoint Partition of then • P(A)= P(AB1) + P(AB2) +…+ P(ABn) • = P(A|B1)P(B1) + P(A|B2)P(B2)+…+P(A|Bn)P(Bn)
Box then ball 1 5 2 4 3 • We make the following experiment: • we first pick one of the two boxes; • , • and next we pick a ball from the boxed that we picked. • What’s the probability getting a number smaller • than 3.5?
Independence • When the probability for A is unaffected by the occurrence of B we say that A and B are independent. • In other words, A and B are independent if • P(A|B)=P(A|Bc) = p Note that if A and B are independent then: P(A) = P(A|B)P(B) + P(A|Bc)P(Bc) = p P(B) + p P(Bc) = p
Independence • Obvious: If A is independent of B then A is also independent of Bc • Question: If A is independent of B, is B independent of A?
Independence Consider a ball picked uniformly: 1 1 2 1 1 2 Then Color=Red/Green and Number=1 or 2 are Independent: P(Red|#=1)=1/2=P(Red|#=2); P(Green|#=1)=1/2=P(Green|#=2);
Independence 1 1 2 1 1 2 Also: P(#=2|Green)=1/3=P(#=2|Red); P(#=1|Green)=2/3=P(#=1|Red).
Independence Consider a ball picked uniformly: 1 2 2 1 1 2 Then Color and Number are not independent: P(#=2|Green)=1/3 ¹ P(#=2|Red)=2/3;
Independence • Points from a figure have coordinates X and Y. • If a point is picked at uniformly from a rectangle then • the events {X > a} and {Y > b} are • independent! X Y
Independence • P(X>a & Y>b) = P(X>a) P(Y>b) = (1-a)(1-b) Y 1 ¾ ½ X 0 0 ½ ¾ 1
Independence • Points from a figure have coordinates X and Y. • If a point is picked uniformly from a cat shape then • {X > a} and {Y > b} are • not independent! (at least for some a & b) Y X
Independence • Points from a figure have coordinates X and Y. • Are the events {X > a} and {Y>b} independent if a point is picked uniformly at random from a disc? X Y
Dependence 2 2 P(X> )= B/p =P(X> ) Y 2 B 2 B 1 Area = p X 0 2 0 1 2
Dependence 2 2 P(X > & Y> ) = 0 ¹ B2/p2 Y 2 So the events Are not independent for a = b = B 2 B 1 X 0 2 0 1 2
Independence • Follow up question: Are there values of a and b for which the event {X > a} and {X > b} are independent? X Y
Recall: Multiplication Rule P(AB)=P(A|B)P(B) =P(A) P(B) This holds even if A and B are independent !
Picking a Box then a Ball • If a ball is drawn from a randomly picked box comes out to be red, which box would you guess it came from and what is the chance that you are right?
Box then Ball 1/3 1/3 1/3 2/3 1/3 1/2 1/2 3/4 1/4
By the Rule of Average Conditional Probability P(R Ball) = P(R Ball | W Box) P(W Box) + P(R Ball| Y Box) P(Y Box) + P(R Ball | B Box) P(B Box) = ½ * 1/3 + 2/3*1/3 + ¾*1/3 = 23/36
P( , ) ) P( | = 1/3*1/2 = 23/36 P( ) P( , ) ) P( | = 1/3*2/3 = 23/36 P( ) P( , ) ) P( | = 1/3*3/4 = 23/36 P( )
Picking a Box then a Ball • If a ball is drawn from a randomly picked box comes out to be red, which box would you guess it came from and what is the chance that you are right? • A: Guess -> last box. Chances you are right: 9/23.
Bayes’ Rule • For a partition B1, …, Bn of all possible outcomes,
Sequence of Events • Multiplication rule for 3 Events • P(ABC) = P(AB)P(C|AB) = P(A) P(B|A) P(C|AB) Ac Bc Cc P(A) P(B|A) P(C|AB) C B A
Multiplication rule for n Events • P(A1 A2 … An) = P(A1 … An-1)P(An|A1 … An-1) • = P(A1) P(A2|A1) P(A3|A1 A2)… P(An| A1 … An-1) A1c A2c Anc P(A1) P(A2|A1) P(An| A1 … An-1) A1 A2… An
SheshBesh Backgammon • We roll two dice. What is the chance that we will roll out Shesh Besh: for the first time on the n’th roll?
SheshBesh Backgammon • This is a Geometric Distribution • with parameter p=1/36.
The Geometric distribution • In Geom(p) distribution the probability of outcome n is given by • p (1-p)n-1
The Birthday Problem • n students in the class, what is the chance that at least two of them have the same birthday? • P(at least 2 have same birthday) = • 1 – P(No coinciding birthdays). • We arrange the students’ birthdays in some order: • B1, B2,…, Bn. • We need: • P(B2Ï {B1} & B3Ï {B1,B2} & … & BnÏ {B1,…,Bn-1}).
Use multiplication rule to find • P(B2Ï {B1} & B3Ï {B1,B2} & … & BnÏ {B1,…,Bn-1}). B2=B1 B32 {B1,B2} Bn2{B1, … Bn-1} … B2Ï{B1} B3Ï{B1,B2} BnÏ{B1, … Bn-1}
The Birthday Problem • P(at least 2 have same birthday) = • 1 – P(No coinciding birthdays) = This is hard to compute for large n. So we can use an approximation.
The Birthday Problem • log(P(No coinciding birthdays))=