Top Banner
beamer-tu-log Preliminaries Bayes 0 rule A lot of computing . . . Lecture 7: Bayes 0 Rule, Revision Kateˇ rina Sta ˇ nková Statistics (MAT1003) April 26, 2012
57

Lecture 7: Bayes' Rule, Revision - Stankova · beamer-tu-logo Preliminaries Bayes0 ruleA lot of computing ... Lecture 7: Bayes0Rule, Revision Kateˇrina Sta nkovᡠStatistics (MAT1003)

Jun 27, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Lecture 7: Bayes' Rule, Revision - Stankova · beamer-tu-logo Preliminaries Bayes0 ruleA lot of computing ... Lecture 7: Bayes0Rule, Revision Kateˇrina Sta nkovᡠStatistics (MAT1003)

beamer-tu-logo

Preliminaries Bayes′ rule A lot of computing . . .

Lecture 7: Bayes′ Rule, Revision

Katerina Stanková

Statistics (MAT1003)

April 26, 2012

Page 2: Lecture 7: Bayes' Rule, Revision - Stankova · beamer-tu-logo Preliminaries Bayes0 ruleA lot of computing ... Lecture 7: Bayes0Rule, Revision Kateˇrina Sta nkovᡠStatistics (MAT1003)

beamer-tu-logo

Preliminaries Bayes′ rule A lot of computing . . .

Outline

1 PreliminariesPartition of a sample space

2 Bayes′ ruleTheoryExamples

3 A lot of computing . . .

Page 3: Lecture 7: Bayes' Rule, Revision - Stankova · beamer-tu-logo Preliminaries Bayes0 ruleA lot of computing ... Lecture 7: Bayes0Rule, Revision Kateˇrina Sta nkovᡠStatistics (MAT1003)

beamer-tu-logo

Preliminaries Bayes′ rule A lot of computing . . .

And now . . .

1 PreliminariesPartition of a sample space

2 Bayes′ ruleTheoryExamples

3 A lot of computing . . .

Page 4: Lecture 7: Bayes' Rule, Revision - Stankova · beamer-tu-logo Preliminaries Bayes0 ruleA lot of computing ... Lecture 7: Bayes0Rule, Revision Kateˇrina Sta nkovᡠStatistics (MAT1003)

beamer-tu-logo

Preliminaries Bayes′ rule A lot of computing . . .

Partition of a sample space

Partition of a sample space

Let S be a sample space. A set of subsets B1, B2, . . . , Bk of Sis called a partition of S if

k⋃i=1

Bi = B1 ∪ B2 ∪ . . .Bk = S

Bi ∩ Bj = ∅ for all i , j ∈ {1, . . . , k}, i 6= j

Page 5: Lecture 7: Bayes' Rule, Revision - Stankova · beamer-tu-logo Preliminaries Bayes0 ruleA lot of computing ... Lecture 7: Bayes0Rule, Revision Kateˇrina Sta nkovᡠStatistics (MAT1003)

beamer-tu-logo

Preliminaries Bayes′ rule A lot of computing . . .

Partition of a sample space

Partition of a sample spaceLet S be a sample space. A set of subsets B1, B2, . . . , Bk of Sis called a partition of S if

k⋃i=1

Bi = B1 ∪ B2 ∪ . . .Bk = S

Bi ∩ Bj = ∅ for all i , j ∈ {1, . . . , k}, i 6= j

Page 6: Lecture 7: Bayes' Rule, Revision - Stankova · beamer-tu-logo Preliminaries Bayes0 ruleA lot of computing ... Lecture 7: Bayes0Rule, Revision Kateˇrina Sta nkovᡠStatistics (MAT1003)

beamer-tu-logo

Preliminaries Bayes′ rule A lot of computing . . .

Partition of a sample space

Partition of a sample spaceLet S be a sample space. A set of subsets B1, B2, . . . , Bk of Sis called a partition of S if

k⋃i=1

Bi = B1 ∪ B2 ∪ . . .Bk = S

Bi ∩ Bj = ∅ for all i , j ∈ {1, . . . , k}, i 6= j

Page 7: Lecture 7: Bayes' Rule, Revision - Stankova · beamer-tu-logo Preliminaries Bayes0 ruleA lot of computing ... Lecture 7: Bayes0Rule, Revision Kateˇrina Sta nkovᡠStatistics (MAT1003)

beamer-tu-logo

Preliminaries Bayes′ rule A lot of computing . . .

Partition of a sample space

Partition of a sample spaceLet S be a sample space. A set of subsets B1, B2, . . . , Bk of Sis called a partition of S if

k⋃i=1

Bi = B1 ∪ B2 ∪ . . .Bk = S

Bi ∩ Bj = ∅ for all i , j ∈ {1, . . . , k}, i 6= j

Page 8: Lecture 7: Bayes' Rule, Revision - Stankova · beamer-tu-logo Preliminaries Bayes0 ruleA lot of computing ... Lecture 7: Bayes0Rule, Revision Kateˇrina Sta nkovᡠStatistics (MAT1003)

beamer-tu-logo

Preliminaries Bayes′ rule A lot of computing . . .

Partition of a sample space

Partition of a sample spaceLet S be a sample space. A set of subsets B1, B2, . . . , Bk of Sis called a partition of S if

k⋃i=1

Bi = B1 ∪ B2 ∪ . . .Bk = S

Bi ∩ Bj = ∅ for all i , j ∈ {1, . . . , k}, i 6= j

Page 9: Lecture 7: Bayes' Rule, Revision - Stankova · beamer-tu-logo Preliminaries Bayes0 ruleA lot of computing ... Lecture 7: Bayes0Rule, Revision Kateˇrina Sta nkovᡠStatistics (MAT1003)

beamer-tu-logo

Preliminaries Bayes′ rule A lot of computing . . .

Partition of a sample space

Partition of a sample spaceLet S be a sample space. A set of subsets B1, B2, . . . , Bk of Sis called a partition of S if

k⋃i=1

Bi = B1 ∪ B2 ∪ . . .Bk = S

Bi ∩ Bj = ∅ for all i , j ∈ {1, . . . , k}, i 6= j

Page 10: Lecture 7: Bayes' Rule, Revision - Stankova · beamer-tu-logo Preliminaries Bayes0 ruleA lot of computing ... Lecture 7: Bayes0Rule, Revision Kateˇrina Sta nkovᡠStatistics (MAT1003)

