February 16 2015 In the last class We started Ch 44 in Mendenhall Beaver amp Beaver Today Ch 4446 in Mendenhall Beaver amp Beaver Today Sampling without Replacement Permutations ID: 739165
Download Presentation The PPT/PDF document "HUDM4122 Probability and Statistical Inf..." is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.
Slide1
HUDM4122Probability and Statistical Inference
February 16, 2015Slide2
In the last class
We started Ch. 4.4 in Mendenhall, Beaver, & BeaverSlide3
Today
Ch. 4.4-4.6 in Mendenhall, Beaver, & BeaverSlide4
Today
Sampling without Replacement
Permutations
Combinations
Independence
Conditional ProbabilitySlide5
We ended last class with this problem
I call a radio station, where they make me pick a number between 1 and 10
If I get today’s winning number, I get free tickets to hear Justin Bieber (oh lucky me)
Let’s say I call 5 days in a row
What is the probability I get tickets on exactly one day? (my daughter will still be excited)Slide6
Solution A (professor)
= 0.40951
Slide7
Solution B (class)
= 0.32805
Slide8
These represent two different problems
One (my solution) is sampling without replacement
The other is the sum of five independent events
So which one is right?Slide9
Let’s first compute the sample space
I call a radio station, where they make me pick a number between 1 and 10
I
call 5 days in a row
10*10*10*10*10 = 100,000Slide10
Let’s first compute the sample space
I call a radio station, where they make me pick a number between 1 and 10
I
call 5 days in a row
10*10*10*10*10 = 100,000
A.K.A. too many to list outSlide11
Let’s first compute the sample space
I call a radio station, where they make me pick a number between 1 and 10
I
call 5 days in a row
10*10*10*10*10 = 100,000
A.K.A. too many to list out
Or is it?Slide12
bieber-tix-example.xlsxSlide13
bieber-tix-example.xlsx
0.32805Slide14
So, the professor was wrongSlide15
So, the professor was wrong
It turns out sleep deprivation
is
bad for cognitionSlide16
So, the professor was wrong
It turns out sleep deprivation
is
bad for cognition
Don’t try this on your midtermSlide17
So why was this correct?
Slide18
5 days to win 1 ticket
CXXXX
XCXXX
XXCXX
XXXCX
XXXXC
5 daysSlide19
In each of 5 days,1 answer where right
5 days
Correct answerSlide20
And 4 more days where wrong; and there are 9 wrong answers
5 cases
Correct answer
Wrong answers
Wrong daysSlide21
Each day is independent from other days – that’s why this is the correct math
5 cases
Correct answer
Wrong answers
Wrong daysSlide22
Questions? Comments?Slide23
The sample space for multi-stage data collection can be calculated using
The
Extended
mn
ruleSlide24
The Extended mn rule
Let’s say you have k
stages of your data
collectionSlide25
The Extended mn rule
Let’s say you have k
stages of
data collection
Unlike the book, I don’t call it an
experiment
, because that term is usually given a more specific meaning by researchersSlide26
The Extended mn rule
Let’s say you have k
stages of
data collection
And there are n
1
ways to accomplish the first stage
And n
2
ways to accomplish the
2nd stageAnd n3 ways to accomplish the 3rd stageAnd nk ways to accomplish the kth stageThen the sample space = n1 * n2 * n3 … * nkSlide27
Any questions about theExtended mn
rule?
Let’s say you have k
stages of
data collection
And there are n
1
ways to accomplish the first stage
And n
2
ways to accomplish the 2nd stageAnd n3 ways to accomplish the 3rd stageAnd nk ways to accomplish the kth stageThen the sample space = n1 * n2 * n3 … * nkSlide28
Note that there doesn’t have to be the same probability in each stage!Slide29
This can come in useful in cases that are not truly independent
Unlike
the Justin Bieber exampleSlide30
Independence
Two events A and B are
independent
if A does not affect B and B does not affect ASlide31
Which of these are independent?
A
B
Flipping
a fair coin
Flipping same fair coin againSlide32
Which of these are independent?
A
B
Flipping
a fair coin
Flipping same fair coin again
Flipping
a biased coin
Flipping
same biased coin againSlide33
Which of these are independent?
A
B
Flipping
a fair coin
Flipping same fair coin again
Flipping
a biased coin
Flipping
same biased coin again
Bob parties
late night before midtermBob falls asleep during midtermSlide34
Which of these are independent?
A
B
Flipping
a fair coin
Flipping same fair coin again
Flipping
a biased coin
Flipping
same biased coin again
Bob parties
late night before midtermBob falls asleep during midtermBob’s grade on midtermBob’s grade on finalSlide35
Which of these are independent?
A
B
Flipping
a fair coin
Flipping same fair coin again
Flipping
a biased coin
Flipping
same biased coin again
Bob parties
late night before midtermBob falls asleep during midtermBob’s grade on midtermBob’s grade on finalBob disrupts classBob gets expelledSlide36
Which of these are independent?
A
B
Flipping
a fair coin
Flipping same fair coin again
Flipping
a biased coin
Flipping
same biased coin again
Bob parties
late night before midtermBob falls asleep during midtermBob’s grade on midtermBob’s grade on finalBob disrupts classBob gets expelledBob gets expelledBob takes job at McDonald’sSlide37
Which of these are independent?
A
B
Flipping
a fair coin
Flipping same fair coin again
Flipping
a biased coin
Flipping
same biased coin again
Bob parties
late night before midtermBob falls asleep during midtermBob’s grade on midtermBob’s grade on finalBob disrupts classBob gets expelledBob gets expelledBob takes job at McDonald’sBob takes job at McDonald’sBob wins lotterySlide38
Which of these are independent?
A
B
Flipping
a fair coin
Flipping same fair coin again
Flipping
a biased coin
Flipping
same biased coin again
Bob parties
late night before midtermBob falls asleep during midtermBob’s grade on midtermBob’s grade on finalBob disrupts classBob gets expelledBob gets expelledBob takes job at McDonald’sBob takes job at McDonald’sBob wins lotteryBob wins lotteryBob becomes ill due to congenital heart problemSlide39
Example of probability calculation with non-independent events
Let’s say that I invite 6 friends over to play
Beer HunterSlide40
This can come in useful in cases that are not truly independent
Let’s say that 6 friends decide to play Beer Hunter
Rules are
6 cans of beer
1 violently shaken before playing and then shuffled
Each person chooses a can and opens itSlide41
Initial Sample Space = 6
1 Bad outcome
5 Perfectly fine outcomes
If you don’t like beer, imagine it’s root beerSlide42
Probability of bad outcome
The probability of a bad outcome for friend 1 is 1/6Slide43
Probability of bad outcome
The probability of a bad outcome for friend 1 is 1/6
But if friend 1 comes out OK
The probability of a bad outcome for friend 2 is 1/5, not 1/6!Slide44
Probability of bad outcome
The probability of a bad outcome for friend 1 is 1/6
But if friend 1 comes out OK
The probability of a bad outcome for friend 2 is 1/5, not 1/6!
Does everyone see why?Slide45
Probability of bad outcome
The probability of a bad outcome for friend 1 is 1/6
But if friend 1 comes out OK
The probability of a bad outcome for friend 2 is 1/5, not 1/6!
Does everyone see why?
Friend 1 already opened a beer can, and it went ok
This only leaves 5 closed beer cansSlide46
Probability of bad outcome
If friend 2 comes out OK
The probability of a bad outcome for friend 3 is 1/4Slide47
Probability of bad outcome
If friend 2 comes out OK
The probability of a bad outcome for friend 3 is 1/4
If friend 3 comes out OK
The probability of a bad outcome for friend 4 is 1/3Slide48
Probability of bad outcome
If friend 4 comes out OK
The probability of a bad outcome for friend 5 is 1/2Slide49
Probability of bad outcome
If friend 4 comes out OK
The probability of a bad outcome for friend 5 is 1/2
If friend 5 comes out OKSlide50
Probability of bad outcome
If friend 4 comes out OK
The probability of a bad outcome for friend 5 is 1/2
If friend 5 comes out OK
Friend 6 will need to get a clean shirtSlide51
True sample space
6 *5 * 4 * 3 * 2 * 1
This is called
sampling without replacementSlide52
Any questions?Slide53
Now you do an example
In pairsSlide54
Now you do an exampleLet’s say I’m a roadie for the band Van HalenSlide55
Now you do an exampleLet’s say I’m a roadie for the band Van Halen
Professors need to moonlight to make ends meet in this citySlide56
Now you do an exampleLet’s say I’m a roadie for the band Van Halen
They have a “no brown M&M’s” clause in their contract, and if any of the four members get a brown M&M, I’m firedSlide57
Now you do an exampleLet’s say I’m a roadie for the band Van Halen
They have a “no brown M&M’s” clause in their contract, and if any of the four members get a brown M&M, I’m fired
I’ve just handed them a bowl with 20 M&Ms, including one brown M&M
Each band member takes 1 M&M without lookingSlide58
Now you do an example
Let’s say I’m a roadie for the band Van Halen
They have a “no brown M&M’s” clause in their contract, and if any of the four members get a brown M&M, I’m fired
I’ve just handed them a bowl with 20 M&Ms, including one brown M&M
Each band member takes 1 M&M without
looking
What is the sample space?
What is the probability I get fired? Slide59
Questions? Comments?Slide60
Another example: permutations
An application of sampling without replacement
How many orderings can you have between a certain number of objects?Slide61
Example
Let’s say that I’m redecorating my office in preparation for a visit from a funder from the US army (“Bob”), a funder from the National Science Foundation (“Janet”), and a funder from the US Department of Education (“Ed”)
I want to place Bob’s book, Janet’s book, and Ed’s book in a place of honor next to my desk
How many different orders can I put their books in?Slide62
Example
The first book could be Bob’s, Janet’s, or Ed’s
If the first book is Bob’s, the second book can only be Janet’s or Ed’s
If the first book is Bob’s,
and the
second book
is Janet’s, then the third book can only be Ed’s
We’re back to the same math of 3*2*1Slide63
Any questions?Slide64
Formal equations
The sample space for n stages, sampling without replacement, is
n * (n-1) * (n-2) * (n-3) * (n-4) until (n-k)=1
This is written n!
Pronounced “n factorial”Slide65
Formal equations
The number of permutations for n objects, taking all of them together, is
Still n!
n
* (n-1) * (n-2) * (n-3) * (n-4) until (n-k)=1Slide66
Do it yourself
What is the number of permutations for 4 objects?
What is the number of permutations for
6
objects
?
What is the number of permutations for
10
objects?Slide67
Do it yourself
What is the number of permutations for 4 objects?
4*3*2*1=24
What is the number of permutations for
6
objects
?
6*5*4*3*2*1=720
What is the number of permutations for
10
objects
?10*9*8*7*6*5*4*3*2*1= 3,628,800Slide68
Ryan’s daughter suggests
“Daddy, why don’t we try organizing all the books on your bookshelves in every possible way?”
I own approximately 600 books
Is this a good idea?Slide69
Questions? Comments?Slide70
More general case
If we only want to pick r objects out of the n total objects, the equation becomes
Slide71
Using general case equation
If I want to find out how many orderings of 2 books I can get from 6 total books
n!/(
n-r)!
6!/(
6-2)!
6!/4!
720/24
30 possible orderingsSlide72
Using general case equation
If I want to find out how many orderings of 4 books I can get from 6 total books
n!/(
n-r)!
6!/(
6-4)!
6!/2!
720/2
360 possible orderingsSlide73
Any questions?Slide74
Related problem: Combinations
If we don’t care about order, but only want to know how many combinations of items we can getSlide75
Combination formula
The number of combinations of r objects out of n total objects is
Slide76
Example
I have five friends, and three tickets to see Ferrari Truck
How many combinations of friends could I potentially bring?Slide77
Example
I have five friends, and three tickets to see Ferrari Truck
How many combinations of friends could I potentially bring?
=
=
=
=
= 10
Slide78
Example
I have 600 books, and want to take 3 books on a ridiculously long flight to the First Uzbekistani Conference on Educational Data Mining
How many combinations of
books could
I potentially bring?Slide79
Example
I have 600 books, and want to take 3 books on a ridiculously long flight to the First Uzbekistani Conference on Educational Data Mining
How many combinations of
books could
I potentially bring
?
=
=
=
=
35.8 million Slide80
Your turn
Peter’s Pizzeria has 6 toppings, and a 2-topping special
How many combinations of toppings could you get, and have the special? Slide81
Questions?Slide82
An application
In my son’s play group, he has 6 playmates
5 friends and 1
frenemy
What is the probability that on a specific playdate with 2 friends, it will involve the
frenemy
?Slide83
Can be written as
Number of playdates that involve
frenemy
= 5
Frenemy
plus each of 5 friends
Total number of combinations (2 of 6)
Slide84
Can be written as
Number of playdates that involve
frenemy
= 5
Frenemy
plus each of 5 friends
Total number of combinations (2 of 6) = 15
5/15 = 1/3Slide85
Any questions?Slide86
Conditional Probability
Let’s take two non-independent events, A and B
P(A | B) =
Probability of A,
Given that we know that B occurredSlide87
Conditional Probability
Let’s take two non-independent events, A and B
P(A | B) =
Probability of A,
Given that we know that B occurred
Note that this tells us
nothing
about
P(A | ~B)
P(A) overallSlide88
General Multiplication Rule
Probability of A and B equals
Probability of A
Multiplied by
Probability of B, given ASlide89
General Multiplication Rule
Probability of A and B equals
Probability of A
Multiplied by
Probability of B, given A
Formally
Slide90
Example
P(Q) = 0.2
P(R|Q) = 0.7
P(Q
R) = ?
Slide91
Example
P(Q) = 0.2
P(R|Q) = 0.7
P(Q
R) = 0.14
Slide92
You try it
P(F)
=
0.7
P(G|F)
=
0.5
P(F
G)
=
? Slide93
You try it
P(F)
=
0.7
P(G|F)
=
0.5
P(F
G)
=
0.35 Slide94
You try it
P(X)
=
0.3
P(X|Y)
=
0.9
P(X
Y)
=
? Slide95
You try it
P(X)
=
0.3
P(X|Y)
=
0.9
P(X
Y)
=
?Impossible to calculate from information given Slide96
A Concrete Example
P(Bob parties late, night before exam) = 0.5
P(Bob does badly on exam | parties late) = 0.7
P(Bob does badly on exam |
~parties
late) =
0.2
What is the probability that Bob parties late and does badly? Slide97
A Concrete Example
P(Bob parties late, night before exam) = 0.5
P(Bob does badly on exam | parties late) = 0.7
P(Bob does badly on exam |
~parties
late) =
0.2
What is the probability that Bob parties late and does badly?
0.35Slide98
Conditional Probability Formula
A mathematical transformation of the
General Multiplication
Rule
That rule was
Slide99
Conditional Probability Formula
If you divide both sides by P(A)
Which resolves to
Slide100
Conditional Probability Formula
P(B|A) =
Slide101
Conditional Probability Formula
P(B|A) =
Note that P(A) can’t equal 0, or you’re dividing by 0…
Slide102
Example
P(B|A) =
P(Bob parties late, night before exam) = 0.5
P(Bob does badly on exam AND parties late) = 0.35
What is the probability that does badly, given that he parties late?
Slide103
Example
P(B|A) =
P(Bob parties late, night before exam) = 0.5
P(Bob does badly on exam AND parties late) = 0.35
What is the probability that does badly, given that he parties late?
0.7
Slide104
You try it
P(B|A) =
P(
S
tudent is from a wealthy family)
=
0.25
P(Student goes to college AND comes from wealthy family)
=
0.21
What is the probability that
a student goes to college, given that he/she comes from a wealthy family? Slide105
You try it
P(B|A) =
P(
S
tudent is from a wealthy family)
=
0.25
P(Student goes to college AND comes from wealthy family)
=
0.21
What is the probability that
a student goes to college, given that he/she comes from a wealthy family?0.84 Slide106
What if we want to determine
P(B|A) =
P(
S
tudent is from a wealthy family)
=
0.25
P(Student goes to college AND comes from wealthy family)
=
0.21
What is the probability that
a student comes from a wealthy family, given that he/she went to college? Slide107
What if we want to determine
P(B|A) =
P(
S
tudent is from a wealthy family)
=
0.25
P(Student goes to college AND comes from wealthy family)
=
0.21
What is the probability that
a student comes from a wealthy family, given that he/she went to college?We can’t tell, using this formula… Slide108
Upcoming Classes
2/18 Bayes Theorem
Ch. 4-7
HW3 due
2/23
Discrete Random Variables and Their Probability
Distributions
Ch. 4-8Slide109
Homework 3
Due in 2 days
In the
ASSISTments
systemSlide110
Questions? Comments?