HUDM4122 Probability and Statistical Inference February 18, 2015.

83
HUDM4122 Probability and Statistical Inference February 18, 2015

Transcript of HUDM4122 Probability and Statistical Inference February 18, 2015.

HUDM4122Probability and Statistical Inference

February 18, 2015

HW

• Getting harder…

HW

• Getting harder…

Difficulties

A lot of trouble with sample space calculation

A reminder

• The sample space is the total number of combination of things that can happen

• If you flip a fair coin twice, the sample space is 4: HHTH HT TT

Problem 1

• What is the sample space if you flip a coin 6 times?

• Correct answer: 2x2x2x2x2x2 = 64• Most common answer: 12• Also: 1/64

Problem 2

• You have made friends with a specially trained mouse, who, on a given step, randomly goes left 1/3 of the time, forwards 1/3 of the time, and right 1/3 of a time. If the mouse takes 7 steps, what is the sample space?

• Correct answer: 3x3x3x3x3x3x3• Common wrong answer: 21

Problem 5

• You and your friends order a pizza with 8 slices. One of the slices, for some obscure reason, has anchovies. You *HATE* anchovies. Before you get to the pizza, each of your 7 friends takes a single slice, apparently at random. What is the sample space of this meal?

• Correct answer: 8*7*6*5*4*3*2*1• Common wrong answers: 8, 8^7– Why are these wrong?

Probability Calculation

Problem 6

• You and your friends order a pizza with 8 slices. One of the slices, for some obscure reason, has anchovies. You *HATE* anchovies. Before you get to the pizza, each of your 7 friends takes a single slice, apparently at random. What is the probability that you end up with anchovies?

• Correct answer: 1/8• Common wrong answer: 1/40320

Problem 8

• You and your friends order a pizza with 8 slices. One of the slices, for some obscure reason, has anchovies. You *HATE* anchovies. Before you get to the pizza, 2 of your 7 friends take a single slice, apparently at random. They both did not get anchovies. What is the probability that you end up with anchovies?

• Correct answer: 0%– Why?

• Common wrong answers: 1/6, 1/5

Problem 11

• 21% of Americans went to an art gallery or museum in the last year. 23% of Americans went to a baseball game last year. 4% of Americans went to both (I totally made that last one up). What percent of americans went to a art gallery OR a museum OR a baseball game last year?

• What’s the answer?

Problem 11

• 21% of Americans went to an art gallery or museum in the last year. 23% of Americans went to a baseball game last year. 4% of Americans went to both (I totally made that last one up). What percent of americans went to a art gallery OR a museum OR a baseball game last year?

• Correct answer: 40%• Common wrong answers: 44%, 48%

Problem 14

• The probability that a New Yorker takes the subway is 37%. Let's say that the probability that a New Yorker goes to a museum or gallery each year is 34%. The probability that a New Yorker goes to a museum or gallery each year, if they take the subway, is 41%. What is the probability that a New Yorker takes the subway AND goes to a museum or gallery each year?

• Correct answer: 15%• Common wrong answer: 41%– Why is this wrong?

Problem 14

• The probability that a New Yorker takes the subway is 37%. Let's say that the probability that a New Yorker goes to a museum or gallery each year is 34%. The probability that a New Yorker goes to a museum or gallery each year, if they take the subway, is 41%. What is the probability that a New Yorker takes the subway AND goes to a museum or gallery each year?

• Correct answer: 15%• Another common wrong answer: 13%– Why is this wrong?

Problem 15

• The probability that a student passes "Intro to Basketweaving" is 72%. The probability that a student passes "Intro to Psychoceramics" is 21% if they fail "Intro to Basketweaving", and is 94% if they pass "Intro to Basketweaving". What is the probability that a student passes both classes?

• Why is the correct answer 68% rather than 20%?

Combinations and Permutations

Problem 10

• Professor Padeiro owns 7 computers. She wants to take 3 of them with her on a trip. How many combinations of computers could she take?

• What is the correct answer?

Problem 10

• Professor Padeiro owns 7 computers. She wants to take 3 of them with her on a trip. How many combinations of computers could she take?