beamer-tu-logo

Preliminaries Bayes′ rule A lot of computing . . .

Partition of a sample space

Example 1S = {1,2,3,4,5,6}

Partition {B1,B2,B3} with B1 = {1,3}, B2 = {5}, B3 = {2,4,6}

Example 2

S = [0,1]Partition {I1, I2} with I1 =

[0, 1

2

), I2 =

[12 ,1]

Example 3

Any sample space SPartition {B,B′} for any B ⊆ S

Page 11: Lecture 7: Bayes' Rule, Revision - Stankova · beamer-tu-logo Preliminaries Bayes0 ruleA lot of computing ... Lecture 7: Bayes0Rule, Revision Kateˇrina Sta nkovᡠStatistics (MAT1003)

beamer-tu-logo

Preliminaries Bayes′ rule A lot of computing . . .

Partition of a sample space

Example 1S = {1,2,3,4,5,6}Partition {B1,B2,B3} with B1 = {1,3}, B2 = {5}, B3 = {2,4,6}

Example 2

S = [0,1]Partition {I1, I2} with I1 =

[0, 1

2

), I2 =

[12 ,1]

Example 3

Any sample space SPartition {B,B′} for any B ⊆ S

Page 12: Lecture 7: Bayes' Rule, Revision - Stankova · beamer-tu-logo Preliminaries Bayes0 ruleA lot of computing ... Lecture 7: Bayes0Rule, Revision Kateˇrina Sta nkovᡠStatistics (MAT1003)

beamer-tu-logo

Preliminaries Bayes′ rule A lot of computing . . .

Partition of a sample space

Example 1S = {1,2,3,4,5,6}Partition {B1,B2,B3} with B1 = {1,3}, B2 = {5}, B3 = {2,4,6}

Example 2

S = [0,1]Partition {I1, I2} with I1 =

[0, 1

2

), I2 =

[12 ,1]

Example 3

Any sample space SPartition {B,B′} for any B ⊆ S

Page 13: Lecture 7: Bayes' Rule, Revision - Stankova · beamer-tu-logo Preliminaries Bayes0 ruleA lot of computing ... Lecture 7: Bayes0Rule, Revision Kateˇrina Sta nkovᡠStatistics (MAT1003)

beamer-tu-logo

Preliminaries Bayes′ rule A lot of computing . . .

Partition of a sample space

Example 1S = {1,2,3,4,5,6}Partition {B1,B2,B3} with B1 = {1,3}, B2 = {5}, B3 = {2,4,6}

Example 2S = [0,1]

Partition {I1, I2} with I1 =[0, 1

2

), I2 =

[12 ,1]

Example 3

Any sample space SPartition {B,B′} for any B ⊆ S

Page 14: Lecture 7: Bayes' Rule, Revision - Stankova · beamer-tu-logo Preliminaries Bayes0 ruleA lot of computing ... Lecture 7: Bayes0Rule, Revision Kateˇrina Sta nkovᡠStatistics (MAT1003)

beamer-tu-logo

Preliminaries Bayes′ rule A lot of computing . . .

Partition of a sample space

Example 1S = {1,2,3,4,5,6}Partition {B1,B2,B3} with B1 = {1,3}, B2 = {5}, B3 = {2,4,6}

Example 2S = [0,1]Partition {I1, I2} with I1 =

[0, 1

2

), I2 =

[12 ,1]

Example 3

Any sample space SPartition {B,B′} for any B ⊆ S

Page 15: Lecture 7: Bayes' Rule, Revision - Stankova · beamer-tu-logo Preliminaries Bayes0 ruleA lot of computing ... Lecture 7: Bayes0Rule, Revision Kateˇrina Sta nkovᡠStatistics (MAT1003)

beamer-tu-logo

Preliminaries Bayes′ rule A lot of computing . . .

Partition of a sample space

Example 1S = {1,2,3,4,5,6}Partition {B1,B2,B3} with B1 = {1,3}, B2 = {5}, B3 = {2,4,6}

Example 2S = [0,1]Partition {I1, I2} with I1 =

[0, 1

2

), I2 =

[12 ,1]

Example 3

Any sample space SPartition {B,B′} for any B ⊆ S

Page 16: Lecture 7: Bayes' Rule, Revision - Stankova · beamer-tu-logo Preliminaries Bayes0 ruleA lot of computing ... Lecture 7: Bayes0Rule, Revision Kateˇrina Sta nkovᡠStatistics (MAT1003)

beamer-tu-logo

Preliminaries Bayes′ rule A lot of computing . . .

Partition of a sample space

Example 1S = {1,2,3,4,5,6}Partition {B1,B2,B3} with B1 = {1,3}, B2 = {5}, B3 = {2,4,6}

Example 2S = [0,1]Partition {I1, I2} with I1 =

[0, 1

2

), I2 =

[12 ,1]

Example 3Any sample space S

Partition {B,B′} for any B ⊆ S

Page 17: Lecture 7: Bayes' Rule, Revision - Stankova · beamer-tu-logo Preliminaries Bayes0 ruleA lot of computing ... Lecture 7: Bayes0Rule, Revision Kateˇrina Sta nkovᡠStatistics (MAT1003)

beamer-tu-logo

Preliminaries Bayes′ rule A lot of computing . . .

Partition of a sample space

Example 1S = {1,2,3,4,5,6}Partition {B1,B2,B3} with B1 = {1,3}, B2 = {5}, B3 = {2,4,6}

Example 2S = [0,1]Partition {I1, I2} with I1 =

[0, 1

2

), I2 =

[12 ,1]

Example 3Any sample space SPartition {B,B′} for any B ⊆ S

Page 18: Lecture 7: Bayes' Rule, Revision - Stankova · beamer-tu-logo Preliminaries Bayes0 ruleA lot of computing ... Lecture 7: Bayes0Rule, Revision Kateˇrina Sta nkovᡠStatistics (MAT1003)

beamer-tu-logo

Preliminaries Bayes′ rule A lot of computing . . .

Partition of a sample space

Observation

Let B1, . . . , Bk be a partition of S. Then for any A ⊆ S :

A = A ∩ S = A ∩ (B1 ∪ B2 ∪ . . . ∪ Bk )

= (A ∩ B1)︸ ︷︷ ︸A1

∪ (A ∩ B2)︸ ︷︷ ︸A2

