Chapter 2 Probability: Part 3: Probability Introduction Section 2.7 Independence Section 2.8 Bayes' Theorem

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 18

Chapter 2 Probability

Part 3: Probability Introduction

Section 2.7 Independence


Section 2.8 Bayes’ Theorem

1 / 18
Independence
Recall the RANK and SEX variables in the STEM faculty example. In
that case, knowing RANK (i.e. conditioning on it) changed the
probability that a randomly chosen member was female. Or
P (F |rank) 6= P (F ).
What if the extra information you get (like conditioning on RANK)
didn’t change the probability? What if P (A|B) = P (A)?

Example (Independence)
Joleb Inc. is a sales company with 350 employees. The frequency table of
Salary Category (high/low) and Color of car (red/not red) are shown in
the table:
CAR COLOR
red not red total
SALARY low 28 252 280
high 7 63 70
total 35 315 350
2 / 18
Independence

Example (Independence, continued)


Does the chance of being in a Let H be the event of high salary.
70
high salary category depend on P (H) = 350 =0.20
whether or not they person has a
red car?
We know that P (H) = 0.20, but
CAR COLOR what about P (H|R)?
red not red total
SALARY low 28 252 280
high 7 63 70 The probability that the employee
total 35 315 350 has high salary given they have a red
car.
Suppose we randomly choose an
employee.

3 / 18
Independence
Example (Independence, continued)
P (H∩R) 7/350 70
P (H|R) = P (R) = 35/350 =0.20 and P (H) = 350 =0.20
It looks like knowing that the employee has a red car doesn’t change the
chance of them having a high salary. → H and R are independent.

Independent Events P(R)=0.10


(mosaic plot)
1.00!
P(R)=0.90
0.75!
low Complement of R,
0.50! which means ‘not R’.
0.25!
high
0.00! P(H)=0.20
Not Red Red!
P(H|R)=0.20
Regardless of whether a person has a
red car (R) or not (R), thereʼs still a 0.20
probability that they have a high salary. This says they’re
independent. 7

4 / 18
Independence
Example (Independence, continued)
In this special case, events H and R are said to be independent.
Knowledge that the outcome is in event R does not affect the probability
that the outcome is in event H.

Compare the above example to the below example with Dependent


Events B and H:

Dependent Events B: Person has B.S. degree!


H: Person has a high salary
1.00! P(B)=0.30
low
0.75! P(B)=0.70
0.50!
high P(H|B)=0.80
0.25!

0.00! P(H)=0.40
B Not B!
This says they’re
The probability of having a high NOT independent.
salary depends on whether a person P(H|B)≠P(H)
has a B.S. degree (B) or not (B).
9

5 / 18
Independence

For independent events A and B, P (B|A) = P (B).

How does this affect the Multiplication Rule for probability?

For independent events A and B,


P (A ∩ B) = P (B|A) · P (A) (always applicable)
= P (B) · P (A) (because independent)

Definition (Independence (two events))


Two events are independent if any one of the following equivalent
statements is true:
1 P (B|A) = P (B)
2 P (A|B) = P (A)
3 P (A ∩ B) = P (B) · P (A)

6 / 18
Independence

Example (Sequential tosses of a coin are independent)


Let H1 be the event that the first toss is a head.
Let H2 be the event that the second toss is a head.

P (H2 |H1 ) = P (H2 ) Because H1 & H2 are independent events


= 12

What you flipped in the first toss doesn’t affect what you’ll get in the
second, H1 & H2 are independent.

P (H1 ∩ H2 ) = P (H2 |H1 ) · P (H1 )


= P (H2 ) · P (H1 ) Because H1 & H2 are independent
= 21 · 21 = 14

7 / 18
Independence
Example (Series Circuits)
The circuit below will function only if both devices work properly. The
probability that a device functions properly is written on the device in the
graphic.

The chance of a failure in a single device is independent of the other


device (it’s a matter of the integrity of the device itself). Find the
probability that the circuit functions.

Let D1 be the event that the 1st device works.


Let D2 be the event that the 2nd device works.

ANS:

8 / 18
Independence
Example (Parallel Circuits)
For the circuit below to function, only one of the two devices must work
properly. The devices fail independently. The probability that a device
functions properly is written on the device in the graphic.

Let T be the event that the top device works.


Let B be the event that the bottom device works.

What is the probability that the circuit functions?

We want to find P (T ∪ B).

9 / 18
Independence
Example (Parallel Circuits, continued)

ANS:
P (circuit functions) = P (top or bottom or both works) = P (T ∪ B)

