2.4. Conditional Probability - Michigan State University · PDF fileSTT 351 Conditional...

13
STT 351 Conditional Probability. Independence 2.4 -2.5 1 2.4. Conditional Probability Example 2.4.1. (#46 p.80 textbook) Suppose an individual is randomly selected from the population of all adult males living in the United States. Let A be the event that the selected individual is over 6 ft in height, and let B be the event that the selected individual is a professional basketball player. Which do you think is larger, 6 , the individual being more than feet tall knowing that the individual is a professional basketball pl P ayer or the probability of the individual being a professional basketball player, P knowing that the individual is more than 6 feet tall Answer with reasoning. Let A be that the individual is more than 6 feet tall. Let B be that the individual is a professional basketball player. P(A|B) = the probability of the individual being more than 6 feet tall, knowing that the individual is a professional basketball player. P(B|A) = the probability of the individual being a professional basketball player, knowing that the individual is more than 6 feet tall. Because most professional basketball players are tall, so the probability of an individual in that reduced sample space being more than 6 feet tall is very large. On the other hand, the number of individuals that are pro basketball players is small in relation to the number of males more than 6 feet tall P(A|B) P(B|A) Example 2.4.2. What the probability that when rolling a die the side 6 will be on the top if it is known that occurred an even number? Answer. 1 3 Objectives. Definition of conditional probability and multiplication rule Total probability Bayes’ Theorem

Transcript of 2.4. Conditional Probability - Michigan State University · PDF fileSTT 351 Conditional...

Page 1: 2.4. Conditional Probability - Michigan State University · PDF fileSTT 351 Conditional Probability. ... first ace and second ace 52 51 13 17 221 1 ... receive 4.0 in the statistics

STT 351 Conditional Probability. Independence 2.4 -2.5

1

2.4. Conditional Probability

Example 2.4.1. (#46 p.80 textbook)

Suppose an individual is randomly selected from the population of all adult males

living in the United States. Let A be the event that the selected individual is over

6 ft in height, and let B be the event that the selected individual is a professional

basketball player. Which do you think is larger,

6 ,

the individual being more than feet tall knowing

that the individual is a professional basketball plP

ayer

or

the probability of the individual being a professional basketball player, P

knowing that the individual is more than 6 feet tall

Answer with reasoning.

• Let A be that the individual is more than 6 feet tall.

• Let B be that the individual is a professional basketball player.

• P(A|B) = the probability of the individual being more than 6 feet tall,

knowing that the individual is a professional basketball player.

• P(B|A) = the probability of the individual being a professional basketball

player, knowing that the individual is more than 6 feet tall.

Because most professional basketball players are tall, so the probability of an

individual in that reduced sample space being more than 6 feet tall is very large.

On the other hand, the number of individuals that are pro basketball players is

small in relation to the number of males more than 6 feet tall

P(A|B) P(B|A)

Example 2.4.2.

What the probability that when rolling a die the side 6 will be on the top if it is

known that occurred an even number?

Answer. 1

3

Objectives.

• Definition of conditional probability and multiplication rule

• Total probability

• Bayes’ Theorem

Page 2: 2.4. Conditional Probability - Michigan State University · PDF fileSTT 351 Conditional Probability. ... first ace and second ace 52 51 13 17 221 1 ... receive 4.0 in the statistics

STT 351 Conditional Probability. Independence 2.4 -2.5

2

Example 2.4.4.

The population of a particular country consists of three ethnic groups.

Each individual belongs to one of the four major blood groups.

The accompanying joint probability table gives the proportions of individuals in

the various ethnic group–blood group combinations.

P C R and P C

Suppose that an individual is randomly selected from the population, and define

events ,A type A selected B type B selected , and

3C ethnic group selected

a) Calculate ,P A P C and P A C

b) Calculate both P A C and P C A and explain in context what each

P C R and P C probability represents.

Definition of Conditional Probability 2.4.3.

Conditional probability of an even A is the probability of A computed with

information that another event B occurred.

Notation: P A B

Formal definition.

For any two events , 0,A and B P B the conditional probability of A given

that B has occurred is defined by

P A BP A B

P B

