58
Probability Probability (Part 2) (Part 2) C h a p t e r 5 5 Contingency Tables Tree Diagrams Bayes’ Theorem Counting Rules McGraw-Hill/Irwin Copyright © 2009 by The McGraw-Hill Companies, Inc.

Probability (Part 2) Chapter55 Contingency Tables Tree Diagrams Bayes’ Theorem Counting Rules McGraw-Hill/Irwin Copyright © 2009 by The McGraw-Hill Companies,

Embed Size (px)

Citation preview

Page 1: Probability (Part 2) Chapter55 Contingency Tables Tree Diagrams Bayes’ Theorem Counting Rules McGraw-Hill/Irwin Copyright © 2009 by The McGraw-Hill Companies,

ProbabilityProbability(Part 2)(Part 2)

Chapter5555

Contingency Tables

Tree Diagrams

Bayes’ Theorem

Counting Rules

McGraw-Hill/Irwin Copyright © 2009 by The McGraw-Hill Companies, Inc.

Page 2: Probability (Part 2) Chapter55 Contingency Tables Tree Diagrams Bayes’ Theorem Counting Rules McGraw-Hill/Irwin Copyright © 2009 by The McGraw-Hill Companies,

5B-2

• A A contingency contingency tabletable is a cross- is a cross-tabulation of tabulation of frequencies frequencies into rows and into rows and columns. columns.

Row 1

Row 2

Row 3

Row 4Var

iabl

e 2

Variable 1Col 1 Col 2 Col 3

CellCell

• A contingency table is like a frequency distribution for two variables.

Contingency TablesContingency TablesContingency TablesContingency Tables

What is a Contingency Table?What is a Contingency Table?

Page 3: Probability (Part 2) Chapter55 Contingency Tables Tree Diagrams Bayes’ Theorem Counting Rules McGraw-Hill/Irwin Copyright © 2009 by The McGraw-Hill Companies,

5B-3

• Consider the following cross-tabulation table for n = 67 top-tier MBA programs: (Table 5.4)

Contingency TablesContingency TablesContingency TablesContingency Tables

Example: Salary Gains and MBA TuitionExample: Salary Gains and MBA Tuition

Page 4: Probability (Part 2) Chapter55 Contingency Tables Tree Diagrams Bayes’ Theorem Counting Rules McGraw-Hill/Irwin Copyright © 2009 by The McGraw-Hill Companies,

5B-4

• Are large salary gains more likely to accrue Are large salary gains more likely to accrue to graduates of high-tuition MBA programs?to graduates of high-tuition MBA programs?

• The frequencies indicate that MBA graduates The frequencies indicate that MBA graduates of high-tuition schools do tend to have large of high-tuition schools do tend to have large salary gains.salary gains.

• Also, most of the top-tier schools charge Also, most of the top-tier schools charge high tuition.high tuition.

• More precise interpretations of this data can More precise interpretations of this data can be made using the concepts of probability.be made using the concepts of probability.

Contingency TablesContingency TablesContingency TablesContingency Tables

Example: Salary Gains and MBA TuitionExample: Salary Gains and MBA Tuition

Page 5: Probability (Part 2) Chapter55 Contingency Tables Tree Diagrams Bayes’ Theorem Counting Rules McGraw-Hill/Irwin Copyright © 2009 by The McGraw-Hill Companies,

5B-5

• The The marginal probabilitymarginal probability of a single event is of a single event is found by dividing a row or column total by found by dividing a row or column total by the total sample size.the total sample size.

• For example, find the marginal probability of For example, find the marginal probability of a medium salary gain (a medium salary gain (PP((SS22)). )).

P(S2) = 33/67 = .4925

• Conclude that about 49% of salary gains at Conclude that about 49% of salary gains at the top-tier schools were between $50,000 the top-tier schools were between $50,000 and $100,000 (medium gain).and $100,000 (medium gain).

Contingency TablesContingency TablesContingency TablesContingency Tables

Marginal ProbabilitiesMarginal Probabilities

Page 6: Probability (Part 2) Chapter55 Contingency Tables Tree Diagrams Bayes’ Theorem Counting Rules McGraw-Hill/Irwin Copyright © 2009 by The McGraw-Hill Companies,

5B-6

• Find the marginal probability of a low tuition Find the marginal probability of a low tuition PP((TT11). ).

P(T1) = 16/67 = .2388

• There is a 24% chance that a top-tier school’s There is a 24% chance that a top-tier school’s MBA tuition is under $40.000.MBA tuition is under $40.000.

Contingency TablesContingency TablesContingency TablesContingency Tables

Marginal ProbabilitiesMarginal Probabilities

Page 7: Probability (Part 2) Chapter55 Contingency Tables Tree Diagrams Bayes’ Theorem Counting Rules McGraw-Hill/Irwin Copyright © 2009 by The McGraw-Hill Companies,

5B-7

• A A joint probabilityjoint probability represents the intersection represents the intersection of of two two events in a cross-tabulation table.events in a cross-tabulation table.

• Consider the joint event that the school has Consider the joint event that the school has low tuition low tuition andand large salary gains large salary gains (denoted as (denoted as PP((TT11 SS33)).)).

Contingency TablesContingency TablesContingency TablesContingency Tables

Joint ProbabilitiesJoint Probabilities

Page 8: Probability (Part 2) Chapter55 Contingency Tables Tree Diagrams Bayes’ Theorem Counting Rules McGraw-Hill/Irwin Copyright © 2009 by The McGraw-Hill Companies,

5B-8

