Ch 2C Independent Events & Bayes

Download Report

Transcript Ch 2C Independent Events & Bayes

Probability
Chapter 2
The journey continues…
Independence and all that brings!
The reverend Bayes and his theorem
Chapter 2C
2-6 Independence
Definition (two events)
knowledge that the outcome of an experiment is in event A does
not affect the probability that the outcome is in event B.
Independent
Events


Tossing two dice where A is the outcome from one
die and B the outcome from another die
Repeated tosses of a coin


Sampling with replacement


toss 10 heads in a row – the probability of a head on
the next toss is still .5 (fair coin)
50 items, 10 defective. Probability of a selecting a
defect remains 1/5 for each item selected
Random sampling from an infinite population

The probability of an individual having an IQ greater
than 130 is .025
Two Independent Events
Ninety percent of all life insurance applications are
correctly submitted to the home office.
1.
What is the probability that the next two
applications to be processed by the home office
will be incorrect?
2.
That at least one will be incorrect?
Let Ai = the event, the ith application is incorrectly submitted
Given: P(Ai) = .10 and the Ai are independent
1. Required: P(A1  A2) = P(A1) P(A2) = (.10) (.10) = .01
2. Required: P(A1  A2) = P(A1) + P(A2) - P(A1) P(A2)
= .10 + .10 - (.10) (.10) = .2 - .01= .19
Two Independent Events and
the addition rule
P(A  B) = P(A) + P(B) – P(A  B)
= P(A) + P(B) - P(A) P(B)
If A and B are independent
I would welcome another
example of this important
modification to the addition
rule.
On Target
The probability of hitting a target
with a bow and arrow is 2/3. What
is the probability of hitting the target
with two arrows?
A = event, first arrow hits target
B = event, second arrow hits target
P(A or B) = P(A) + P(B) - P(A and B)
= P(A) + P(B) - P(A) P(B)
= 2/3 + 2/3 – (2/3)(2/3) = 8/9 = .889
Let’s see, the
probability of
hitting the target
with two tries is
2/3 + 2/3 = 4/3?
Example 2-34
2-6 Multiplication rule for
Independent events
Definition (multiple events)
Multiple Independent Events
Five percent of the population suffer from a some form of lung
disease. If ten individuals are to be selected at random to
participate in a breathing endurance experiment, what is the
probability that none of them will have a lung disease?
Let Ai = the event, the ith individual selected does not have a lung
disease.
Given: P(Ai) = .95
Required: P(A1  A2 …  A10)
= P(A1) P(A2) … P(An) = .9510 = .5987
What is the probability at least one of the individuals selected
suffers from a lung disease?
Required: P(Ac1  Ac2 …  Ac10) = 1 - P(A1  A2 …  A10)
= 1 - .5987 = .4013
Problem 2-107
The probability that a lab specimen contains high levels of
contamination is 0.10. Five samples are checked and the
samples are independent.
Let Hi = {the ith sample contains high levels of
contamination}
a) What is the probability that no sample contains high levels
of contamination?
P(H’1 H’2 H’3 H’4 H’5)
= P(H’1)P(H’2)P(H’3)P(H’4)P(H’5)
= (1-0.10)5 = (0.90)5
= 0.59
Problem 2-107 Cont’d
b) What is the probability that exactly one sample
contains high levels of contamination?
A1 = (H1 H’2 H’3 H’4 H’5)
A2 = (H’1 H2 H’3 H’4 H’5)
A3 = (H’1 H’2 H3 H’4 H’5)
A4 = (H1 H’2 H’3 H4 H’5)
A5 = (H1 H’2 H’3 H’4 H5)
P(Ai) = (0.9)4(0.1) = 0.0656
P(A1 A2 A3 A4 A5) = 5 x (0.0656) = 0.328
Problem 2-107 Cont’d
c) What is the probability that at least one sample
contains high levels of contamination?
B = {no sample contains high levels of contamination}
From part a, P(B) = 0.59
P(B’) = 1 – P(B) = 1 – 0.59 = 0.41
A Reliability Problem
All devices are independent, what is the probability the
circuit operates?
0.9
0.9
0.8
0.95
0.95
0.9
A = {upper devices function}
B = {lower devices function}
P(A) = (0.9)(0.9)(0.8) = 0.648
P(B) = (0.95)(0.95)(0.9) = 0.8123
P(A B) = (0.648)(0.8123) = 0.5263
P(A B) = P(A) + P(B) – P(A B)
= 0.934
Testing for Independence
A study of the smoking habits and incidence of lung
cancer in a group of men showed the following
Cancer
No Cancer
totals
results:
Smoker
Nonsmoker
totals
0.03
0.005
0.035
0.72
0.245
0.965
0.75
0.25
Would you conclude that smoking and lung cancer are
independent events?
Let S = the event, a smoker
C = the event, has lung cancer
Given:
P(S  C) = .03, P(S  Cc) = .72, P(Sc  C) = .005, P(Sc  Cc) = .245
P(S) = .75, P(C) = .035
Required: P(S|C) = P(S  C)/ P(C) = .03/.035 = .8571  P(S) = .75
therefore not independent!
Another Test for Independence
P(A) = .06
.752
A
B
P(B) = .20
A = the event, circuit board has failed
B = the event, circuit board experienced excessive vibration
Given: P(A) = .06, P(B) = .20, P(Ac  Bc) = .752
Ye Olde Solution box:
P(Ac  Bc) = P(A  B)c = 1 - P(A  B) = .752
P(A  B) = P(A) + P(B) - P(A  B) = .248
P(A  B) = .06 + .20 - .248 =.012 = (.06)(.20) = P(A) P(B)
Therefore independent events!
Bayes’
Theorem
Experience the joy of computing
conditional probabilities from other
conditional probabilities
Thomas Bayes
Mathematician who first used probability
inductively and established a mathematical
basis for probability inference (a means of
calculating, from the number of times an
event has not occurred, the probability
that it will occur in future trials). He set
down his findings on probability in
"Essay Towards Solving a Problem in
the Doctrine of Chances" (1763), published
posthumously in the Philosophical Transactions
of the Royal Society of London. Bayes'
contributions are immortalized by naming a
fundamental proposition in probability,
called Bayes Rule, after him.
Born: 1702 in London, England
Died: 17 April 1761 in Tunbridge Wells, Kent, England
Bayes Theorem
Sometimes we know one conditional probability,
P(A|B) and would like to know the opposite
conditional probability, P(B|A). We know
P(A B) = P(A|B)P(B) = P(B A) = P(B|A)P(A)
Equating the second and fourth terms,
P(A|B)P(B) = P(B|A)P(A)
P(B|A) = P(A|B)P(B)/P(A), for P(A) > 0
Or
P(A|B) = P(B|A)P(A)/P(B), for P(B) > 0
This is a very useful result and can be generalized.
2-7 Bayes’ Theorem – 2 events
Definition
P( A B)
P( B | A) P( A)
P( A | B) 