Page 3: 2.4. Conditional Probability - Michigan State University · PDF fileSTT 351 Conditional Probability. ... first ace and second ace 52 51 13 17 221 1 ... receive 4.0 in the statistics

STT 351 Conditional Probability. Independence 2.4 -2.5

3

Solution.

0.106 0.141 0.200 0.447P A ;

0.215 0.200 0.065 0.020 0.500P C

0.200P A C

0.200

type selected given ethnic group 3 0.400

00.50

P A C A ;

0.200

ethnic group 3 given type 0.44 selected0

7.447

P C A A

2.4.6. Multiplication Rule.

Example 2.4.7.

Two cards are drawing one after one from a deck of 52 cards.

What is the probability that both cards will be aces?

Solution.

I is an ace II is an ace

4 3 1 1first ace and second ace

52 51 13 1 2217

1P

4 aces

48 others

2.4.5. Remark about Contingency Table.

In the problem given data is organized in so-called contingency table.

The contingency table is the method of organizing data for qualitative variables

as a table in which every cell represents one of the categories of a two-

directional classification.

In the example above sample consists of elements that have two features

(specified blood type and specified ethnic group). The table contains

proportions of elements that have different combinations of two variables,

blood type and ethnic group. For example, the number 0.082 (first column, first

row) is the proportion in the sample of people with blood type O and classified

as the ethnic group 1.

Page 4: 2.4. Conditional Probability - Michigan State University · PDF fileSTT 351 Conditional Probability. ... first ace and second ace 52 51 13 17 221 1 ... receive 4.0 in the statistics

STT 351 Conditional Probability. Independence 2.4 -2.5

4

2.4.8. The Law of Total Probability.

Consider a system 1, ... , kA A -

mutually exclusive and exhaustive events.

This means that mutually exclusive events

1, ... , kA A make partition of the sample space :

1 2 ... ,

, , , 1,

n i jA A A A A

for any i and j i j i j k

The probability of any other event B (related to the same sample space) can by found

by so-called the Formula for Total Probability

1 1

1

k k

k

i i

i

P B P A P B A P A P B A

P A P B A

2.4.9. Idea of Proof .

If in a sample space is present a system of mutually exclusive and

exhaustive events (hypotheses), then any event B connected with this experiment

will take place only together with one of the hypotheses.

So, “find the probability of the event B” means “find the probability of the union

of mutually exclusive events

Page 5: 2.4. Conditional Probability - Michigan State University · PDF fileSTT 351 Conditional Probability. ... first ace and second ace 52 51 13 17 221 1 ... receive 4.0 in the statistics

STT 351 Conditional Probability. Independence 2.4 -2.5

5

2.4.10. Probability Tree Diagram.

When applying the Formula for Total Probability, it is very helpful to construct so-

called Probability Tree Diagram.

In a Probability Tree Diagram:

• first set of branches (arrows) presents mutually exclusive events 1, ... , kA A

(often called “hypotheses”).

• from the end of each branch (arrow) in first set we draw second level of

branches (arrows) in correspondence with options {B given that occurred}iA

• along each arrow is written corresponding probability.

• number of branches at each level can be arbitrary, but the sum of all

probabilities at each level that go from the same node is always equal to 1.

Example.2.4.11.

Consider taking two balls, one after one, from the box that contains 2 blue balls and

3 red balls. Construct the probability tree for this experiment.

Probabilities of

hypotheses

, 1,2iP A i

First draw

Second draw

Conditional probabilities

i iP B A and P B A

with each hypothesis

Example of computing.

Pretend the event of interest B is

{the ball in the second draw is blue}.

1 1 2 2P B P A P B A P A P B A

2 1 3 2

5 4 5

7

204P B

Hint. We were doing multiplication along

branches that have blue ball at the end.

Page 6: 2.4. Conditional Probability - Michigan State University · PDF fileSTT 351 Conditional Probability. ... first ace and second ace 52 51 13 17 221 1 ... receive 4.0 in the statistics

STT 351 Conditional Probability. Independence 2.4 -2.5

6

Example 2.4.12.

40% of the students enrolled in a business statistics course had previously taken a

finite math course.

30 % of these students received 4.0 grade for the statistics course, whereas 20% of

other students received 4.0 grade for the statistics course.

a) Draw a tree diagram and label it with all appropriate probabilities.