• So, using the cross-tabulation table, So, using the cross-tabulation table,

P(T1 S3) = 1/67 = .0149• There is less than a 2% chance that a top-tier There is less than a 2% chance that a top-tier

school has school has bothboth low tuition low tuition andand large salary large salary gains.gains.

Contingency TablesContingency TablesContingency TablesContingency Tables

Joint ProbabilitiesJoint Probabilities

Page 9: Probability (Part 2) Chapter55 Contingency Tables Tree Diagrams Bayes’ Theorem Counting Rules McGraw-Hill/Irwin Copyright © 2009 by The McGraw-Hill Companies,

5B-9

• Found by Found by restrictingrestricting ourselves to a single ourselves to a single row or column (the row or column (the conditioncondition).).

• For example, knowing that a school’s MBA For example, knowing that a school’s MBA tuition is high (tuition is high (TT33), we would restrict ), we would restrict

ourselves to the third row of the table.ourselves to the third row of the table.

Contingency TablesContingency TablesContingency TablesContingency Tables

Conditional ProbabilitiesConditional Probabilities

Page 10: Probability (Part 2) Chapter55 Contingency Tables Tree Diagrams Bayes’ Theorem Counting Rules McGraw-Hill/Irwin Copyright © 2009 by The McGraw-Hill Companies,

5B-10

• Find the probability that the salary gains are Find the probability that the salary gains are small (small (SS11) ) givengiven that the MBA tuition is large that the MBA tuition is large

((TT33).). P(S1 | T3) = 5/32 = .1563

• What does this mean?What does this mean?

Contingency TablesContingency TablesContingency TablesContingency Tables

Conditional ProbabilitiesConditional Probabilities

Page 11: Probability (Part 2) Chapter55 Contingency Tables Tree Diagrams Bayes’ Theorem Counting Rules McGraw-Hill/Irwin Copyright © 2009 by The McGraw-Hill Companies,

5B-11

• To check for independent events in a To check for independent events in a contingency table, compare the contingency table, compare the conditionalconditional to the to the marginalmarginal probabilities. probabilities.

• For example, if large salary gains (For example, if large salary gains (SS33) were ) were

independentindependent of low tuition ( of low tuition (TT11), then ), then

PP((SS33 | T | T11)) = = PP((SS33).).Conditional Marginal

P(S3 | T1)= 1/16 = .0625 P(S3) = 17/67 = .2537

• What do you conclude about events What do you conclude about events SS33 and and T T11??

Contingency TablesContingency TablesContingency TablesContingency Tables

IndependenceIndependence

Page 12: Probability (Part 2) Chapter55 Contingency Tables Tree Diagrams Bayes’ Theorem Counting Rules McGraw-Hill/Irwin Copyright © 2009 by The McGraw-Hill Companies,

5B-12

• Calculate the Calculate the relative frequenciesrelative frequencies below for below for each cell of the cross-tabulation table to each cell of the cross-tabulation table to facilitate probability calculations.facilitate probability calculations.

Contingency TablesContingency TablesContingency TablesContingency Tables

Relative FrequenciesRelative Frequencies

• Symbolic notation for relative frequencies:Symbolic notation for relative frequencies:

Page 13: Probability (Part 2) Chapter55 Contingency Tables Tree Diagrams Bayes’ Theorem Counting Rules McGraw-Hill/Irwin Copyright © 2009 by The McGraw-Hill Companies,

• Here are the resulting probabilities (relative Here are the resulting probabilities (relative frequencies). For example,frequencies). For example,

Contingency TablesContingency TablesContingency TablesContingency Tables

Relative FrequenciesRelative Frequencies

P(T1 and S1) = 5/67 P(T2 and S2) = 11/67 P(T3 and S3) = 15/67

P(S1) = 17/67 P(T2) = 19/67

5B-13

Page 14: Probability (Part 2) Chapter55 Contingency Tables Tree Diagrams Bayes’ Theorem Counting Rules McGraw-Hill/Irwin Copyright © 2009 by The McGraw-Hill Companies,

Contingency TablesContingency TablesContingency TablesContingency Tables

Relative FrequenciesRelative Frequencies• The nine joint probabilities sum to 1.0000 The nine joint probabilities sum to 1.0000

since these are all the possible intersections.since these are all the possible intersections.

• Summing the across a row or down a Summing the across a row or down a column gives column gives marginal marginal probabilities for the probabilities for the respective row or column.respective row or column.

5B-14

Page 15: Probability (Part 2) Chapter55 Contingency Tables Tree Diagrams Bayes’ Theorem Counting Rules McGraw-Hill/Irwin Copyright © 2009 by The McGraw-Hill Companies,

5B-15

• A small grocery store would like to know if A small grocery store would like to know if the number of items purchased by a customer the number of items purchased by a customer is is independentindependent of the type of payment method of the type of payment method the customer chooses to use.the customer chooses to use.

• Why would this information be useful to the Why would this information be useful to the store manager?store manager?

• The manager collected a random sample of The manager collected a random sample of 368 customer transactions.368 customer transactions.

Contingency TablesContingency TablesContingency TablesContingency Tables

Example: Payment Method and Purchase QuantityExample: Payment Method and Purchase Quantity

Page 16: Probability (Part 2) Chapter55 Contingency Tables Tree Diagrams Bayes’ Theorem Counting Rules McGraw-Hill/Irwin Copyright © 2009 by The McGraw-Hill Companies,

5B-16

Here is the contingency table of frequencies:Here is the contingency table of frequencies:

Contingency TablesContingency TablesContingency TablesContingency Tables

Example: Payment Method and Purchase QuantityExample: Payment Method and Purchase Quantity

Page 17: Probability (Part 2) Chapter55 Contingency Tables Tree Diagrams Bayes’ Theorem Counting Rules McGraw-Hill/Irwin Copyright © 2009 by The McGraw-Hill Companies,

5B-17

• Calculate the marginal probability that a Calculate the marginal probability that a customer will use cash to make the payment.customer will use cash to make the payment.

• Let Let CC be the event cash. be the event cash.

P(C) = 126/368 = .3424

Contingency TablesContingency TablesContingency TablesContingency Tables

Example: Payment Method and Purchase QuantityExample: Payment Method and Purchase Quantity

• Now, is this probability the same if we Now, is this probability the same if we condition on number of items purchased?condition on number of items purchased?

Page 18: Probability (Part 2) Chapter55 Contingency Tables Tree Diagrams Bayes’ Theorem Counting Rules McGraw-Hill/Irwin Copyright © 2009 by The McGraw-Hill Companies,

5B-18

P(C | 1-5) = 30/88 = .3409

P(C | 6-10) = 46/135 = .3407

P(C | 10-20) = 31/89 = .3483

P(C | 20+) = 19/56 = .3393

• PP((CC) = .3424, so what do you conclude about ) = .3424, so what do you conclude about independence?independence?

• Based on this, the manager might decide to Based on this, the manager might decide to offer a cash-only lane that is not restricted to offer a cash-only lane that is not restricted to the number of items purchased.the number of items purchased.

Contingency TablesContingency TablesContingency TablesContingency Tables

Example: Payment Method and Purchase QuantityExample: Payment Method and Purchase Quantity

Page 19: Probability (Part 2) Chapter55 Contingency Tables Tree Diagrams Bayes’ Theorem Counting Rules McGraw-Hill/Irwin Copyright © 2009 by The McGraw-Hill Companies,

5B-19

• Contingency tables require careful Contingency tables require careful organization and are created from raw data.organization and are created from raw data.

• Consider the data

of salary gain and tuition for n = 67 top-tier MBA schools.

Contingency TablesContingency TablesContingency TablesContingency Tables

How Do We Get a Contingency Table?How Do We Get a Contingency Table?

Page 20: Probability (Part 2) Chapter55 Contingency Tables Tree Diagrams Bayes’ Theorem Counting Rules McGraw-Hill/Irwin Copyright © 2009 by The McGraw-Hill Companies,

5B-20

• The data should be coded so that the values The data should be coded so that the values can be placed into the contingency table.can be placed into the contingency table.

Contingency TablesContingency TablesContingency TablesContingency Tables

How Do We Get a Contingency Table?How Do We Get a Contingency Table?

Once coded, tabulate the frequency in each cell of the contingency table using MINITAB’s :

Stat | Tables | Cross Tabulation

Page 21: Probability (Part 2) Chapter55 Contingency Tables Tree Diagrams Bayes’ Theorem Counting Rules McGraw-Hill/Irwin Copyright © 2009 by The McGraw-Hill Companies,

5B-21

• A A tree diagramtree diagram or or decision treedecision tree helps you visualize all helps you visualize all possible outcomes.possible outcomes.

• Start with a contingency table. Start with a contingency table.

Tree DiagramsTree DiagramsTree DiagramsTree Diagrams

What is a Tree?What is a Tree?

• For example, this table gives expense ratios by fund For example, this table gives expense ratios by fund type for 21 bond funds and 23 stock funds.type for 21 bond funds and 23 stock funds.

Page 22: Probability (Part 2) Chapter55 Contingency Tables Tree Diagrams Bayes’ Theorem Counting Rules McGraw-Hill/Irwin Copyright © 2009 by The McGraw-Hill Companies,

• To label the tree, first calculate To label the tree, first calculate conditional conditional probabilitiesprobabilities by dividing each cell frequency by dividing each cell frequency by its column total.by its column total.

• For example, For example, P(L | B) = 11/21 = .5238 • Here is the table of conditional probabilitiesHere is the table of conditional probabilities

Tree DiagramsTree DiagramsTree DiagramsTree Diagrams

What is a Tree?What is a Tree?

5B-22

Page 23: Probability (Part 2) Chapter55 Contingency Tables Tree Diagrams Bayes’ Theorem Counting Rules McGraw-Hill/Irwin Copyright © 2009 by The McGraw-Hill Companies,

5B-23

• To calculate joint probabilities, useTo calculate joint probabilities, use

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

• The joint probability of each terminal event on the The joint probability of each terminal event on the tree can be obtained by multiplying the probabilities tree can be obtained by multiplying the probabilities along its branch.along its branch.

• The tree diagram shows all events along with The tree diagram shows all events along with their marginal, conditional and joint probabilities.their marginal, conditional and joint probabilities.

• For example,For example, P(B L) = P(L | B)P(B)

= (.5238)(.4773) = .2500

Tree DiagramsTree DiagramsTree DiagramsTree Diagrams

What is a Tree?What is a Tree?

Page 24: Probability (Part 2) Chapter55 Contingency Tables Tree Diagrams Bayes’ Theorem Counting Rules McGraw-Hill/Irwin Copyright © 2009 by The McGraw-Hill Companies,

5B-24

Tree DiagramsTree DiagramsTree DiagramsTree Diagrams

Tree Diagram for Fund Type and Expense RatiosTree Diagram for Fund Type and Expense Ratios