P( B)
P( B | A) P( A)  P( B | Ac ) P( Ac )
False Positives on Medical Tests
Suppose a medical test gives a positive result if you have a certain
disease 99% of the time.
Further, that test gives a positive result if you are OK (do not have
disease ) 2% of the time.
The percentage of people in the population having this disease is 1%.
Assume you take the test and get a positive response. What is the
likelihood that you have the disease ?
Let A = the event, have disease and B = the event, test is positive
Given: P(B|A) = .99, P(B|Ac) = .02, P(A) = .01
Required: P(A|B) = ?
.99 .01

P( B | A) P( A)
P( A | B) 

 .333
c
c
P( B | A) P( A)  P( B | A ) P( A ) .99 .01  .02 .99 
False Negatives on Medical Tests
Suppose a certain test gives a positive result if you have a certain
disease 99% of the time.
Further, that test gives a positive result if you are OK (do not have
disease ) 2% of the time.
The percentage of people in the population having this disease is 1%.
Assume you take the test and get a negative response. What is the
likelihood that you do not have the disease ?
Let A = the event, have disease and B = the event, test is positive
Given: P(B|A) = .99, P(B|Ac) = .02, P(A) = .01
Required: P(Ac |Bc ) = ?
P(Bc|A) = .01, P(Bc|Ac) = .98, P(Ac) = .99
.98.99 
P( B c | Ac ) P( Ac )
P( A | B ) 

 .99989694
