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

Gambler's fallacy wikipedia , lookup

Transcript
MA305
Conditional Probability
Bayes’ Theorem
By: Prof. Nutan Patel
Asst. Professor in Mathematics
IT-NU
A-203
patelnutan.wordpress.com
MA305 Mathematics for ICE
1
Conditional Probability
• Definition: If A and B are two events associated with the same sample
space of a random experiment, the conditional probability of the
event A given that B has occurred, i.e. P (A|B) is given by
P A  B 
P( A | B) 
, P( B)  0
P B 
Properties:
1. P(U | A)  1  P( A | A)
2. P( A  B)  P( A) P( B | A)  P( B) P( A | B), General multiplication rule.
3. For Independent Events, P( A | B)  P( A) and P( B | A)  P( B).
MA305 Mathematics for ICE
2
General Multiplication Rule
If A and B are any events in S, then
P(AB) =P(A)P(B|A), if P(A) ≠ 0
=P(B)P(A|B), if P(B) ≠ 0.
Ex- Two cards are drawn at random from an ordinary deck of 52 playing cards.
What is the probability of getting two aces if
(a) The first card is replaced before the second card is drawn;
(b) The first card is not replaced before the second card is drawn?
Ans: Let event A be first card is ace and B be second card is ace.
(a) Since there are four aces among the 52 playing cards,
4 4
1
we get P(AB)= . = .
(b)
52 52 169
4 3
1
P(AB) =P(A)P(B|A)= . = .
52 51 221
MA305 Mathematics for ICE
3
Ex-2. The supervisor of a group of 20 workers wants to get the opinion
of 2 of them (to be selected random) about certain new safety
regulations. If 12 of them favour the new regulations and the other 8
are against it, what is the probability that both of the workers chosen
by the supervisor will be against safety regulations?
Ans- the probability that the first worker selected will be against the
8
new safety regulations is P(A)= , and the probability that the second
20
worker selected will be against the new safety regulations given that
7
the first one is against them is P(B|A)= .
19
Thus, the desired probability is
8
7 14
P(AB)=P(A)P(B|A)= x = .
20 19 95
MA305 Mathematics for ICE
4
Ex-3. Among 60 automobile repair parts loaded on a truck in Bombay, 45 are
destined for Vadodara and 15 for Ahmedabad. If two of parts are unloaded
in Surat by mistake and the “selection” is random, what are the probabilities
that
(a) Both parts should have gone to Vadodara;
(b) Both parts should have gone to Ahmedabad;
(c) One should have gone to Vadodara and one to Ahmedabad.
Ans- (a)
45 44 33
x =
60 59 59
(c)
=0.5593
(b)
15 14
x
60 59
=
7
118
= 0.059322
33 7
1-( + )=0.381
59 118
or
45 15
= x
60 59
+
15 45
x =
60 59
0.381
MA305 Mathematics for ICE
5
Ex-4. With reference to Figure, find
(a) P(A|B)
(b) P(B|C’)
(c) P(AB|C)
(d) P(BC|A’)
(e) P(A|BC)
(f) P(A|BC)
(g) P(ABC|BC)
(h) P(ABC|BC)
Ans: (a) 0.25
(d) 0.78
(g) 0.267
(b) 0.417
(e) 0.4
(h) 0.062
U
A
B
0.24
0.06
0.19
0.04
0.16
0.11
0.09
0.11
C
(c) 0.1
(f) 0.267
MA305 Mathematics for ICE
6
• Rule of total probability
Example: Suppose that an assembly plant receives its voltage regulators from
three different suppliers, 60% from supplier B1, 30% from supplier B2, and 10 %
from supplier B3. If 95% of the voltage regulators from B1, 80% of those from B2,
and 65% of those from B3 perform according to specifications, what is the
probability that any one voltage regulator received by the plant will perform
according to specifications.
Ans: If A denotes the event that a voltage regulator received by the plant performs
according to specifications, and B1, B2 and B3 are the events that it comes from
respective suppliers,
We can write
A = A(B1  B2  B3 )
= (A B1)(A B2)(A B3)
and P(A) = P((A B1)(A B2)(A B3))
= P(A B1)+P(A B2)+P(A B3) (as B1  B2  B3 =)
= P(B1)P(A| B1)+P(B2)P(A| B2)+P(B3)P(A| B3)
= (0.60)(0.95)+(0.30)(0.80)+(0.10)(0.65)
= 0.875
MA305 Mathematics for ICE
7
Rule of total probability
If B1, B2, … , Bn are mutually exclusive events of which one must occur, then
P(A)= 𝑛𝑖=0 𝑃 Bi 𝑃(𝐴|Bi )
Ex: (continue)
Suppose we want to know the probability that a particular voltage regulator
perform according to specifications, came from supplier B3.
i.e. P(B3|A)
𝑃(𝐴∩𝐵3 )
P(B3)P(A| B3)
We write 𝑃 𝐵3 𝐴 =
= 3
𝑃(𝐴)
𝑖=0 P(Bi)P(A| Bi)
𝑃 𝐵3 𝐴 =
P(B3)P(A| B3)
P(B1)P(A| B1)+P(B2)P(A| B2)+P(B3)P(A| B3)
(0.10)(0.65)
=
=0.074.
0.875
Note that the probability that a voltage regulator is supplied by B3 decreases from 0.10 to
0.074 once it is known that it perform according to specifications.
MA305 Mathematics for ICE
8
Bayes’ Theorem
If B1, B2, … , Bn are mutually exclusive events of which one must occur,
then
P(Bm)P(A| Bm)
𝑃 𝐵𝑚 𝐴 = 𝑛
, for m=1, 2, … , n.
𝑖=0 P(Bi)P(A| Bi)
Bayes’ theorem provides a formula for finding the probability that the
“effect” A was “caused” by event Bm.
MA305 Mathematics for ICE
9
B1
P(B2)
• By Tree Diagram
B2
B3
Total Probability: P(A)=
Bayes’ Theorem:
𝑛
𝑖=0 𝑃
𝑃 𝐵3 𝐴 =
P(A| B1)
P(A| B2)
P(A| B3)
A
A
A
Bi 𝑃(𝐴|Bi ) = P(B1)P(A| B1)+P(B2)P(A| B2)+P(B3)P(A| B3)
P(B3)P(A| B3)
P(B1)P(A| B1)+P(B2)P(A| B2)+P(B3)P(A| B3)
MA305 Mathematics for ICE
10
Example: A Manufacturer buys an item from three subcontractors, X, Y ans Z.
X has the better quality control, only 2% of its item are defective. X furnishes
the manufacturer with 50% of items. Y furnishes 30% of the items, and 5% of
its items are defective. Z furnishes 20% of the items, and 6% of its items are
defective. The manufacturer finds an item defective
i. What is the probability that it came from X?
ii. What is the probability that it came from Y?
iii. What is the probability that it came from Z?
Ans: P(A)=0.037
i. P(X|A)= 0.2703
ii. P(Y|A)=0.4054
iii. P(Z|A)=0.3243
MA305 Mathematics for ICE
11
Example: A consulting firm rents cars from three agencies, 20% from agency D, 20%
from agency E, and 60% from agency F. if 10% of the cars from D, 12% of the cars
from E, and 4% of the cars from F have bad tires, what is the probability that the
firm will get a car with bad tires?
i. What is the probability that bad tires came from D?
ii. What is the probability that bad tires came from E?
iii. What is the probability that bad tires from F?
Ans: 0.0684
i. 0.2923
ii. 0.3508
iii. 0.3508
MA305 Mathematics for ICE
12
• A Company manufactures integrated circuits on silicon chips at three
different plants X, Y, and Z. out of every 1000 chips produced, 400
come from X, 350 come from Y, and 250 come from Z. it has been
estimates that of the 400 from X 10 are defective, wheres five of
those from Y are defective, and only two of those from Z are
defective. Determine the probability that a defective chip came from
plant Y.
• Ans: 0.324
MA305 Mathematics for ICE
13