Download Conditional Probability and Bayes` Theorem.

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
Conditional Probability
and Independent Events
Conditional Probability
• if we have some information about the
result…use it to adjust the probability
• likelihood an event E occurs under the
condition that some event F occurs
• notation: P(E | F )
"the probability of E, given F ".
• called a “conditional probability”
Given They’re Male
• If an individual is selected at random, what is the
probability a sedan owner is selected, given that
the owner is male?
• P( sedan owner | male ) = _______?
Smaller Sample Space
• Given the owner is male reduces the total
possible outcomes to 115.
n  sedan  male 
P( sedan | male) 
n(male)
In general...
• In terms of the probabilities, we define
P( A  B)
P( A | B) 
P( B)
sedan mini-van truck totals
male
female
.16
.24
.40
.10
.22
.32
.20
.08
.28
• P( sedan owner | male ) = _______?
.46
.54
1.00
Compute the probability
sedan mini-van truck totals
male
female
.16
.24
.40
.10
.22
.32
.20
.08
.28
.46
.54
1.00
P(van  female)
P(van | female) 
?
P( female)
P( female  van)
P( female | van) 
?
P(van)
Compare
• NOT conditional:
P( truck ) =
• Are Conditional:
P( truck | male ) =
Dependent Events?
• probability of owning a truck…
• ...was affected by the knowledge the owner is
male
• events "owns a truck" and "owner is male" are
called dependent events.
Independent Events
• Two events E and F , are called
independent if
or simply
the probability of E is unaffected by event F
Roll the Dice
• Using the elements of the sample space:
(1,1) (1,2) (1,3) (1,4) (1,5) (1,6)
(2,1) (2,2) (2,3) (2,4) (2,5) (2,6)
(3,1) (3,2) (3,3) (3,4) (3,5) (3,6)
(4,1) (4,2) (4,3) (4,4) (4,5) (4,6)
(5,1) (5,2) (5,3) (5,4) (5,5) (5,6)
(6,1) (6,2) (6,3) (6,4) (6,5) (6,6)
• Compute the conditional probability:
P( sum = 6 | a “4 was rolled” ) = ?
• are the events “sum = 6" and
“a 4 was rolled" independent events?
“Affected”
• The events are NOT independent
• the given condition does have an effect.
• That is,
P(sum = 6 | 4 is rolled ) = 2/11 = 0.1818
but
P(sum = 6) = 5/36 = 0.1389
• These are dependent events.
Not Independent
• These are dependent events.
• As a result,
P(sum = 6 and a 4 was rolled)
does not equal
P(sum = 6)P(a 4 was rolled) ?
2
 0.0555
36
 5   11 
     0.0424
 36   36 
Probability of “A and B”
P( A  B)
P( A | B) 
P( B)
may be written equivalently as
P( A  B)  P( A | B) P( B)
• Draw two cards in succession,
without replacing the first card.
• P(drawing two spades) = ________?
Multiplication Rule
(spade, spade)
P(1st is spade  2nd is spade)
 P(2
nd
st
st
spade |1 spade) P(1 spade)
Compare with “combinations approach”, ( 13C2 )( 52C2 ).
Multiplicative Law for Probability
• For two events A and B,
P( A  B)  P( A | B) P( B)
 P( B | A) P( A)
• But when A and B are independent events,
this identity simplifies to
P( A  B)  P( A) P( B)
Example
• In a factory, 40% of items produced come
from Line 1 and others from Line 2.
• Line 1 has a defect rate of 8%.
Line 2 has a defect rate of 10%.
• For randomly selected item, find probability
the item is not defective.
D: the selected item is defective
(i.e., ~D means not defective)
The Decision Tree
not defective
Line 1
defective
not defective
Line 2
defective
P(~ D)  P(~ D | L1 ) P( L1 )  P(~ D | L2 ) P( L2 )
P(~ D)  (0.92)(0.40)  (0.90)(0.60)  0.908
The Two Lines
• ~D: the selected item is not defective.
S
~D
L1
L2
P(~ D)  P(~ D  L1 )  P(~ D  L2 )
 P(~ D | L1 ) P( L1 )  P(~ D | L2 ) P( L2 )
Total Probability
S
A
B1
For the partition {B1 , B2 ,
B2
…
Bk
, Bk } of the sample space S ,
we may write A  ( A  B1 )  ( A  B2 ) 
and so
P(A)  P( A  B1 )  P( A  B2 ) 
or equivalently,
P(A)  P( A | B1 ) P( B1 )  P( A | B2 ) P( B2 ) 
 ( A  Bk )
 P( A  Bk ).
 P( A | Bk ) P( Bk ).
Total Probability
B1
P(A|B1)P(B1)
A
P(A|B2)P(B2)
A
P(A|B3)P(B3)
A
B2
B3
A
A
A
P(A)
 P( A | B1 ) P( B1 )  P( A | B2 ) P( B2 )  P( A | B3 ) P( B3 ).
Bayes’ Theorem follows…
P( B j | A) 
P( A  B j )
P( A)

P( A | B j ) P( B j )
Since P(A)  P( A | B1 ) P( B1 ) 
P( A)
 P( A | Bk ) P( Bk ),
we also have

P( A | B j ) P( B j )
P( A | B1 ) P( B1 ) 
 P( A | Bk ) P( Bk )
Bayes’
B1
P(A|B1)P(B1)
A
P(A|B2)P(B2)
A
P(A|B3)P(B3)
A
B2
B3
A
A
A
P( A | B2 ) P( B2 )
P( B2 | A) 
P( A | B1 ) P( B1 )  P( A | B2 ) P( B2 )  P( A | B3 ) P( B3 )
Back at the factory…
• For randomly selected item, find probability
it came from Line 1, given the item is not
defective.
P( L1 | W ) =
not defective
Line 1
defective
not defective
Line 2
defective
The 3 Urns
• Three urns contain colored balls.
Urn
1
2
3
Red
3
1
4
White
4
2
3
Blue
1
3
2
• An urn is selected at random and one ball is
randomly selected from the urn.
• Given that the ball is red, what is the
probability it came from urn #2 ?
Related documents