c
c
c
c
P( B | A ) P( A )  P( B | A) P( A) .98 .99   .01.01
c
c
Bayes Theorem - General
P  Aj | B  
P( B | Aj ) P( Aj )
n
 P( B | A ) P( A )
i 1
P( B  A1 )  P( B| A1 ) P( A1 )
i
;
j  1, 2,..., n
i
P( B  A2 )  P( B| A2 ) P( A2 )
A2
A1
B
A3
P( B  A3 )  P( B| A3 ) P( A3 )
2-7 Bayes’ Theorem
Bayes’ Theorem
Yet Another Bayesian Problem

A company receives parts from three suppliers with
the following data collected over the last several
months.
Supplier
A
B
C

% Supplied
0.15
0.8
0.05
Fractrion defective
0.02
0.01
0.03
If a defective item is found, what is the probability it
came from supplier A? B? C?
Bayes – the tabular way
P ( D | Si ) P ( Si ) P ( Si  D )
P ( Si | D ) 

P ( D)
P ( D)
Supplier
(Si)
A
B
C
Fraction
Supplied
P(Si)
0.15
0.8
0.05
Fraction
defective
P(D|Si)
P(Si  D)
0.02
0.003
0.01
0.008
0.03
0.0015
P(D) = 0.0125
3
3
i 1
i 1
P(Si|D)
0.24
0.64
0.12
P( D)   P( Si  D)   P( D | Si )P( Si )
The Tabular Way - Generalized
Event Ei Probability
(partition) P(Ei)
Conditional
P(B|Ei)
Joint Prob
P(Ei  B)
Conditional: P(Ei|B)
= P(Ei  B) / P(B)
E1
P(E1)
P(B|E1)
P(E1  B)
P(E1|B)
E2
P(E2)
P(B|E2)
P(E2  B)
P(E2|B)
:
:
:
:
:
:
:
:
:
:
En
P(En)
P(B|En)
P(En  B)
P(En|B)
Totals
1.0
n/a
P(B)
1.0
P( B | E j ) 
P( B | E j ) P( E j )
n
 P( B | E ) P( E )
i 1
i
i
; j  1,..., n
Example of the Tabular Way



Five students: Molly, Martha, Mike, Mary, and Mitch have agreed to
take turns attending the ENM 500 distance learning class with Molly
attending 30% of the time, Martha 15%, Mike 20%, Mary 25% and
Mitch 10%. Before each class, a number is drawn random from a bowl
containing the numbers 1 – 100 to determine who will attend that class.
That person then logs into the session as “M.”
Historically, when asked a question by the professor, Molly answers
correctly 90% of the time, Martha 70% of the time, Mike 50% of the
time, Mary 80% of the time, and Mitch 40% of the time.
Given the student known as “M” answered the question correctly, what
is the probability that it was Molly, Martha, Mike, Mary, or Mitch?
Molly reviewing
her midterm exam.
Random Number
1 - 30
31 - 45
46 - 65
66 - 90
91 - 100
student attending class
Molly
Martha
Mike
Mary
Mitch
The Solution using the Tabular Way
Ei = the event, student i attends the class
B = the event, student answers question correctly
Ei events
partition P(Ei)
Molly
Martha
Mike
Mary
Mitch
totals
0.30
0.15
0.20
0.25
0.10
1
Mitch eager
to attend class
P(B|Ei)
0.9
0.7
0.5
0.8
0.4
P(Ei  B) =
P(B|Ei) P(Ei)
0.270
0.105
0.100
0.200
0.040
0.715
P(Ei|B)
0.378
0.147
0.140
0.280
0.056
1
Summary
Truly, a
great
summary.
P( Ac )  1  P( A)
P( A  B)  P( A)  P( B)  P( A  B)
 P( A)  P( B)  P( B | A) P( A)
P( A  B)
P( A | B) 
P( B)
P( A | B)  P( A  B)  0 if mutually exclusive
P( A | B)  P( A) if independent
P( A  B)  P( A) P( B) if independent
Adventures in Discrete
Probability
An eclectic set of probability problems that will
tickle your fancy and enhance your learning
process.
Problem #1