∪ . . . ∪ (A ∩ Bk )︸ ︷︷ ︸Ak

P(Ai) = P(A ∩ Bi) = P(Bi) ·P(A|Bi)A1,. . . , Ak disjoint sets

P(A)=k∑

i=1

P(A ∩ Bi)

=k∑

i=1

P(Bi) · P(A|Bi)

Page 19: Lecture 7: Bayes' Rule, Revision - Stankova · beamer-tu-logo Preliminaries Bayes0 ruleA lot of computing ... Lecture 7: Bayes0Rule, Revision Kateˇrina Sta nkovᡠStatistics (MAT1003)

beamer-tu-logo

Preliminaries Bayes′ rule A lot of computing . . .

Partition of a sample space

ObservationLet B1, . . . , Bk be a partition of S. Then for any A ⊆ S :

A = A ∩ S = A ∩ (B1 ∪ B2 ∪ . . . ∪ Bk )

= (A ∩ B1)︸ ︷︷ ︸A1

∪ (A ∩ B2)︸ ︷︷ ︸A2

∪ . . . ∪ (A ∩ Bk )︸ ︷︷ ︸Ak

P(Ai) = P(A ∩ Bi) = P(Bi) ·P(A|Bi)A1,. . . , Ak disjoint sets

P(A)=k∑

i=1

P(A ∩ Bi)

=k∑

i=1

P(Bi) · P(A|Bi)

Page 20: Lecture 7: Bayes' Rule, Revision - Stankova · beamer-tu-logo Preliminaries Bayes0 ruleA lot of computing ... Lecture 7: Bayes0Rule, Revision Kateˇrina Sta nkovᡠStatistics (MAT1003)

beamer-tu-logo

Preliminaries Bayes′ rule A lot of computing . . .

Partition of a sample space

ObservationLet B1, . . . , Bk be a partition of S. Then for any A ⊆ S :

A = A ∩ S = A ∩ (B1 ∪ B2 ∪ . . . ∪ Bk )

= (A ∩ B1)︸ ︷︷ ︸A1

∪ (A ∩ B2)︸ ︷︷ ︸A2

∪ . . . ∪ (A ∩ Bk )︸ ︷︷ ︸Ak

P(Ai) = P(A ∩ Bi) = P(Bi) ·P(A|Bi)A1,. . . , Ak disjoint sets

P(A)=k∑

i=1

P(A ∩ Bi)

=k∑

i=1

P(Bi) · P(A|Bi)

Page 21: Lecture 7: Bayes' Rule, Revision - Stankova · beamer-tu-logo Preliminaries Bayes0 ruleA lot of computing ... Lecture 7: Bayes0Rule, Revision Kateˇrina Sta nkovᡠStatistics (MAT1003)

beamer-tu-logo

Preliminaries Bayes′ rule A lot of computing . . .

Partition of a sample space

ObservationLet B1, . . . , Bk be a partition of S. Then for any A ⊆ S :

A = A ∩ S = A ∩ (B1 ∪ B2 ∪ . . . ∪ Bk )

= (A ∩ B1)︸ ︷︷ ︸A1

∪ (A ∩ B2)︸ ︷︷ ︸A2

∪ . . . ∪ (A ∩ Bk )︸ ︷︷ ︸Ak

P(Ai) = P(A ∩ Bi) = P(Bi) ·P(A|Bi)A1,. . . , Ak disjoint sets

P(A)=k∑

i=1

P(A ∩ Bi)

=k∑

i=1

P(Bi) · P(A|Bi)

Page 22: Lecture 7: Bayes' Rule, Revision - Stankova · beamer-tu-logo Preliminaries Bayes0 ruleA lot of computing ... Lecture 7: Bayes0Rule, Revision Kateˇrina Sta nkovᡠStatistics (MAT1003)

beamer-tu-logo

Preliminaries Bayes′ rule A lot of computing . . .

Partition of a sample space

ObservationLet B1, . . . , Bk be a partition of S. Then for any A ⊆ S :

A = A ∩ S = A ∩ (B1 ∪ B2 ∪ . . . ∪ Bk )

= (A ∩ B1)︸ ︷︷ ︸A1

∪ (A ∩ B2)︸ ︷︷ ︸A2

∪ . . . ∪ (A ∩ Bk )︸ ︷︷ ︸Ak

P(Ai) = P(A ∩ Bi) = P(Bi) ·P(A|Bi)A1,. . . , Ak disjoint sets

P(A)=k∑

i=1

P(A ∩ Bi)

=k∑

i=1

P(Bi) · P(A|Bi)

Page 23: Lecture 7: Bayes' Rule, Revision - Stankova · beamer-tu-logo Preliminaries Bayes0 ruleA lot of computing ... Lecture 7: Bayes0Rule, Revision Kateˇrina Sta nkovᡠStatistics (MAT1003)

beamer-tu-logo

Preliminaries Bayes′ rule A lot of computing . . .

And now . . .

1 PreliminariesPartition of a sample space

2 Bayes′ ruleTheoryExamples

3 A lot of computing . . .

Page 24: Lecture 7: Bayes' Rule, Revision - Stankova · beamer-tu-logo Preliminaries Bayes0 ruleA lot of computing ... Lecture 7: Bayes0Rule, Revision Kateˇrina Sta nkovᡠStatistics (MAT1003)

beamer-tu-logo

Preliminaries Bayes′ rule A lot of computing . . .

Theory

Bayes′ rule

If P(Bi) and P(A|Bi) are given for all i , we can calculate P(Bi |A)as follows:

P(Bi |A)=P(Bi ∩ A)

P(A)=

P(Bi) · P(A|Bi)

P(A)

where P(A) =k∑

i=1P(Bi) · P(A|Bi)

Page 25: Lecture 7: Bayes' Rule, Revision - Stankova · beamer-tu-logo Preliminaries Bayes0 ruleA lot of computing ... Lecture 7: Bayes0Rule, Revision Kateˇrina Sta nkovᡠStatistics (MAT1003)

beamer-tu-logo

Preliminaries Bayes′ rule A lot of computing . . .

Theory

Bayes′ ruleIf P(Bi) and P(A|Bi) are given for all i , we can calculate P(Bi |A)as follows:

P(Bi |A)=P(Bi ∩ A)

P(A)=

P(Bi) · P(A|Bi)

P(A)

where P(A) =k∑