P (T ∪ B) = 1 − P [(T ∪ B)0 ] {utilize the complement}


= 1 − P (neither works)
= 1 − P (T 0 ∩ B 0 )
= 1 − (0.05)(0.05) = 1 − (0.05)2 = 0.9975

This can also be seen by the addition rule:


P (T ∪ B) = P (T ) + P (B) − P (T ∩ B)
= 0.95 + 0.95 − (0.95)(0.95) = 0.9975
10 / 18
Independence

Example (Three independent radars)


Three radar sets, operating independently, are set to detect any aircraft
flying through a certain area. Each set has a probability of 0.02 of failing
to detect a plane. If an aircraft enters the area, what is the probability
that it goes undetected?

(a) (0.02)3

(b) 1 − (0.98)3

(c) (0.98)3

(d) 1 − (0.02)3

{Also, what detection scenario goes with each probability above...}

11 / 18
Independence

Definition (Independence (multiple events))


The events E1 , E2 , . . . , En are independent if and only if for any subset of
these events

P (Ei1 ∩ Ei2 ∩ Ei3 ∩ · · · ∩ Eik ) = P (Ei1 ) × P (Ei2 ) × · · · P (Eik ).

The knowledge that the events are independent usually comes from a
fundamental understanding of the random experiment.

12 / 18
Bayes’ Theorem

Definition (From the definitions of Conditional Probability and the


Multiplication Rule, we can write)
P (A∩B)
P (A|B) = P (B) for P (B) > 0

P (B|A)·P (A)
= P (B) for P (B) > 0

This is a useful result that lets us compute P (A|B) in terms of P (B|A).

13 / 18
Bayes’ Theorem
Definition (Bayes’ Theorem)
If we rewrite the denominator in the previous result using the Total
Probability Rule and the partition S = A ∪ A0 , we have Bayes’ Theorem...

P (B|A)·P (A)
P (A|B) = P (B) for P (B) > 0

P (B|A)·P (A)
= P (B|A)P (A)+P (B|A0 )P (A0 )

And this can be extended to any set of k mutually exclusive events


E1 , E2 , . . . , Ek such that E1 ∪ E2 ∪ . . . ∪ Ek = S.

P (B|E1 )·P (E1 )


P (E1 |B) = P (B) for P (B) > 0

P (B|E1 )·P (E1 )


= P (B|E1 )P (E1 )+P (B|E2 )P (E2 )+...+P (B|Ek )P (Ek )

NOTICE: The numerator always equals one of the terms in the sum in the denominator. 14 / 18
Bayes’ Theorem
Example (spam filtering, calculating P (A|B) utilizing P (B|A))
Suppose we’re trying to decide if an email with the word “free” in the
subject line is a spam email.

Let S be the event that an email is spam.


Let F be the event that an email subject contains the word “free”.

Suppose we have the following facts:


Of all email traffic worldwide prior to filtering, 48% is spam. Or
P (S) = 0.48, a marginal (or unconditional) probability.
Based on data, in the set of all spam mail, “free” occurs in the subject
line 1% of the time. Or P (F |S) = 0.01, a conditional probability.
Based on data, in the set of all non-spam mail, “free” occurs in the
subject line in 1 out of 1,000 emails. Or P (F |S 0 ) = 0.001, a
conditional probability.
15 / 18
Bayes’ Theorem
Example (spam filtering, calculating P (A|B) utilizing P (B|A))
If an email subject line contains the word “free”, we can calculate the
probability that it is spam as:

P (F |S)P (S) (0.01)·(0.48)


P (S|F ) = P (F |S)P (S)+P (F |S 0 )P (S 0 ) = (0.01)·(0.48)+(0.001)·(0.52)

= 0.9023

Because the subject line contains “free”, the probability that the email is
spam is 0.90. Without any information about a subject line, the
probability that a randomly chosen email is spam is 0.48.
——————————————————————————————–
Every year I send out an email to departments with the following subject:
Free Statistical Consulting Services
available for spring 2018
I may have to rethink that...
16 / 18
Bayes’ Theorem
Example (spam filtering, calculating P (A|B) utilizing P (B|A))
Mosaic Plot

NotFree
Free Spam NotSpam

17 / 18
Bayes’ Theorem
Example (American Lung Association)
According to the Arizona Chapter of the American Lung Association, 7.0%
of the population has lung disease. Of those having lung disease, 90% are
smokers; of those not having lung disease, 25.3% are smokers.

Determine the probability that a randomly selected smoker has lung


disease.

ANS:

18 / 18

You might also like