A manufactured part passes inspection 75% of the time. Four
percent of the parts are rejected because of both substandard
material and exceeding tolerances. Ninety percent of the parts
are produced within tolerances. What is the probability a part is
within tolerances but substandard?
Solution box:
Let T = the event, exceeds tolerances
S = the event, substandard
Given: P(T) = .10; P(T  S) = .04; P(T  S)c = .75
Required: P(S  Tc)
since P(Tc) = P[(S  Tc)  (Sc  Tc)] = P(S  Tc) + P(Sc  Tc)
and P(Sc  Tc) = P(T  S)c = .75
.90 = P(S  Tc) + .75 or P(S  Tc) = .90 - .75 = .15
Problem #1 – the Venn diagram
way
Let T = the event, exceeds tolerances
S = the event, substandard
Given: P(T) = .10; P(T  S) = .04; P(T  S)c = .75
Required: P(S  Tc) = .15
.06
.04
.75
T
S
.90
Problem #2

Six laptops computers were turned in to the University
computer center. Two of the laptops were inoperable but
not identified as such. The Engineering Management
Department was given 3 of the 6 laptops. What is the
probability that at least one of the 3 is inoperable?
P(one or more) = 1 – P(0)
 4  2 
  
# Favorable  3  0  (4)(1) 1
P(0) 



total
(20) 5
6
 
3
4
1  P(0)   .8
5
Problem #3 Not Another
Bayesian Problem



Herman awakes in the middle of the night with a headache and
stumbles into the bathroom without turning on the light. In the
dark, he grabs one of 3 bottles containing pills and takes a pill
from the selected bottle. One hour later he is feeling much
worse and recalls that one of the 3 bottles contained birth
control pills and the other two aspirin. Herman quickly consults
his handy medical text and finds that 80 percent of normal
males show his symptoms after taking birth control pills and
only 5 percent have these symptoms after taking aspirin.
Given his symptoms, what is the probability that Herman took a
birth control pill?
Given his symptoms, what is the probability that Herman took
aspirin?
Solving Herman’s Problem with a
probability tree
A = event, aspirin
S = event, symptoms
.05
P(S|A)P(A)=(.05) (2/3)=.0333
symptoms
2/3
Aspirin
no symptoms .95
symptoms
Birth control
pills
P(Sc|A)P(A)=(.95)(2/3)=.6333
.80
P(S|Ac)P(Ac)=(.8)(1/3)=.2667
1/3
no symptoms
.20
P(Sc|Ac)P(Ac)=(.2)(1/3)=.0667
P(Ac|S) = P(Ac  S) / [P(Ac  S) + P(A  S)]
= .2667 / [.2667 + .0333] = .889
1.0000
Problem #4
A used car salesman is able to sell a car, on the average,
once in every 5 customers. If the salesman has 4 customers
on a given day, what is the probability of
(a) no sales?
(b) of exactly one sale?
(c) one or more sales?
(d) 4 sales?
Let Si = the event, a car is sold to the ith customer
Given: P(Si) = .2 and independence
Problem #4 solution
Let Si = the event, a car is sold to the ith customer
Given: P(Si) = .2 and independence
(a) no sales? P(Sc1  Sc2  Sc3  Sc4 )
= P(Sc1) P(Sc2) P(Sc3) P(Sc4) = .84 = .4096
(b) of exactly one sale? P(S1) P(Sc2) P(Sc3) P(Sc4) + P(Sc1)
P(S2) P(Sc3) P(Sc4) + P(Sc1) P(Sc2) P(S3) P(Sc4) + P(Sc1)
P(Sc2) P(Sc3) P(S4) = 4(.2)(.8)3 = .4096
(c) one or more sales? 1 - .4096 = .5904
(d) 4 sales? P(S1  S2  S3  S4 ) = .24 = .0016
More of Problem #4
Exactly two sales? P(S1) P(S2) P(Sc3) P(Sc4) + etc.
= C(4,2) (.2)2 (.8)2 = (6)(.04)(.64) = .1536
Exactly three sales? P(S1) P(S2) P(S3) P(Sc4) + P(S1)
P(S2) P(Sc3) P(S4) + P(S1) P(Sc2) P(S3) P(S4) +
P(Sc1) P(S2) P(S3) P(S4) = 4(.2)3 (.8) = .0256
There must
be a better
way?
Number sales
0
1
2
3
4
total
Probability
0.4096
0.4096
0.1536
0.0256
0.0016
1
Next Week
A Better Way
Doing it with random variables
A Random Variable