Figure 5.11

Page 25: Probability (Part 2) Chapter55 Contingency Tables Tree Diagrams Bayes’ Theorem Counting Rules McGraw-Hill/Irwin Copyright © 2009 by The McGraw-Hill Companies,

5B-25

• Thomas Bayes (1702-1761) provided a Thomas Bayes (1702-1761) provided a method (called method (called Bayes’s TheoremBayes’s Theorem) of revising ) of revising probabilities to reflect new probabilities. probabilities to reflect new probabilities.

• The The priorprior (marginal) probability of an event (marginal) probability of an event BB is revised after event is revised after event AA has been considered has been considered to yield a to yield a posteriorposterior (conditional) probability. (conditional) probability.

• Bayes’s formula is:Bayes’s formula is:( | ) ( )

( | )( )

P A B P BP B A

P A

Bayes’ TheoremBayes’ TheoremBayes’ TheoremBayes’ Theorem

Page 26: Probability (Part 2) Chapter55 Contingency Tables Tree Diagrams Bayes’ Theorem Counting Rules McGraw-Hill/Irwin Copyright © 2009 by The McGraw-Hill Companies,

5B-26

• Bayes’ formula begins as:Bayes’ formula begins as:

( | ) ( )( | )

( )

P A B P BP B A

P A

• In some situations In some situations PP((AA) is not given. ) is not given. Therefore, the most useful and common Therefore, the most useful and common form of Bayes’ Theorem is:form of Bayes’ Theorem is:

( | ) ( )( | )

( | ) ( ) ( | ') ( ')

P A B P BP B A

P A B P B P A B P B

Bayes’ TheoremBayes’ TheoremBayes’ TheoremBayes’ Theorem

Page 27: Probability (Part 2) Chapter55 Contingency Tables Tree Diagrams Bayes’ Theorem Counting Rules McGraw-Hill/Irwin Copyright © 2009 by The McGraw-Hill Companies,

• If a woman is not pregnant, what is the test’s “track If a woman is not pregnant, what is the test’s “track record”?record”?

• Consider an over-the-counter pregnancy testing kit Consider an over-the-counter pregnancy testing kit and it’s “track record” of determining pregnancies.and it’s “track record” of determining pregnancies.

Bayes’ TheoremBayes’ TheoremBayes’ TheoremBayes’ Theorem

How Bayes’ Theorem WorksHow Bayes’ Theorem Works

96% of time96% of time1% of time1% of time

4% of time4% of time99% of time99% of time

False NegativeFalse NegativeFalse PositiveFalse Positive

• If a woman is actually pregnant, what is the test’s If a woman is actually pregnant, what is the test’s “track record”?“track record”?

Table 5.17

5B-27

Page 28: Probability (Part 2) Chapter55 Contingency Tables Tree Diagrams Bayes’ Theorem Counting Rules McGraw-Hill/Irwin Copyright © 2009 by The McGraw-Hill Companies,

5B-28

• Intuitively, if 1,000 women use this test, the Intuitively, if 1,000 women use this test, the results should look like this.results should look like this.

Bayes’ TheoremBayes’ TheoremBayes’ TheoremBayes’ Theorem

How Bayes’ Theorem WorksHow Bayes’ Theorem Works• Suppose that 60% of the women who Suppose that 60% of the women who

purchase the kit are actually pregnant.purchase the kit are actually pregnant.

Page 29: Probability (Part 2) Chapter55 Contingency Tables Tree Diagrams Bayes’ Theorem Counting Rules McGraw-Hill/Irwin Copyright © 2009 by The McGraw-Hill Companies,

5B-29

• Of the 580 women who test positive, 576 will actually be pregnant.

• So, the desired probability is:

P(Pregnant│Positive Test) = 576/580 = .9931

Bayes’ TheoremBayes’ TheoremBayes’ TheoremBayes’ Theorem

How Bayes’ Theorem WorksHow Bayes’ Theorem Works

Page 30: Probability (Part 2) Chapter55 Contingency Tables Tree Diagrams Bayes’ Theorem Counting Rules McGraw-Hill/Irwin Copyright © 2009 by The McGraw-Hill Companies,

5B-30

• Now use Bayes’s Theorem to formally derive the Now use Bayes’s Theorem to formally derive the result result PP(Pregnant | Positive) = .9931:(Pregnant | Positive) = .9931:

• First defineFirst defineAA = positive test = positive test BB = pregnant = pregnantAA' = negative test' = negative test BB' = not pregnant' = not pregnant