b) What is the probability that a student selected at random

receive 4.0 in the statistics course?

To find the probability of the

event {student recieved 4 points}B ,

we need choose sequences of

arrows that end up with 4.0,

multiply probability along each

composite branch and add all such

products.

{student recieved 4.0}

0.4 0.3 0.6 0.2 0.24

P

Page 7: 2.4. Conditional Probability - Michigan State University · PDF fileSTT 351 Conditional Probability. ... first ace and second ace 52 51 13 17 221 1 ... receive 4.0 in the statistics

STT 351 Conditional Probability. Independence 2.4 -2.5

7

2.4.16. Bayes’ Theorem.

Example 2.4.18. (Example 2.31 p.79 textbook, modified).

Incidence of a rare disease. Only 1 in 100 adults is afflicted with a rare disease for

which a diagnostic test has been developed. The test is such that when an

individual actually has the disease, a positive result will occur 99% of the time,

whereas an individual without the disease will show a positive test result only

0.4% of the time. If a randomly selected individual is tested and the result is

positive, what is the probability that the individual has the disease?

The Formulation of Bayes’ Theorem.

Let be mutually exclusive and exhaustive events with prior

probabilities

Then for any other event

,

2.4.17. Idea of Proof.

Given, that the event B occurred, we don’t need any more to consider the entire

sample space. You will deal only with its part B.

To find jP A B for any jA , we need to count only outcomes that are common

for jA and B and divide this number by number of outcomes in B.

Page 8: 2.4. Conditional Probability - Michigan State University · PDF fileSTT 351 Conditional Probability. ... first ace and second ace 52 51 13 17 221 1 ... receive 4.0 in the statistics

STT 351 Conditional Probability. Independence 2.4 -2.5

8

Solution.

For solving the problem, we will use the Bayes’ formula.

1) Make a Probability Tree Diagram.

2) In the denominator of Bayes’ formula must be written test is positiveP ,

computed by Total Probability Formula.

test is positive 0.01 0.99 0.99 0.004 0.01386P

3) In the numerator of Bayes’ formula, we have to put the product that

corresponds with branch “Disease – Positive”. 0.01 0.99 0.0099

4) Finally,

0.0099

has disease given, test positive0.01

0 1386

.7 43P

Page 9: 2.4. Conditional Probability - Michigan State University · PDF fileSTT 351 Conditional Probability. ... first ace and second ace 52 51 13 17 221 1 ... receive 4.0 in the statistics

STT 351 Conditional Probability. Independence 2.4 -2.5

9

2.5. Independence.

Example2.5.2.

You toss a coin and it comes up “H” two times. What is the probability that the

next toss will also be a "H"?

Answer. 1

2

Example 2.5.3.

Are two mutually exclusive events independent or no? Answer. No

Example 2.5.4.

Consider throwing two fair dice, red and green. Are the following events

independent or dependent? Give reasons for your answers.

1) A = {the sum is 4} and B = {Both dice show the same number}

2) A = {the sum is 6} and B = {The red die shows an even}

Objectives.

• Definition of independence of two events

• Multiplication rule of probability of intersection of two events

• Independence of more than two events

2.5.1. Definition of Independence of Two Random Events.

Two events A and B are called independent if and only if

P A B P A P B

It can be easy shown that for independent events A and B

,P A B P A P A B P A

Independence of two events in the probability theory means that the chances of

occurrence of one even do not change when the info about occurrence of another

event is provided.

Page 10: 2.4. Conditional Probability - Michigan State University · PDF fileSTT 351 Conditional Probability. ... first ace and second ace 52 51 13 17 221 1 ... receive 4.0 in the statistics

STT 351 Conditional Probability. Independence 2.4 -2.5

10

Solution.

1) {sum is 4}={(1,3), (2,2), (3,1)}A 3

the sum is 436

1

12P

1 1

the sum is 4 dice show the same1

6 12 6P

Conditional probability ≠ Unconditional probability

A and B are dependent events

2)

{sum is 6}={(5,1), (4, 2), (3, 3), (2, 4), (1, 5)}

36P

5

A

A

3

36

1

12P A B

Conditional probability ≠ Unconditional probability

A and B are dependent events