i=1P(Bi) · P(A|Bi)

Page 26: Lecture 7: Bayes' Rule, Revision - Stankova · beamer-tu-logo Preliminaries Bayes0 ruleA lot of computing ... Lecture 7: Bayes0Rule, Revision Kateˇrina Sta nkovᡠStatistics (MAT1003)

beamer-tu-logo

Preliminaries Bayes′ rule A lot of computing . . .

Theory

Bayes′ ruleIf P(Bi) and P(A|Bi) are given for all i , we can calculate P(Bi |A)as follows:

P(Bi |A)=P(Bi ∩ A)

P(A)=

P(Bi) · P(A|Bi)

P(A)

where P(A) =k∑

i=1P(Bi) · P(A|Bi)

Page 27: Lecture 7: Bayes' Rule, Revision - Stankova · beamer-tu-logo Preliminaries Bayes0 ruleA lot of computing ... Lecture 7: Bayes0Rule, Revision Kateˇrina Sta nkovᡠStatistics (MAT1003)

beamer-tu-logo

Preliminaries Bayes′ rule A lot of computing . . .

Theory

Bayes′ ruleIf P(Bi) and P(A|Bi) are given for all i , we can calculate P(Bi |A)as follows:

P(Bi |A)=P(Bi ∩ A)

P(A)=

P(Bi) · P(A|Bi)

P(A)

where P(A) =k∑

i=1P(Bi) · P(A|Bi)

Page 28: Lecture 7: Bayes' Rule, Revision - Stankova · beamer-tu-logo Preliminaries Bayes0 ruleA lot of computing ... Lecture 7: Bayes0Rule, Revision Kateˇrina Sta nkovᡠStatistics (MAT1003)

beamer-tu-logo

Preliminaries Bayes′ rule A lot of computing . . .

Examples

Exercise 2.95 + forget about 40

Events:

C : A randomly chosen person has cancerD : A randomly chosen person is diagnosed as having cancer

Complementary events: C′ and D′

Data:

P(C) = 0.05 (P(C′) = 0.95)P(D|C) = 0.78 (P(D′|C) = 0.22)P(D|C′) = 0.06 (P(D′|C′) = 0.94)

Question 1:P(D) =?

Solution:

P(D) =

P(D ∩ C) + P(D ∩ C′)

= P(C) · P(D|C) + P(C′) · P(D|C′)

= 0.05 · 0.78 + 0.95 · 0.06 = 0.039 + 0.054 = 0.093

Page 29: Lecture 7: Bayes' Rule, Revision - Stankova · beamer-tu-logo Preliminaries Bayes0 ruleA lot of computing ... Lecture 7: Bayes0Rule, Revision Kateˇrina Sta nkovᡠStatistics (MAT1003)

beamer-tu-logo

Preliminaries Bayes′ rule A lot of computing . . .

Examples

Exercise 2.95 + forget about 40Events:

C : A randomly chosen person has cancerD : A randomly chosen person is diagnosed as having cancer

Complementary events: C′ and D′

Data:

P(C) = 0.05 (P(C′) = 0.95)P(D|C) = 0.78 (P(D′|C) = 0.22)P(D|C′) = 0.06 (P(D′|C′) = 0.94)

Question 1:P(D) =?

Solution:

P(D) =

P(D ∩ C) + P(D ∩ C′)

= P(C) · P(D|C) + P(C′) · P(D|C′)

= 0.05 · 0.78 + 0.95 · 0.06 = 0.039 + 0.054 = 0.093

Page 30: Lecture 7: Bayes' Rule, Revision - Stankova · beamer-tu-logo Preliminaries Bayes0 ruleA lot of computing ... Lecture 7: Bayes0Rule, Revision Kateˇrina Sta nkovᡠStatistics (MAT1003)

beamer-tu-logo

Preliminaries Bayes′ rule A lot of computing . . .

Examples

Exercise 2.95 + forget about 40Events:C : A randomly chosen person has cancer

D : A randomly chosen person is diagnosed as having cancer

Complementary events: C′ and D′

Data:

P(C) = 0.05 (P(C′) = 0.95)P(D|C) = 0.78 (P(D′|C) = 0.22)P(D|C′) = 0.06 (P(D′|C′) = 0.94)

Question 1:P(D) =?

Solution:

P(D) =

P(D ∩ C) + P(D ∩ C′)

= P(C) · P(D|C) + P(C′) · P(D|C′)

= 0.05 · 0.78 + 0.95 · 0.06 = 0.039 + 0.054 = 0.093

Page 31: Lecture 7: Bayes' Rule, Revision - Stankova · beamer-tu-logo Preliminaries Bayes0 ruleA lot of computing ... Lecture 7: Bayes0Rule, Revision Kateˇrina Sta nkovᡠStatistics (MAT1003)

beamer-tu-logo

Preliminaries Bayes′ rule A lot of computing . . .

Examples

Exercise 2.95 + forget about 40Events:C : A randomly chosen person has cancerD : A randomly chosen person is diagnosed as having cancer

Complementary events: C′ and D′

Data:

P(C) = 0.05 (P(C′) = 0.95)P(D|C) = 0.78 (P(D′|C) = 0.22)P(D|C′) = 0.06 (P(D′|C′) = 0.94)

Question 1:P(D) =?

Solution:

P(D) =

P(D ∩ C) + P(D ∩ C′)

= P(C) · P(D|C) + P(C′) · P(D|C′)

= 0.05 · 0.78 + 0.95 · 0.06 = 0.039 + 0.054 = 0.093

Page 32: Lecture 7: Bayes' Rule, Revision - Stankova · beamer-tu-logo Preliminaries Bayes0 ruleA lot of computing ... Lecture 7: Bayes0Rule, Revision Kateˇrina Sta nkovᡠStatistics (MAT1003)

beamer-tu-logo

Preliminaries Bayes′ rule A lot of computing . . .

Examples

Exercise 2.95 + forget about 40Events:C : A randomly chosen person has cancerD : A randomly chosen person is diagnosed as having cancer

Complementary events: C′ and D′

Data:

P(C) = 0.05 (P(C′) = 0.95)P(D|C) = 0.78 (P(D′|C) = 0.22)P(D|C′) = 0.06 (P(D′|C′) = 0.94)

Question 1:P(D) =?

Solution:

P(D) =

P(D ∩ C) + P(D ∩ C′)

