Conditional Probability - simulation

Conditional Probability
P(A| B) = Probability of A, given B
P(A| B) =
P  A and B 
P  B
Democratic Party Cumulative Report — Unofficial
Tarrant County — Primary Election — May 29, 2012
Preference for Presidential Nominee
Candidate
Darcy G. Richardson
Barack Obama
Bob Ely
John Wolfe
Absentee
Total
Early
Election
Total
28
1753
18
32
231
11905
109
237
331
15396
166
331
590
29054
293
600
1831
12482
16224
30537
Event A = "voted for John Wolf"
Event B = "voted early"
Given that a person did "Early" voting, what is the probability the person voted for John Wolfe?
12, 482
P( B)  P  person did "Early" voting  
 0.40875
30,537
237
P( A and B) = P  person did early voting and voted for John Wolf  
 0.00776
30,537
P(A|B) = P(voted for John Wolfe | person did "Early" voting)
=
=
P  person did early voting and voted for John Wolf 
P  person did "Early" voting 
0.00776
 0.01898
0.40875
Democratic Party Cumulative Report — Unofficial
Tarrant County — Primary Election — May 29, 2012
Preference for Presidential Nominee
Candidate
Darcy G. Richardson
Barack Obama
Bob Ely
John Wolfe
Absentee Early
Election
Total
28
231
331
590
1753
11905
15396
29054
18
109
166
293
32
237
331
600
Total
1831
12482
16224
30537
Let event A = "voted for Barack Obama"
Let event B = "voted on election day"
Given that a person voted on election day, what is the probability the person voted for Barack Obama?
16, 224
P( B)  P  person voted on election day  
 0.53129
30,537
15,396
P( A and B)  P  person voted on election day and voted for Barack Obama  
 0.50417
30,537
P(A|B) = P(voted for Barack Obama | person voted on election day)
=
=
P  person voted on election day and voted for Barack Obama 
P  person voted on election day 
0.50417
 0.94895
0.53129
Independent Events and Conditional Probability
P(A| B) =
P  A and B 
P  B
P(A| B) P  B  =
P  A and B 
P  B
P  B
P(A| B) P  B  = P  A and B 
P  A and B  =P(A| B) P  B 
If A and B are independent events, then the occurence of B does not affect the probability of A.
In other words, knowing the occurence of B does not affect the P(A).
Hence, if events A and B are independent, then P(A|B) = P(A)
P  A and B  = P(A| B) P  B   P(A)  P  B 
if A and B are independent events.