• What is the correct answer?=35

Problem 10

• Professor Padeiro owns 7 computers. She wants to take 3 of them with her on a trip. How many combinations of computers could she take?

• What is the correct answer?=35

• Common wrong answer = 210

What we didn’t cover last time

General Multiplication Rule

• What if A and B are independent?

• Like two flips of a fair coin

General Multiplication Rule

• What if A and B are independent?

• Like two flips of a fair coin

• In that case, P(B|A)=P(B)

Multiplication Rule For Independent Events

• If A and B are independent

Multiplication Rule For Independent Events

• If A and B are independent

• This is the rule we were using, when we computed…– Multiple coin flips– Multiple rolls of a 6-sided die

Any last comments or questions for the day?

Today

• Ch. 4.7 in Mendenhall, Beaver, & Beaver

Today

• Bayes’ Rule

Today

• Bayes’ Rule

• Also (more frequently) called– Bayes’ Theorem– Bayes’ Law

Very Important Rule in Statistics

• Underpins Bayesian Statistics– One of the two core branches of Statistics– Not a focus of this class, which is focused on the

other branch, Frequentist statistics

• Underpins major areas of Data Mining and Machine Learning– Including core methods of educational data

mining, such as Bayesian Knowledge Tracing

Classic Version

𝑃 ( 𝐴|𝐵 )=𝑃 (𝐵|𝐴 )𝑃 (𝐴)

𝑃 (𝐵)

Let’s apply it

• P(B|A) = 0.4• P(A) = 0.7• P(B) = 0.3• P(A|B)=?

Let’s apply it

• P(B|A) = 0.4• P(A) = 0.7• P(B) = 0.3• P(A|B)= 0.93

Example

• Maria is using Reasoning Mind software to learn mathematics

• If she knows a skill, there’s a 60% chance she gets the problem right

• There’s a 40% chance she knows the skill• There’s a 70% chance she gets the problem right

• What’s the probability that if she gets the problem right, she knows the skill?

A = knows skill, B = gets problem right

• Maria is using Reasoning Mind software to learn mathematics

• If she knows a skill, there’s a 60% chance she gets the problem right

• There’s a 40% chance she knows the skill• There’s a 70% chance she gets the problem right

• What’s the probability that if she gets the problem right, she knows the skill?

A = knows skill, B = gets problem right

• Maria is using Reasoning Mind software to learn mathematics

• If she knows a skill, there’s a 60% chance she gets the problem right. P(B|A)

• There’s a 40% chance she knows the skill. P(A)• There’s a 70% chance she gets the problem right. P(B)

• What’s the probability that if she gets the problem right, she knows the skill?

Example

• Maria is using Reasoning Mind software to learn mathematics

• If she knows a skill, there’s a 60% chance she gets the problem right

• There’s a 40% chance she knows the skill• There’s a 70% chance she gets the problem right

• What’s the probability that if she gets the problem right, she knows the skill?– 34.2%

Be careful…

• About what your A is• And what your B is

Do this one in pairs

• Dan is taking an online course using the Purdue Course Signals platform, that detects when a student is at-risk of failing the course

• If he is at-risk, there’s a 80% chance he skips the first homework• There’s a 50% chance he is at-risk• There’s a 60% chance he skips the first homework

• What’s the probability that if he skips the first homework, he is at-risk?

Do this one in pairs

• Dan is taking an online course using the Purdue Course Signals platform, that detects when a student is at-risk of failing the course

• If he is at-risk, there’s a 80% chance he skips the first homework

• There’s a 50% chance he is at-risk• There’s a 60% chance he skips the first homework

• What’s the probability that if he skips the first homework, he is at-risk?– 66.7%

Do this one in pairs

• The Yonkers College of Holistic Phrenology just had an unspeakably embarrassing scandal

• Historically, among colleges of this type that are denied accreditation, 20% have had a recent scandal

• There’s a 4% chance of a college of this type being denied accreditation

• There’s a 1% chance of a college of this type having a scandal

• Given that this college just had a scandal, what is the probability it will be denied accreditation?