Page 11: 2.4. Conditional Probability - Michigan State University · PDF fileSTT 351 Conditional Probability. ... first ace and second ace 52 51 13 17 221 1 ... receive 4.0 in the statistics

STT 351 Conditional Probability. Independence 2.4 -2.5

11

Example 2.5.5.

An ice cream company wishes to use red dye to enhance the color in its strawberry

ice cream. The Food and Drug Administration (FDA) requires the dye to be tested

for cancer-producing potential in a laboratory using laboratory rats. The results of

one test on 1,000 rats are summarized in the following table:

a) Convert the table into the proportions table by dividing each entry by 1,000.

b) What is the probability that a rat develops cancer, given that this rat ate red

dye? 60

500

30.12

25P C R

c) Are “developing cancer” and “eating dye” independent events?

0.06 0.02 0.08P C , P C R P C events are not independent

d) Should the FDA approve or ban the use of the dye?

Explain why or why not using 0.12 0.08P C R P C .

FDA should ban the use of Red Dye because eating this substance increases

Probability of developing cancer.

Developed

Cancer

C

No

Cancer

C

Totals

Ate Red Dye R 60 440 500

Did Not Eat Red Dye R 20 480 500

Totals 80 920 1,000

Developed

Cancer

C

No

Cancer

C

Totals

Ate Red Dye R 0.06 0.44 0.5

Did Not Eat Red Dye R 0.02 0.48 0.5

Totals 0.08 0.92 1

Page 12: 2.4. Conditional Probability - Michigan State University · PDF fileSTT 351 Conditional Probability. ... first ace and second ace 52 51 13 17 221 1 ... receive 4.0 in the statistics

STT 351 Conditional Probability. Independence 2.4 -2.5

12

2.5.6. An Important Application of Bayes’ Formula (for reading).

Computing the probability that a message containing a given word is spam.

Let's suppose the suspected message contains the word "replica". Most people who

are used to receiving e-mail know that this message is likely to be spam, a proposal

to buy counterfeit copies of well-known brands of watches. The spam detection

software, however, does not "know" such facts; all it can do is to compute

probabilities.

The formula used by the software to determine that, is derived from Bayes'

theorem

P S P W S

P S WP S P W S P H P W H

where:

• P S W is the probability that a message is a spam, knowing that the word

"replica" is in it;

• P S is the overall probability that any given message is spam;

• P W S is the probability that the word "replica" appears in spam messages;

• P H is the overall probability that any given message is not spam (is

"ham");

• P W H is the probability that the word "replica" appears in ham messages.

The spamicity of a word.

Recent statistic shows that the current probability of any message being spam is

80%. Thus,

0.8; 0.2P S P H

However, most Bayesian spam detection software makes the assumption that there

is no a priori reason for any incoming message to be spam rather than ham, and

considers both cases to have equal probabilities of 50%:

0.5; 0.5P S P H

Page 13: 2.4. Conditional Probability - Michigan State University · PDF fileSTT 351 Conditional Probability. ... first ace and second ace 52 51 13 17 221 1 ... receive 4.0 in the statistics

STT 351 Conditional Probability. Independence 2.4 -2.5

13

The filters that use this hypothesis are said to be "not biased", meaning that they

have no prejudice regarding the incoming email.

This assumption permits simplifying the general formula to:

P W S

P S WP W S P W H

This is functionally equivalent to asking, "what percentage of occurrences of the

word "replica" appear in spam messages?"

The quantity

P W S

P S WP W S P W H

is called "spamicity" (or "spaminess") of the word "replica", and can be computed.

The number P W S used in this formula is approximated to the frequency of

messages containing "replica" in the messages identified as spam during the

learning phase. Similarly, P W H is approximated to the frequency of messages

containing "replica" in the messages identified as ham during the learning phase.

For these approximations to make sense, the set of learned messages needs to be

big and representative enough. It is also advisable that the learned set of messages

conforms to the 50% hypothesis about repartition between spam and ham, i.e. that

the datasets of spam and ham are of same size.

Of course, determining whether a message is spam or ham based only on the

presence of the word "replica" is error-prone, which is why Bayesian spam

software tries to consider several words and combine their spamicities to determine

a message's overall probability of being spam.