1.10 Bayes' Theorem
1.10 Bayes' Theorem
1.10 Bayes' Theorem
10
Bayes’ Theorem
One of the most useful theorems in probability is Bayes’ Theorem, named after
Thomas Bayes who outlined the result in his 1763 paper, An Essay towards solving
a Problem in the Doctrine of Chances. Bayes’ Theorem is useful in evaluating a
certain kind of ”inverse” probability. For two events A and B, if we know P(B|A),
the theorem enables us to compute conditional probabilities ”in the other direction”–
that is, we can deduce P(A|B) from P(B|A). Recall from Module 1.8 that we have
derived two formulas for P(A ∩ B):
P(A ∩ B) = P(A|B)P(B)
P(A ∩ B) = P(B|A)P(A)
where P(A) > 0 and P(B) > 0. Equating the right-hand side expressions together
and solving for P(A|B), we get
P(B|A)P(A)
P(A|B) = .
P(B)
We can generalize this result to partitioned sample spaces:
P(B|Aj )P(Aj )
P(Aj |B) = n ,
X
P(B|Ai )P(Ai )
i=1
for any 1 ≤ j ≤ n.
Proof. From the definition of conditional probability,
P(Aj ∩ B) P(B|Aj )P(Aj )
P(Aj |B) = = .
P(B) P(B)
By the Law of Total Probability, we can express the denominator P(B) as
Xn
P(B|Ai )P(Ai ), and the result follows.
i=1
1
Aj after the occurrence of B.
Note that, for any event A of S, A and Ac both nonempty, the set {A, Ac } is a
partition of S. Thus, by Bayes’ Theorem, if P(A) > 0 and P(Ac ) > 0, then for any
event B of S with P(B) > 0,
P(B|A)P(A)
P(A|B) = .
P(B|A)P(A) + P(B|Ac )P(Ac )
Similarly,
P(B|Ac )P(Ac )
P(Ac |B) = .
P(B|A)P(A) + P(B|Ac )P(Ac )
These are the simplest forms of Bayes’ Theorem. They are used whenever the
quantities P(B|A), P(B|Ac ), and P(A) are given or can be calculated. The typical
situation is that B happens logically or temporarily after A, so that the probabilities
P(A) and P(B|A) can be readily computed. Bayes’ Theorem is applicable when
we know the probability of the more recent event, given that the earlier event has
occurred, P(B|A), and we wish to calculate the probability of the earlier event, given
that the most recent event has occurred, P(A|B). In practice, Bayes’ Theorem is
used when we know the effect of a cause and we wish to make some inference about
the cause.
Example 2. A biased coin, twice as likely to come up heads as tails, is tossed once.
If it shows heads, a chip is drawn from urn I, which contains three blue chips and
four red chips; if it shows tails, a chip is drawn from urn II, which contains six blue
chips and three red chips. Given that a blue chip was drawn, what is the probability
that the coin came up tails?
Example 3. Suppose a new strain of coronavirus affects one person in 1000. If a
person does have the virus, in 92% of the cases the rapid diagnostic test will show
that he or she actually has it. If a person does not have the virus, the diagnostic test
in one out of 5000 cases gives a false positive result (i.e., the test says the person has
the virus, when, in fact, he/she does not). Determine the probability that a person
has the virus, given that he or she tested positive.
Example 4. A company ships products from three different warehouses (A, B, and
C ). Based on customer complaints, it appears that 3% of the shipments coming
from A are somehow faulty, as are 5% of the shipments coming from B, and 2%
coming from C . Suppose a customer is mailed an order and calls in a complaint
the next day. What is the probability the item came from Warehouse C ? Assume
that Warehouses A, B, and C ship 30%, 20%, and 50% of the company’s sales,
respectively.
2
Let HicoincameupheadsciechipcamefromurnI
TicoincameuptailscieichipcamefromurnlI
B bluechipisdrawn
PfTlB7
RH 2pct l
PCHHIPCT
21pct tlPf 1
311717 1
PCT RCH 2g
IPCBH.tt
qlPfBlTl
g6lPfTB lPlBlTllPCT1PCBlT7lPCT
tlP BIHIRCH
t
YET
xx
Let V personhasthe virus
Pi personhas a positivetestresult
t.PH P
999
BIV Foo Mvc 1000
PV o 92
p IVY ooo
PCPIV RN
P VIP PCPN RN t PfPNC lPCV9
0927 Foo
4565 28216
to 92K t food 91
There is an 82.16 chancethat apersontestedpositivedoeshave
thevirus
Let A productisshippedfromWarehouseA
Bi productisshippedfromWarehouseB
CiproductisshippedfromWarehouseC
F producthadfaultyshipment
Fciproductis ingoodcondition
Note htt 13,41s apartitionofs
11944
RCA 0.30 PIHA 003
PCB o 20 PHI131 005
IPCC 0.50 lP FIC O 02
PCHC IPCC
IPKF PCHA CA t PCHB PCB t PCHARK
CO 02 0 50