Do this one in pairs

• The Yonkers College of Holistic Phrenology just had an unspeakably embarrassing scandal

• Historically, among colleges of this type that are denied accreditation, 20% have had a recent scandal

• There’s a 4% chance of a college of this type being denied accreditation

• There’s a 1% chance of a college of this type having a scandal

• Given that this college just had a scandal, what is the probability it will be denied accreditation?– 80%

Questions? Comments?

Where did Bayes’ Rule come from?

Where did Bayes’ Rule come from?

Where did Bayes’ Rule come from?

P(Actually Bayes) = 0.1

Where did Bayes’ Rule come from?

• Simple to derive

Recall General Multiplication Rule

Note Also That

Which Means That

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

Divide Both Sides by P(B)

Questions? Comments?

This was the Classic Version of Bayes’ Rule

• When people talk about Bayes’ Rule, they generally mean this version

This was the Classic Version of Bayes’ Rule

• When people talk about Bayes’ Rule, they generally mean this version

• There is also a General Version seen in the book

Before we get there…

• Law of Total Probability

Law of Total Probability

Example

• I’m wondering whether a student will quit the problem set before completing

• The student might be (exhaustively, mutually exclusively)– Working in System Appropriately– Gaming the System– Getting Answers From a Friend

Example

• I’m wondering whether a student will quit the problem set before completing

• The student might be (exhaustively, mutually exclusively)– P(Working in System Appropriately) = 0.7– P(Quit | WSA) = 0.02

– P(Gaming the System) = 0.1– P(Quit | GS) = 0.01

– P(Getting Answers From a Friend) = 0.2– P(Quit | GAFF) = 0.3

Note that P(WSA)+P(GS)+P(GAFF) = 1

• I’m wondering whether a student will quit the problem set before completing

• The student might be (exhaustively, mutually exclusively)– P(Working in System Appropriately) = 0.7– P(Quit | WSA) = 0.02

– P(Gaming the System) = 0.1– P(Quit | GS) = 0.01

– P(Getting Answers From a Friend) = 0.2– P(Quit | GAFF) = 0.3

Note that P(WSA)+P(GS)+P(GAFF) = 1If this isn’t true,

it’s not exhaustive or not mutually exclusive

• I’m wondering whether a student will quit the problem set before completing

• The student might be (exhaustively, mutually exclusively)– P(Working in System Appropriately) = 0.7– P(Quit | WSA) = 0.02

– P(Gaming the System) = 0.1– P(Quit | GS) = 0.01

– P(Getting Answers From a Friend) = 0.2– P(Quit | GAFF) = 0.3

Example

• P(Quit) = P(Working in System Appropriately) * P(Quit | WSA) +P(Gaming the System) * P(Quit | GS) +P(Getting Answers From a Friend) * P(Quit | GAFF)

Example

• P(Quit) = P(Working in System Appropriately) * P(Quit | WSA) +P(Gaming the System) * P(Quit | GS) +P(Getting Answers From a Friend) * P(Quit | GAFF)

• P(Quit) = 0.7*0.02+ 0.1*0.01 + 0.2*0.3

Example

• P(Quit) = P(Working in System Appropriately) * P(Quit | WSA) +P(Gaming the System) * P(Quit | GS) +P(Getting Answers From a Friend) * P(Quit | GAFF)

• P(Quit) = 0.7*0.02+ 0.1*0.01 + 0.2*0.3 = 0.014+0.001+0.06 = 0.075

Do this one in pairs

• I’m wondering whether my kiddo has stomach flu

• The kiddo might be (exhaustively, mutually exclusively)– P(Puking) = 0.05– P(Stomach Flu | Puking) = 0.4

– P(Not Puking) = 0.95– P(Stomach Flu | Not Puking) = 0.01

• Your answer?

Questions? Comments?

If we take the law of total probability

• And compare it to the multiplied probability coming out of one event…

• We get…

Extended Form of Bayes’ Rule

• What the book simply refers to as Bayes’ Rule(but most people don’t)

Extended Form of Bayes’ Rule

• ) =