= P(C) · P(D|C) + P(C′) · P(D|C′)

= 0.05 · 0.78 + 0.95 · 0.06 = 0.039 + 0.054 = 0.093

Page 33: Lecture 7: Bayes' Rule, Revision - Stankova · beamer-tu-logo Preliminaries Bayes0 ruleA lot of computing ... Lecture 7: Bayes0Rule, Revision Kateˇrina Sta nkovᡠStatistics (MAT1003)

beamer-tu-logo

Preliminaries Bayes′ rule A lot of computing . . .

Examples

Exercise 2.95 + forget about 40Events:C : A randomly chosen person has cancerD : A randomly chosen person is diagnosed as having cancer

Complementary events: C′ and D′

Data:

P(C) = 0.05 (P(C′) = 0.95)P(D|C) = 0.78 (P(D′|C) = 0.22)P(D|C′) = 0.06 (P(D′|C′) = 0.94)

Question 1:P(D) =?

Solution:

P(D) =

P(D ∩ C) + P(D ∩ C′)

= P(C) · P(D|C) + P(C′) · P(D|C′)

= 0.05 · 0.78 + 0.95 · 0.06 = 0.039 + 0.054 = 0.093

Page 34: Lecture 7: Bayes' Rule, Revision - Stankova · beamer-tu-logo Preliminaries Bayes0 ruleA lot of computing ... Lecture 7: Bayes0Rule, Revision Kateˇrina Sta nkovᡠStatistics (MAT1003)

beamer-tu-logo

Preliminaries Bayes′ rule A lot of computing . . .

Examples

Exercise 2.95 + forget about 40Events:C : A randomly chosen person has cancerD : A randomly chosen person is diagnosed as having cancer

Complementary events: C′ and D′

Data:P(C) = 0.05 (P(C′) = 0.95)

P(D|C) = 0.78 (P(D′|C) = 0.22)P(D|C′) = 0.06 (P(D′|C′) = 0.94)

Question 1:P(D) =?

Solution:

P(D) =

P(D ∩ C) + P(D ∩ C′)

= P(C) · P(D|C) + P(C′) · P(D|C′)

= 0.05 · 0.78 + 0.95 · 0.06 = 0.039 + 0.054 = 0.093

Page 35: Lecture 7: Bayes' Rule, Revision - Stankova · beamer-tu-logo Preliminaries Bayes0 ruleA lot of computing ... Lecture 7: Bayes0Rule, Revision Kateˇrina Sta nkovᡠStatistics (MAT1003)

beamer-tu-logo

Preliminaries Bayes′ rule A lot of computing . . .

Examples

Exercise 2.95 + forget about 40Events:C : A randomly chosen person has cancerD : A randomly chosen person is diagnosed as having cancer

Complementary events: C′ and D′

Data:P(C) = 0.05 (P(C′) = 0.95)P(D|C) = 0.78 (P(D′|C) = 0.22)

P(D|C′) = 0.06 (P(D′|C′) = 0.94)

Question 1:P(D) =?

Solution:

P(D) =

P(D ∩ C) + P(D ∩ C′)

= P(C) · P(D|C) + P(C′) · P(D|C′)

= 0.05 · 0.78 + 0.95 · 0.06 = 0.039 + 0.054 = 0.093

Page 36: Lecture 7: Bayes' Rule, Revision - Stankova · beamer-tu-logo Preliminaries Bayes0 ruleA lot of computing ... Lecture 7: Bayes0Rule, Revision Kateˇrina Sta nkovᡠStatistics (MAT1003)

beamer-tu-logo

Preliminaries Bayes′ rule A lot of computing . . .

Examples

Exercise 2.95 + forget about 40Events:C : A randomly chosen person has cancerD : A randomly chosen person is diagnosed as having cancer

Complementary events: C′ and D′

Data:P(C) = 0.05 (P(C′) = 0.95)P(D|C) = 0.78 (P(D′|C) = 0.22)P(D|C′) = 0.06 (P(D′|C′) = 0.94)

Question 1:P(D) =?

Solution:

P(D) =

P(D ∩ C) + P(D ∩ C′)

= P(C) · P(D|C) + P(C′) · P(D|C′)

= 0.05 · 0.78 + 0.95 · 0.06 = 0.039 + 0.054 = 0.093

Page 37: Lecture 7: Bayes' Rule, Revision - Stankova · beamer-tu-logo Preliminaries Bayes0 ruleA lot of computing ... Lecture 7: Bayes0Rule, Revision Kateˇrina Sta nkovᡠStatistics (MAT1003)

beamer-tu-logo

Preliminaries Bayes′ rule A lot of computing . . .

Examples

Exercise 2.95 + forget about 40Events:C : A randomly chosen person has cancerD : A randomly chosen person is diagnosed as having cancer

Complementary events: C′ and D′

Data:P(C) = 0.05 (P(C′) = 0.95)P(D|C) = 0.78 (P(D′|C) = 0.22)P(D|C′) = 0.06 (P(D′|C′) = 0.94)

Question 1:P(D) =?

Solution:

P(D) =

P(D ∩ C) + P(D ∩ C′)

= P(C) · P(D|C) + P(C′) · P(D|C′)

= 0.05 · 0.78 + 0.95 · 0.06 = 0.039 + 0.054 = 0.093

Page 38: Lecture 7: Bayes' Rule, Revision - Stankova · beamer-tu-logo Preliminaries Bayes0 ruleA lot of computing ... Lecture 7: Bayes0Rule, Revision Kateˇrina Sta nkovᡠStatistics (MAT1003)

beamer-tu-logo

Preliminaries Bayes′ rule A lot of computing . . .

Examples

Exercise 2.95 + forget about 40Events:C : A randomly chosen person has cancerD : A randomly chosen person is diagnosed as having cancer

Complementary events: C′ and D′

Data:P(C) = 0.05 (P(C′) = 0.95)P(D|C) = 0.78 (P(D′|C) = 0.22)P(D|C′) = 0.06 (P(D′|C′) = 0.94)

Question 1:P(D) =?

Solution:

P(D) =

P(D ∩ C) + P(D ∩ C′)

= P(C) · P(D|C) + P(C′) · P(D|C′)

= 0.05 · 0.78 + 0.95 · 0.06 = 0.039 + 0.054 = 0.093