P(A | B) = .96P(A | B') = .01P(B) = .60

• And the compliment of And the compliment of each event is:each event is:

P(A' | B) = .04P(A' | B') = .99 P(B') = .40

• From the contingency From the contingency table, we know that: table, we know that:

Bayes’ TheoremBayes’ TheoremBayes’ TheoremBayes’ Theorem

How Bayes’ Theorem WorksHow Bayes’ Theorem Works

Page 31: Probability (Part 2) Chapter55 Contingency Tables Tree Diagrams Bayes’ Theorem Counting Rules McGraw-Hill/Irwin Copyright © 2009 by The McGraw-Hill Companies,

5B-31

PP((BB | | AA) =) =PP((AA | | BB))PP((BB))

PP((AA | | BB))PP((BB) + ) + PP((AA | | BB')')PP((BB')')

==(.96)(.60)(.96)(.60)

(.96)(.60) + (.01)(.40)(.96)(.60) + (.01)(.40)

==.576.576

.576 + .04.576 + .04==

.576.576

.580.580== .9931.9931

• So, there is a 99.31% chance that a woman is So, there is a 99.31% chance that a woman is pregnant, given that the test is positive.pregnant, given that the test is positive.

Bayes’ TheoremBayes’ TheoremBayes’ TheoremBayes’ Theorem

How Bayes’ Theorem WorksHow Bayes’ Theorem Works

Page 32: Probability (Part 2) Chapter55 Contingency Tables Tree Diagrams Bayes’ Theorem Counting Rules McGraw-Hill/Irwin Copyright © 2009 by The McGraw-Hill Companies,

5B-32

• Bayes’s Theorem shows us how to revise Bayes’s Theorem shows us how to revise our our priorprior probability of pregnancy to get the probability of pregnancy to get the posteriorposterior probability after the results of the probability after the results of the pregnancy test are known.pregnancy test are known.

PriorPriorBefore the testBefore the test

PosteriorPosteriorAfter positive test resultAfter positive test result

PP((BB) = .60) = .60 PP((BB | | AA) = .9931) = .9931

• Bayes’s Theorem is useful when a direct Bayes’s Theorem is useful when a direct calculation of a conditional probability is not calculation of a conditional probability is not permitted due to lack of information.permitted due to lack of information.

Bayes’ TheoremBayes’ TheoremBayes’ TheoremBayes’ Theorem

How Bayes’ Theorem WorksHow Bayes’ Theorem Works

Page 33: Probability (Part 2) Chapter55 Contingency Tables Tree Diagrams Bayes’ Theorem Counting Rules McGraw-Hill/Irwin Copyright © 2009 by The McGraw-Hill Companies,

5B-33

• A tree diagram helps visualize the situation.A tree diagram helps visualize the situation.

Bayes’ TheoremBayes’ TheoremBayes’ TheoremBayes’ Theorem

How Bayes’ Theorem WorksHow Bayes’ Theorem Works

Page 34: Probability (Part 2) Chapter55 Contingency Tables Tree Diagrams Bayes’ Theorem Counting Rules McGraw-Hill/Irwin Copyright © 2009 by The McGraw-Hill Companies,

5B-34

The 2 branches showing a positive test (A) comprise a reduced sample space B A and B' A,

Bayes’ TheoremBayes’ TheoremBayes’ TheoremBayes’ Theorem

How Bayes’ Theorem WorksHow Bayes’ Theorem Works

so add their probabilities to obtain the denominator of the fraction whosenumerator is P(B A).

Page 35: Probability (Part 2) Chapter55 Contingency Tables Tree Diagrams Bayes’ Theorem Counting Rules McGraw-Hill/Irwin Copyright © 2009 by The McGraw-Hill Companies,

5B-35

• A generalization of Bayes’s Theorem allows A generalization of Bayes’s Theorem allows event event BB to be polytomous ( to be polytomous (BB11, , BB22, , … B… Bnn) )

rather than dichotomous rather than dichotomous (B(B and and BB')')..

1 1 2 2

( | ) ( )( | )

( | ) ( ) ( | ) ( ) ... ( | ) ( )i i

in n

P A B P BP B A

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

Bayes’ TheoremBayes’ TheoremBayes’ TheoremBayes’ Theorem

General Form of Bayes’ TheoremGeneral Form of Bayes’ Theorem

Page 36: Probability (Part 2) Chapter55 Contingency Tables Tree Diagrams Bayes’ Theorem Counting Rules McGraw-Hill/Irwin Copyright © 2009 by The McGraw-Hill Companies,

5B-36

• Based on historical data, the percent of cases at 3 Based on historical data, the percent of cases at 3 hospital trauma centers and the probability of a case hospital trauma centers and the probability of a case resulting in a malpractice suit are as follows:resulting in a malpractice suit are as follows:

• let event let event AA = a malpractice suit is filed = a malpractice suit is filedBBii = patient was treated at trauma center = patient was treated at trauma center ii

Bayes’ TheoremBayes’ TheoremBayes’ TheoremBayes’ Theorem

Example: Hospital Trauma CentersExample: Hospital Trauma Centers(Table 5.18)

Page 37: Probability (Part 2) Chapter55 Contingency Tables Tree Diagrams Bayes’ Theorem Counting Rules McGraw-Hill/Irwin Copyright © 2009 by The McGraw-Hill Companies,

5B-37

• Applying the general form of Bayes’ Applying the general form of Bayes’ Theorem, find Theorem, find PP((BB11 | | AA).).

1 11

1 1 2 2 3 3

( | ) ( )( | )

( | ) ( ) ( | ) ( ) ( | ) ( )

P A B P BP B A

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

1

(0.001)(0.50)( | )

(0.001)(0.50) (0.005)(0.30) (0.008)(0.20)P B A

Bayes’s TheoremBayes’s TheoremBayes’s TheoremBayes’s Theorem

Example: Hospital Trauma CentersExample: Hospital Trauma Centers

1

0.0005 0.0005( | ) 0.1389

0.0005 0.0015 0.0016 0.00036P B A

0.0.

Page 38: Probability (Part 2) Chapter55 Contingency Tables Tree Diagrams Bayes’ Theorem Counting Rules McGraw-Hill/Irwin Copyright © 2009 by The McGraw-Hill Companies,

5B-38

• Conclude that the probability that the malpractice Conclude that the probability that the malpractice suit was filed in hospital 1 is .1389 or 13.89%.suit was filed in hospital 1 is .1389 or 13.89%.

• All the posterior probabilities for each hospital can All the posterior probabilities for each hospital can be calculated and then compared:be calculated and then compared:

Bayes’ TheoremBayes’ TheoremBayes’ TheoremBayes’ Theorem

Example: Hospital Trauma CentersExample: Hospital Trauma Centers

(Table 5.19)

Page 39: Probability (Part 2) Chapter55 Contingency Tables Tree Diagrams Bayes’ Theorem Counting Rules McGraw-Hill/Irwin Copyright © 2009 by The McGraw-Hill Companies,

5B-39 = 1,984 - 16= 1,984 - 16

= 3,000 - 15= 3,000 - 15

= 5,000 - 5= 5,000 - 5

= 2,000 x .008= 2,000 x .008

= 3,000 x .005= 3,000 x .005

= 5,000 x .001= 5,000 x .001

= 10,000x.2= 10,000x.2

= 10,000x.3= 10,000x.3

= 10,000x.5= 10,000x.5

• Intuitively, imagine there were 10,000 Intuitively, imagine there were 10,000 patients and calculate the frequencies:patients and calculate the frequencies:

HospitalHospital Malpractice Malpractice Suit FiledSuit Filed

No Malpractice No Malpractice Suit FiledSuit Filed

TotalTotal

1 55 4,9954,995 5,0005,000

2 1515 2,9852,985 3,0003,000

3 1616 1,9841,984 2,0002,000

Total 36 9,964 10,000

Bayes’ TheoremBayes’ TheoremBayes’ TheoremBayes’ Theorem

Example: Hospital Trauma CentersExample: Hospital Trauma Centers

Page 40: Probability (Part 2) Chapter55 Contingency Tables Tree Diagrams Bayes’ Theorem Counting Rules McGraw-Hill/Irwin Copyright © 2009 by The McGraw-Hill Companies,

5B-40

• Now, use these frequencies to find the Now, use these frequencies to find the probabilities needed for Bayes’ Theorem.probabilities needed for Bayes’ Theorem.

HospitalHospital Malpractice Malpractice Suit FiledSuit Filed

No Malpractice No Malpractice Suit FiledSuit Filed

TotalTotal

1 P(B1|A)=5/36=.1389 P(B1|A')=.5012 P(B1)=.5

2 P(B2|A)=15/36=.4167 P(B2|A')=.2996 P(B2)=.3

3 P(B3|A)=16/36=4444 P(B3|A')=.1991 P(B3)=.2

Total P(A)=36/10000=.0036 P(A')=.9964 1.0000

• For example, For example,

Bayes’ TheoremBayes’ TheoremBayes’ TheoremBayes’ Theorem

Example: Hospital Trauma CentersExample: Hospital Trauma Centers

Page 41: Probability (Part 2) Chapter55 Contingency Tables Tree Diagrams Bayes’ Theorem Counting Rules McGraw-Hill/Irwin Copyright © 2009 by The McGraw-Hill Companies,

5B-41

• Consider the following visual description of Consider the following visual description of the problem:the problem:

Bayes’ TheoremBayes’ TheoremBayes’ TheoremBayes’ Theorem

Example: Hospital Trauma CentersExample: Hospital Trauma Centers

Page 42: Probability (Part 2) Chapter55 Contingency Tables Tree Diagrams Bayes’ Theorem Counting Rules McGraw-Hill/Irwin Copyright © 2009 by The McGraw-Hill Companies,

5B-42

• The initial sample space consists of 3 The initial sample space consists of 3 mutually exclusive and collectively mutually exclusive and collectively exhaustive events (hospitals exhaustive events (hospitals BB11, B, B22, , BB33).).

Bayes’ TheoremBayes’ TheoremBayes’ TheoremBayes’ Theorem

Example: Hospital Trauma CentersExample: Hospital Trauma Centers

Page 43: Probability (Part 2) Chapter55 Contingency Tables Tree Diagrams Bayes’ Theorem Counting Rules McGraw-Hill/Irwin Copyright © 2009 by The McGraw-Hill Companies,

5B-43

• As indicated by their relative areas, As indicated by their relative areas, BB11 is 50% is 50%

of the sample space,of the sample space, B B22 is 30% and is 30% and BB33 is 20%. is 20%.

Bayes’ TheoremBayes’ TheoremBayes’ TheoremBayes’ Theorem

Example: Hospital Trauma CentersExample: Hospital Trauma Centers

50%50% 30%30%

20%20%

Page 44: Probability (Part 2) Chapter55 Contingency Tables Tree Diagrams Bayes’ Theorem Counting Rules McGraw-Hill/Irwin Copyright © 2009 by The McGraw-Hill Companies,

5B-44

• But, But, givengiven that a malpractice case has been filed that a malpractice case has been filed (event (event AA), then the relevant sample space is ), then the relevant sample space is reducedreduced to the yellow area of event to the yellow area of event AA..

• The The revisedrevised probabilities are the relative areas probabilities are the relative areas withinwithin event event AA..

Bayes’ TheoremBayes’ TheoremBayes’ TheoremBayes’ Theorem

Example: Hospital Trauma CentersExample: Hospital Trauma Centers

PP((BB11 | | AA))

PP((BB22 | | AA))

PP((BB33 | | AA))

Page 45: Probability (Part 2) Chapter55 Contingency Tables Tree Diagrams Bayes’ Theorem Counting Rules McGraw-Hill/Irwin Copyright © 2009 by The McGraw-Hill Companies,

5B-45

• If event If event AA can occur in can occur in nn11 ways and event ways and event BB

can occur in can occur in nn22 ways, then events ways, then events AA and and BB

can occur in can occur in nn11 x x nn22 ways. ways.

• In general, In general, mm events can occur events can occurnn11 x x nn22 x … x x … x nnmm ways. ways.

Counting RulesCounting RulesCounting RulesCounting Rules

Fundamental Rule of CountingFundamental Rule of Counting

Page 46: Probability (Part 2) Chapter55 Contingency Tables Tree Diagrams Bayes’ Theorem Counting Rules McGraw-Hill/Irwin Copyright © 2009 by The McGraw-Hill Companies,

5B-46

• How many unique stock-keeping unit (SKU) How many unique stock-keeping unit (SKU) labels can a hardware store create by using labels can a hardware store create by using 2 letters (ranging from 2 letters (ranging from AAAA to to ZZZZ) followed by ) followed by four numbers (0 through 9)?four numbers (0 through 9)?

• For example, For example, AF1078: hex-head 6 cm bolts – box of 12AF1078: hex-head 6 cm bolts – box of 12RT4855: Lime-A-Way cleaner – 16 ounceRT4855: Lime-A-Way cleaner – 16 ounceLL3319: Rust-Oleum primer – gray 15 ounceLL3319: Rust-Oleum primer – gray 15 ounce

Counting RulesCounting RulesCounting RulesCounting Rules

Example: Stock-Keeping LabelsExample: Stock-Keeping Labels

Page 47: Probability (Part 2) Chapter55 Contingency Tables Tree Diagrams Bayes’ Theorem Counting Rules McGraw-Hill/Irwin Copyright © 2009 by The McGraw-Hill Companies,

5B-47

• View the problem as filling six empty boxes:View the problem as filling six empty boxes:

• There are 26 ways to fill either the 1st or 2nd box and 10 ways to fill the 3rd through 6th.

• Therefore, there are 26 x 26 x 10 x 10 x 10 x 10 = 6,760,000 unique inventory labels.

Counting RulesCounting RulesCounting RulesCounting Rules

Example: Stock-Keeping LabelsExample: Stock-Keeping Labels

Page 48: Probability (Part 2) Chapter55 Contingency Tables Tree Diagrams Bayes’ Theorem Counting Rules McGraw-Hill/Irwin Copyright © 2009 by The McGraw-Hill Companies,

5B-48

• L.L. Bean men’s cotton chambray shirt L.L. Bean men’s cotton chambray shirt comes in 6 colors (blue, stone, rust, green, comes in 6 colors (blue, stone, rust, green, plum, indigo), 5 sizes (plum, indigo), 5 sizes (SS, , MM, , LL, , XLXL, , XXLXXL) and ) and two styles (short and long sleeves).two styles (short and long sleeves).

• Their stock might include 6 x 5 x 2 = 60 Their stock might include 6 x 5 x 2 = 60 possible shirts.possible shirts.

• However, the number of each type of shirt to However, the number of each type of shirt to be stocked depends on prior demand.be stocked depends on prior demand.

Counting RulesCounting RulesCounting RulesCounting Rules

Example: Shirt InventoryExample: Shirt Inventory

Page 49: Probability (Part 2) Chapter55 Contingency Tables Tree Diagrams Bayes’ Theorem Counting Rules McGraw-Hill/Irwin Copyright © 2009 by The McGraw-Hill Companies,

5B-49

• The number of ways that The number of ways that nn items can be items can be arranged in a particular order is arranged in a particular order is nn factorialfactorial..

• n factorial n factorial is the product of all integers from is the product of all integers from 1 to 1 to nn..

• Factorials are useful for counting the Factorials are useful for counting the possible arrangements of any possible arrangements of any nn items. items.

n! = n(n–1)(n–2)...1

• There are There are nn ways to choose the first, ways to choose the first, n-1n-1 ways to choose the second, and so on.ways to choose the second, and so on.

Counting RulesCounting RulesCounting RulesCounting Rules

FactorialsFactorials

Page 50: Probability (Part 2) Chapter55 Contingency Tables Tree Diagrams Bayes’ Theorem Counting Rules McGraw-Hill/Irwin Copyright © 2009 by The McGraw-Hill Companies,

5B-50

• As illustrated below, there are As illustrated below, there are nn ways to choose ways to choose the first item, the first item, n-1n-1 ways to choose the second, ways to choose the second, n-2 n-2 ways to choose the third and so on.ways to choose the third and so on.

Counting RulesCounting RulesCounting RulesCounting Rules

FactorialsFactorials

Page 51: Probability (Part 2) Chapter55 Contingency Tables Tree Diagrams Bayes’ Theorem Counting Rules McGraw-Hill/Irwin Copyright © 2009 by The McGraw-Hill Companies,

5B-51

• A home appliance service truck must make 3 stops A home appliance service truck must make 3 stops ((AA, , BB, , CC). ).

• In how many ways could the three stops be In how many ways could the three stops be arranged?arranged?

3! = 3 x 2 x 1 = 63! = 3 x 2 x 1 = 6

• List all the possible arrangements:List all the possible arrangements:

{{ABC, ACB, BAC, BCA, CAB, CBAABC, ACB, BAC, BCA, CAB, CBA}}

• How many ways can you arrange 9 baseball players How many ways can you arrange 9 baseball players in batting order rotation?in batting order rotation?

9! = 9 x 8 x 7 x 6 x 5 x 4 x 3 x 2 x 1 = 362,8809! = 9 x 8 x 7 x 6 x 5 x 4 x 3 x 2 x 1 = 362,880

Counting RulesCounting RulesCounting RulesCounting Rules

FactorialsFactorials

Page 52: Probability (Part 2) Chapter55 Contingency Tables Tree Diagrams Bayes’ Theorem Counting Rules McGraw-Hill/Irwin Copyright © 2009 by The McGraw-Hill Companies,

5B-52

• A A permutationpermutation is an arrangement is an arrangement inin a a particular orderparticular order of of rr randomly sampled items randomly sampled items from a group of from a group of nn items and is denoted by items and is denoted by nnPPrr

• In other words, how many ways can the In other words, how many ways can the rr items be arranged, treating each arrangement items be arranged, treating each arrangement as different (i.e., as different (i.e., XYZXYZ is different from is different from ZYXZYX)?)?

!

( )!rn

nP

n r

Counting RulesCounting RulesCounting RulesCounting Rules

PermutationsPermutations

Page 53: Probability (Part 2) Chapter55 Contingency Tables Tree Diagrams Bayes’ Theorem Counting Rules McGraw-Hill/Irwin Copyright © 2009 by The McGraw-Hill Companies,

5B-53

• nn = 5 home appliance customers ( = 5 home appliance customers (AA, , BB, , CC, , DD, , EE) need ) need service calls, but the field technician can service service calls, but the field technician can service only only rr = 3 of them before noon. = 3 of them before noon.

• The order is important so each possible The order is important so each possible arrangement of the three service calls is different.arrangement of the three service calls is different.

• The number of possible permutations is:The number of possible permutations is:

! 5! 5 4 3 2 1 12060

( )! (5 3)! 2! 2rn

nP

n r

Counting RulesCounting RulesCounting RulesCounting Rules

Example: Appliance Service CansExample: Appliance Service Cans

Page 54: Probability (Part 2) Chapter55 Contingency Tables Tree Diagrams Bayes’ Theorem Counting Rules McGraw-Hill/Irwin Copyright © 2009 by The McGraw-Hill Companies,

5B-54

• The 60 permutations with The 60 permutations with rr = 3 out of the = 3 out of the nn = = 5 calls can be enumerated.5 calls can be enumerated.

ABCABCABDABDABEABEACDACDACEACEADEADEBCDBCDBCEBCEBDEBDECDECDE

• There are 10 distinct groups of 3 customers:There are 10 distinct groups of 3 customers:

• Each of these can be arranged in 6 distinct ways:

ABC, ACB, BAC, BCA, CAB, CBA

• Since there are 10 groups of 3 customers and 6 arrange-ments per group, there are 10 x 6 = 60 permutations.

Counting RulesCounting RulesCounting RulesCounting Rules

Example: Appliance Service CansExample: Appliance Service Cans

Page 55: Probability (Part 2) Chapter55 Contingency Tables Tree Diagrams Bayes’ Theorem Counting Rules McGraw-Hill/Irwin Copyright © 2009 by The McGraw-Hill Companies,

5B-55

• A A combinationcombination is an arrangement of is an arrangement of rr items items chosen at random from chosen at random from nn items where the items where the order of the selected items is not important order of the selected items is not important (i.e., (i.e., XYZXYZ is the same as is the same as ZYXZYX).).

• A combination is denoted A combination is denoted nnCCrr

!

!( )!rn

nC

r n r

Counting RulesCounting RulesCounting RulesCounting Rules

CombinationsCombinations

Page 56: Probability (Part 2) Chapter55 Contingency Tables Tree Diagrams Bayes’ Theorem Counting Rules McGraw-Hill/Irwin Copyright © 2009 by The McGraw-Hill Companies,

5B-56

• nn = 5 home appliance customers ( = 5 home appliance customers (AA, , BB, , CC, , DD, , EE) need ) need service calls, but the field technician can service service calls, but the field technician can service only only rr = 3 of them before noon. = 3 of them before noon.

• This time order is not important. This time order is not important. • Thus, Thus, ABC, ACB, BAC, BCA, CAB, CBA ABC, ACB, BAC, BCA, CAB, CBA would all be would all be

considered the same event because they contain the considered the same event because they contain the same 3 customers.same 3 customers.

• The number of possible combinations is:The number of possible combinations is:

! 5! 5 4 3 2 1 12010

!( )! 3!(5 3)! (3 2 1)(2 1) 12rn

nC

r n r

Counting RulesCounting RulesCounting RulesCounting Rules

Example: Appliance Service Calls RevisitedExample: Appliance Service Calls Revisited

Page 57: Probability (Part 2) Chapter55 Contingency Tables Tree Diagrams Bayes’ Theorem Counting Rules McGraw-Hill/Irwin Copyright © 2009 by The McGraw-Hill Companies,

5B-57

• 10 combinations is much smaller than the 60 10 combinations is much smaller than the 60 permutations in the previous example.permutations in the previous example.

• The combinations are easily enumerated:The combinations are easily enumerated:

ABC, ABD, ABE, ACD, ACE, ADE, BCD, BCE, BDE, CDE

Counting RulesCounting RulesCounting RulesCounting Rules

Example: Appliance Service Calls RevisitedExample: Appliance Service Calls Revisited

Page 58: Probability (Part 2) Chapter55 Contingency Tables Tree Diagrams Bayes’ Theorem Counting Rules McGraw-Hill/Irwin Copyright © 2009 by The McGraw-Hill Companies,

Applied Statistics in Applied Statistics in Business & EconomicsBusiness & Economics

End of Chapter 5BEnd of Chapter 5B

5B-58