• A is an event• S1 through Sk represent a group of mutually

exclusive and exhaustive sub-populations

Example

• In ASSISTments, on the first attempt at problem P, a student can request a hint, give a common incorrect answer, give an uncommon incorrect answer, or give a correct answer

• P(hint) = 0.3• P(common incorrect) = 0.2• P(uncommon incorrect) = 0.4• P(correct) = 0.1

Example

• P(hint) = 0.3• P(common incorrect) = 0.2• P(uncommon incorrect) = 0.4• P(correct) = 0.1

• P(knows skill | hint) = 0.1• P(knows skill | common incorrect) = 0.2• P(knows skill | uncommon incorrect) = 0.1• P(knows skill | correct) = 0.7

Example

• P(hint) = 0.3• P(common incorrect) = 0.2• P(uncommon incorrect) = 0.4• P(correct) = 0.1

• P(knows skill | hint) = 0.1• P(knows skill | common incorrect) = 0.2• P(knows skill | uncommon incorrect) = 0.1• P(knows skill | correct) = 0.7

• What is P(correct | knows skill)?

Example• P(hint) = 0.3 P(S1)• P(common incorrect) = 0.2 P(S2)• P(uncommon incorrect) = 0.4 P(S3)• P(correct) = 0.1 P(S4)

• P(knows skill | hint) = 0.1 P(A|S1)• P(knows skill | common incorrect) = 0.2 P(A|S2)• P(knows skill | uncommon incorrect) = 0.1 P(A|S3)• P(knows skill | correct) = 0.7 P(A|S4)

• What is P(correct | knows skill)? P(S4|A)

• P(hint) = 0.3 P(S1)• P(common incorrect) = 0.2 P(S2)• P(uncommon incorrect) = 0.4 P(S3)• P(correct) = 0.1 P(S4)

• P(knows skill | hint) = 0.1 P(A|S1)• P(knows skill | common incorrect) = 0.2

P(A|S2)• P(knows skill | uncommon incorrect) = 0.1 P(A|S3)• P(knows skill | correct) = 0.7 P(A|S4)

• What is P(correct | knows skill)? P(S4|A)

• ) =

• P(hint) = 0.3 P(S1)• P(common incorrect) = 0.2 P(S2)• P(uncommon incorrect) = 0.4 P(S3)• P(correct) = 0.1 P(S4)

• P(knows skill | hint) = 0.1 P(A|S1)• P(knows skill | common incorrect) = 0.2 P(A|S2)• P(knows skill | uncommon incorrect) = 0.1 P(A|S3)• P(knows skill | correct) = 0.7 P(A|S4)

• What is P(correct | knows skill)? P(S4|A)

• ) =

• P(hint) = 0.3 P(S1)• P(common incorrect) = 0.2 P(S2)• P(uncommon incorrect) = 0.4 P(S3)• P(correct) = 0.1 P(S4)

• P(knows skill | hint) = 0.1 P(A|S1)• P(knows skill | common incorrect) = 0.2 P(A|S2)• P(knows skill | uncommon incorrect) = 0.1 P(A|S3)• P(knows skill | correct) = 0.7 P(A|S4)

• What is P(correct | knows skill)? P(S4|A)

• ) =

• P(hint) = 0.3 P(S1)• P(common incorrect) = 0.2 P(S2)• P(uncommon incorrect) = 0.4 P(S3)• P(correct) = 0.1 P(S4)

• P(knows skill | hint) = 0.1 P(A|S1)• P(knows skill | common incorrect) = 0.2 P(A|S2)• P(knows skill | uncommon incorrect) = 0.1 P(A|S3)• P(knows skill | correct) = 0.7 P(A|S4)

• What is P(correct | knows skill)? P(S4|A)

• ) = =0.39

Comments? Questions?

Any last comments or questions for the day?

Upcoming Classes

• 2/23 Discrete Random Variables and Their Probability Distributions– Ch. 4-8

• 2/25 Binomial Probability Distribution– Ch. 5-2– HW 4 due

Homework 4

• Due in 7 days• In the ASSISTments system

Questions? Comments?