Page 39: Lecture 7: Bayes' Rule, Revision - Stankova · beamer-tu-logo Preliminaries Bayes0 ruleA lot of computing ... Lecture 7: Bayes0Rule, Revision Kateˇrina Sta nkovᡠStatistics (MAT1003)

beamer-tu-logo

Preliminaries Bayes′ rule A lot of computing . . .

Examples

Exercise 2.95 + forget about 40Events:C : A randomly chosen person has cancerD : A randomly chosen person is diagnosed as having cancer

Complementary events: C′ and D′

Data:P(C) = 0.05 (P(C′) = 0.95)P(D|C) = 0.78 (P(D′|C) = 0.22)P(D|C′) = 0.06 (P(D′|C′) = 0.94)

Question 1:P(D) =?

Solution:

P(D) = P(D ∩ C) + P(D ∩ C′)

= P(C) · P(D|C) + P(C′) · P(D|C′)

= 0.05 · 0.78 + 0.95 · 0.06 = 0.039 + 0.054 = 0.093

Page 40: Lecture 7: Bayes' Rule, Revision - Stankova · beamer-tu-logo Preliminaries Bayes0 ruleA lot of computing ... Lecture 7: Bayes0Rule, Revision Kateˇrina Sta nkovᡠStatistics (MAT1003)

beamer-tu-logo

Preliminaries Bayes′ rule A lot of computing . . .

Examples

Exercise 2.95 + forget about 40Events:C : A randomly chosen person has cancerD : A randomly chosen person is diagnosed as having cancer

Complementary events: C′ and D′

Data:P(C) = 0.05 (P(C′) = 0.95)P(D|C) = 0.78 (P(D′|C) = 0.22)P(D|C′) = 0.06 (P(D′|C′) = 0.94)

Question 1:P(D) =?

Solution:

P(D) = P(D ∩ C) + P(D ∩ C′)

= P(C) · P(D|C) + P(C′) · P(D|C′)

= 0.05 · 0.78 + 0.95 · 0.06 = 0.039 + 0.054 = 0.093

Page 41: Lecture 7: Bayes' Rule, Revision - Stankova · beamer-tu-logo Preliminaries Bayes0 ruleA lot of computing ... Lecture 7: Bayes0Rule, Revision Kateˇrina Sta nkovᡠStatistics (MAT1003)

beamer-tu-logo

Preliminaries Bayes′ rule A lot of computing . . .

Examples

Exercise 2.95 + forget about 40Events:C : A randomly chosen person has cancerD : A randomly chosen person is diagnosed as having cancer

Complementary events: C′ and D′

Data:P(C) = 0.05 (P(C′) = 0.95)P(D|C) = 0.78 (P(D′|C) = 0.22)P(D|C′) = 0.06 (P(D′|C′) = 0.94)

Question 1:P(D) =?

Solution:

P(D) = P(D ∩ C) + P(D ∩ C′)

= P(C) · P(D|C) + P(C′) · P(D|C′)

= 0.05 · 0.78 + 0.95 · 0.06 = 0.039 + 0.054 = 0.093

Page 42: Lecture 7: Bayes' Rule, Revision - Stankova · beamer-tu-logo Preliminaries Bayes0 ruleA lot of computing ... Lecture 7: Bayes0Rule, Revision Kateˇrina Sta nkovᡠStatistics (MAT1003)

beamer-tu-logo

Preliminaries Bayes′ rule A lot of computing . . .

Examples

Exercise 2.95Events:C : A randomly chosen person has cancerD : A randomly chosen person is diagnosed as having cancer

Complementary events: C′ and D′

Data:P(C) = 0.05 (P(C′) = 0.95)P(D|C) = 0.78 (P(D′|C) = 0.22)P(D|C′) = 0.06 (P(D′|C′) = 0.94)P(D) = 0.093 (P(D′) = 1− 0.093 = 0.907)

Question 2: What is the probability that someonediagnosed with cancer actually has the disease?

P(C|D) =?

Solution:

P(C|D) =

P(C ∩ D)

P(D)=

P(D|C) · P(C)

P(D)=

0.78 · 0.050.093

=0.0390.093

=1331

Page 43: Lecture 7: Bayes' Rule, Revision - Stankova · beamer-tu-logo Preliminaries Bayes0 ruleA lot of computing ... Lecture 7: Bayes0Rule, Revision Kateˇrina Sta nkovᡠStatistics (MAT1003)

beamer-tu-logo

Preliminaries Bayes′ rule A lot of computing . . .

Examples

Exercise 2.95Events:C : A randomly chosen person has cancerD : A randomly chosen person is diagnosed as having cancer

Complementary events: C′ and D′

Data:P(C) = 0.05 (P(C′) = 0.95)P(D|C) = 0.78 (P(D′|C) = 0.22)P(D|C′) = 0.06 (P(D′|C′) = 0.94)P(D) = 0.093 (P(D′) = 1− 0.093 = 0.907)

Question 2: What is the probability that someonediagnosed with cancer actually has the disease?

P(C|D) =?

Solution:

P(C|D) =

P(C ∩ D)

P(D)=

P(D|C) · P(C)

P(D)=

0.78 · 0.050.093

=0.0390.093

=1331

Page 44: Lecture 7: Bayes' Rule, Revision - Stankova · beamer-tu-logo Preliminaries Bayes0 ruleA lot of computing ... Lecture 7: Bayes0Rule, Revision Kateˇrina Sta nkovᡠStatistics (MAT1003)

beamer-tu-logo

Preliminaries Bayes′ rule A lot of computing . . .

Examples

Exercise 2.95Events:C : A randomly chosen person has cancerD : A randomly chosen person is diagnosed as having cancer

Complementary events: C′ and D′

Data:P(C) = 0.05 (P(C′) = 0.95)P(D|C) = 0.78 (P(D′|C) = 0.22)P(D|C′) = 0.06 (P(D′|C′) = 0.94)P(D) = 0.093 (P(D′) = 1− 0.093 = 0.907)

Question 2: What is the probability that someonediagnosed with cancer actually has the disease?P(C|D) =?

Solution:

P(C|D) =

P(C ∩ D)

P(D)=

P(D|C) · P(C)

P(D)=

0.78 · 0.050.093

=0.0390.093

=1331

Page 45: Lecture 7: Bayes' Rule, Revision - Stankova · beamer-tu-logo Preliminaries Bayes0 ruleA lot of computing ... Lecture 7: Bayes0Rule, Revision Kateˇrina Sta nkovᡠStatistics (MAT1003)

beamer-tu-logo

Preliminaries Bayes′ rule A lot of computing . . .

Examples

Exercise 2.95Events:C : A randomly chosen person has cancerD : A randomly chosen person is diagnosed as having cancer

Complementary events: C′ and D′

Data:P(C) = 0.05 (P(C′) = 0.95)P(D|C) = 0.78 (P(D′|C) = 0.22)P(D|C′) = 0.06 (P(D′|C′) = 0.94)P(D) = 0.093 (P(D′) = 1− 0.093 = 0.907)

Question 2: What is the probability that someonediagnosed with cancer actually has the disease?P(C|D) =?

Solution:

P(C|D) =

P(C ∩ D)

P(D)=

P(D|C) · P(C)

P(D)=

0.78 · 0.050.093

=0.0390.093

=1331

Page 46: Lecture 7: Bayes' Rule, Revision - Stankova · beamer-tu-logo Preliminaries Bayes0 ruleA lot of computing ... Lecture 7: Bayes0Rule, Revision Kateˇrina Sta nkovᡠStatistics (MAT1003)

beamer-tu-logo

Preliminaries Bayes′ rule A lot of computing . . .

Examples

Exercise 2.95Events:C : A randomly chosen person has cancerD : A randomly chosen person is diagnosed as having cancer

Complementary events: C′ and D′

Data:P(C) = 0.05 (P(C′) = 0.95)P(D|C) = 0.78 (P(D′|C) = 0.22)P(D|C′) = 0.06 (P(D′|C′) = 0.94)P(D) = 0.093 (P(D′) = 1− 0.093 = 0.907)

Question 2: What is the probability that someonediagnosed with cancer actually has the disease?P(C|D) =?

Solution:

P(C|D) =P(C ∩ D)

P(D)

=P(D|C) · P(C)

P(D)=

0.78 · 0.050.093

=0.0390.093

=1331

Page 47: Lecture 7: Bayes' Rule, Revision - Stankova · beamer-tu-logo Preliminaries Bayes0 ruleA lot of computing ... Lecture 7: Bayes0Rule, Revision Kateˇrina Sta nkovᡠStatistics (MAT1003)

beamer-tu-logo

Preliminaries Bayes′ rule A lot of computing . . .

Examples

Exercise 2.95Events:C : A randomly chosen person has cancerD : A randomly chosen person is diagnosed as having cancer

Complementary events: C′ and D′

Data:P(C) = 0.05 (P(C′) = 0.95)P(D|C) = 0.78 (P(D′|C) = 0.22)P(D|C′) = 0.06 (P(D′|C′) = 0.94)P(D) = 0.093 (P(D′) = 1− 0.093 = 0.907)

Question 2: What is the probability that someonediagnosed with cancer actually has the disease?P(C|D) =?

Solution:

P(C|D) =P(C ∩ D)

P(D)=

P(D|C) · P(C)

P(D)

=0.78 · 0.05

0.093=

0.0390.093

=1331

Page 48: Lecture 7: Bayes' Rule, Revision - Stankova · beamer-tu-logo Preliminaries Bayes0 ruleA lot of computing ... Lecture 7: Bayes0Rule, Revision Kateˇrina Sta nkovᡠStatistics (MAT1003)

beamer-tu-logo

Preliminaries Bayes′ rule A lot of computing . . .

Examples

Exercise 2.95Events:C : A randomly chosen person has cancerD : A randomly chosen person is diagnosed as having cancer

Complementary events: C′ and D′

Data:P(C) = 0.05 (P(C′) = 0.95)P(D|C) = 0.78 (P(D′|C) = 0.22)P(D|C′) = 0.06 (P(D′|C′) = 0.94)P(D) = 0.093 (P(D′) = 1− 0.093 = 0.907)

Question 2: What is the probability that someonediagnosed with cancer actually has the disease?P(C|D) =?

Solution:

P(C|D) =P(C ∩ D)

P(D)=

P(D|C) · P(C)

P(D)=

0.78 · 0.050.093

=0.0390.093

=1331

Page 49: Lecture 7: Bayes' Rule, Revision - Stankova · beamer-tu-logo Preliminaries Bayes0 ruleA lot of computing ... Lecture 7: Bayes0Rule, Revision Kateˇrina Sta nkovᡠStatistics (MAT1003)

beamer-tu-logo

Preliminaries Bayes′ rule A lot of computing . . .

Examples

Exercise 2.95 - Question 3Events:C : A randomly chosen person has cancerD : A randomly chosen person is diagnosed as having cancer

Data:P(C) = 0.05 (P(C′) = 0.95)P(D|C) = 0.78 (P(D′|C) = 0.22)P(D|C′) = 0.06 (P(D′|C′) = 0.94)P(D) = 0.093 (P(D′) = 1− 0.093 = 0.907)

Question 3: What is the probability that someone who isdiagnosed as not having cancer actually has the disease?P(C|D′) =?

Solution:

P(C|D′) =

P(C ∩ D′)

P(D′)=

P(D′|C) · P(C)

P(D′)

=0.05 · 0.22

0.907=

0.00110.907

≈ 0.012

Page 50: Lecture 7: Bayes' Rule, Revision - Stankova · beamer-tu-logo Preliminaries Bayes0 ruleA lot of computing ... Lecture 7: Bayes0Rule, Revision Kateˇrina Sta nkovᡠStatistics (MAT1003)

beamer-tu-logo

Preliminaries Bayes′ rule A lot of computing . . .

Examples

Exercise 2.95 - Question 3Events:C : A randomly chosen person has cancerD : A randomly chosen person is diagnosed as having cancer

Data:P(C) = 0.05 (P(C′) = 0.95)P(D|C) = 0.78 (P(D′|C) = 0.22)P(D|C′) = 0.06 (P(D′|C′) = 0.94)P(D) = 0.093 (P(D′) = 1− 0.093 = 0.907)

Question 3: What is the probability that someone who isdiagnosed as not having cancer actually has the disease?

P(C|D′) =?

Solution:

P(C|D′) =

P(C ∩ D′)

P(D′)=

P(D′|C) · P(C)

P(D′)

=0.05 · 0.22

0.907=

0.00110.907

≈ 0.012

Page 51: Lecture 7: Bayes' Rule, Revision - Stankova · beamer-tu-logo Preliminaries Bayes0 ruleA lot of computing ... Lecture 7: Bayes0Rule, Revision Kateˇrina Sta nkovᡠStatistics (MAT1003)

beamer-tu-logo

Preliminaries Bayes′ rule A lot of computing . . .

Examples

Exercise 2.95 - Question 3Events:C : A randomly chosen person has cancerD : A randomly chosen person is diagnosed as having cancer

Data:P(C) = 0.05 (P(C′) = 0.95)P(D|C) = 0.78 (P(D′|C) = 0.22)P(D|C′) = 0.06 (P(D′|C′) = 0.94)P(D) = 0.093 (P(D′) = 1− 0.093 = 0.907)

Question 3: What is the probability that someone who isdiagnosed as not having cancer actually has the disease?P(C|D′) =?

Solution:

P(C|D′) =

P(C ∩ D′)

P(D′)=

P(D′|C) · P(C)

P(D′)

=0.05 · 0.22

0.907=

0.00110.907

≈ 0.012

Page 52: Lecture 7: Bayes' Rule, Revision - Stankova · beamer-tu-logo Preliminaries Bayes0 ruleA lot of computing ... Lecture 7: Bayes0Rule, Revision Kateˇrina Sta nkovᡠStatistics (MAT1003)

beamer-tu-logo

Preliminaries Bayes′ rule A lot of computing . . .

Examples

Exercise 2.95 - Question 3Events:C : A randomly chosen person has cancerD : A randomly chosen person is diagnosed as having cancer

Data:P(C) = 0.05 (P(C′) = 0.95)P(D|C) = 0.78 (P(D′|C) = 0.22)P(D|C′) = 0.06 (P(D′|C′) = 0.94)P(D) = 0.093 (P(D′) = 1− 0.093 = 0.907)

Question 3: What is the probability that someone who isdiagnosed as not having cancer actually has the disease?P(C|D′) =?

Solution:

P(C|D′) =

P(C ∩ D′)

P(D′)=

P(D′|C) · P(C)

P(D′)

=0.05 · 0.22

0.907=

0.00110.907

≈ 0.012

Page 53: Lecture 7: Bayes' Rule, Revision - Stankova · beamer-tu-logo Preliminaries Bayes0 ruleA lot of computing ... Lecture 7: Bayes0Rule, Revision Kateˇrina Sta nkovᡠStatistics (MAT1003)

beamer-tu-logo

Preliminaries Bayes′ rule A lot of computing . . .

Examples

Exercise 2.95 - Question 3Events:C : A randomly chosen person has cancerD : A randomly chosen person is diagnosed as having cancer

Data:P(C) = 0.05 (P(C′) = 0.95)P(D|C) = 0.78 (P(D′|C) = 0.22)P(D|C′) = 0.06 (P(D′|C′) = 0.94)P(D) = 0.093 (P(D′) = 1− 0.093 = 0.907)

Question 3: What is the probability that someone who isdiagnosed as not having cancer actually has the disease?P(C|D′) =?

Solution:

P(C|D′) =P(C ∩ D′)

P(D′)

=P(D′|C) · P(C)

P(D′)

=0.05 · 0.22

0.907=

0.00110.907

≈ 0.012

Page 54: Lecture 7: Bayes' Rule, Revision - Stankova · beamer-tu-logo Preliminaries Bayes0 ruleA lot of computing ... Lecture 7: Bayes0Rule, Revision Kateˇrina Sta nkovᡠStatistics (MAT1003)

beamer-tu-logo

Preliminaries Bayes′ rule A lot of computing . . .

Examples

Exercise 2.95 - Question 3Events:C : A randomly chosen person has cancerD : A randomly chosen person is diagnosed as having cancer

Data:P(C) = 0.05 (P(C′) = 0.95)P(D|C) = 0.78 (P(D′|C) = 0.22)P(D|C′) = 0.06 (P(D′|C′) = 0.94)P(D) = 0.093 (P(D′) = 1− 0.093 = 0.907)

Question 3: What is the probability that someone who isdiagnosed as not having cancer actually has the disease?P(C|D′) =?

Solution:

P(C|D′) =P(C ∩ D′)

P(D′)=

P(D′|C) · P(C)

P(D′)

=0.05 · 0.22

0.907=

0.00110.907

≈ 0.012

Page 55: Lecture 7: Bayes' Rule, Revision - Stankova · beamer-tu-logo Preliminaries Bayes0 ruleA lot of computing ... Lecture 7: Bayes0Rule, Revision Kateˇrina Sta nkovᡠStatistics (MAT1003)

beamer-tu-logo

Preliminaries Bayes′ rule A lot of computing . . .

Examples

Exercise 2.95 - Question 3Events:C : A randomly chosen person has cancerD : A randomly chosen person is diagnosed as having cancer

Data:P(C) = 0.05 (P(C′) = 0.95)P(D|C) = 0.78 (P(D′|C) = 0.22)P(D|C′) = 0.06 (P(D′|C′) = 0.94)P(D) = 0.093 (P(D′) = 1− 0.093 = 0.907)

Question 3: What is the probability that someone who isdiagnosed as not having cancer actually has the disease?P(C|D′) =?

Solution:

P(C|D′) =P(C ∩ D′)

P(D′)=

P(D′|C) · P(C)

P(D′)

=0.05 · 0.22

0.907=

0.00110.907

≈ 0.012

Page 56: Lecture 7: Bayes' Rule, Revision - Stankova · beamer-tu-logo Preliminaries Bayes0 ruleA lot of computing ... Lecture 7: Bayes0Rule, Revision Kateˇrina Sta nkovᡠStatistics (MAT1003)

beamer-tu-logo

Preliminaries Bayes′ rule A lot of computing . . .

And now . . .

1 PreliminariesPartition of a sample space

2 Bayes′ ruleTheoryExamples

3 A lot of computing . . .

Page 57: Lecture 7: Bayes' Rule, Revision - Stankova · beamer-tu-logo Preliminaries Bayes0 ruleA lot of computing ... Lecture 7: Bayes0Rule, Revision Kateˇrina Sta nkovᡠStatistics (MAT1003)

beamer-tu-logo

Preliminaries Bayes′ rule A lot of computing . . .

Try all odd exercises from Section 2.7 (pp. 76–77),Exercise 2.99 was done in the classAlso, you should be able to compute all Review exercisesfrom pp. 77-79, check it!