stat 155, section 2, last time probability theory foundations of probability –events, sample space...
TRANSCRIPT
Stat 155, Section 2, Last Time
• Probability Theory
• Foundations of Probability– Events, Sample Space
– Probability Function
• Simple Random Sampling (count samples)
• Big Rules of Probability:– Not Rule ( 1 – P{opposite})– Or Rule
Reading In Textbook
Approximate Reading for Today’s Material:
Pages 259-271 , 311-323
Approximate Reading for Next Class:
Pages 277-286, 291-305
Midterm I
Coming up: Tuesday, Feb. 27
Material: HW Assignments 1 – 6
Extra Office Hours:
Mon. Feb. 26, 8:30 – 12:00, 2:00 – 3:30
(Instead of Review Session)
Bring Along:
1 8.5” x 11” sheet of paper with formulas
Midterm I
How will I test for Excel skills?
• No computers allowed
• Fill out menus with pencil
• Write Excel Commands with pencil
Put Excel commands (& details) on your:
1 8.5” x 11” sheet of paper with formulas
Midterm IExample: What fraction of N(1,2) population
is smaller than 0?
Could ask you to fill out menu:
You write:
0
1
2
true
Midterm IExample: What fraction of N(1,2) population
is smaller than 0?
Above results in:
Note:
“command
line”
Midterm IExample: What fraction of N(1,2) population
is smaller than 0?
So could ask you to simply write:
=NORMDIST(0,1,2,TRUE)
Note that you need to know:
• Excel function names
• Which arguments go where
So put all these on your sheet of formulas
(suggestion: make early & use to study)
Big Rules of Probability
1. Not Rule: P{not A} = 1 – P{A}
2. Or Rule:
P{A or B} = P{A} + P{B} – P{A and B}
Third rule?
Symbolic logic is based on:
and, or, not
How about a rule for and?
Big Rules of Probability
• Now head towards a rule for “and”
• Needs a new concept:
Conditional Probability
Idea: If event A is known to have occurred,
what is chance of B?
Note: “knowing A” means sample space is restricted to A
Conditional Probability
E.g. Roll a die, A = {even}, B = {1,2,3}
P{B, when A is known} = ???
(i.e. Somebody rolls, and only tells you
“even”. Note “<= 3” is no longer 50-50,
Since fewer even #s are <= 3)
Conditional Probability
E.g. Roll a die, A = {even}, B = {1,2,3}
P{B, when A is known} = ???
Try “equally likely”:
CAREFUL: This is wrong!!!
Problem: for B, should not include 1 or 3,
since they are not even
133
##
AinBin
Conditional Probability
E.g. Roll a die, A = {even}, B = {1,2,3}
P{B, when A is known} = ???
Correct Answer:
Makes sense, since chance should go down
from ½.
31
#,#
AinAinarethatBin
Conditional Probability
General definition:
Probability of B given A =
Next, by multiplying by P{A}, get and rule of
probability
}{
}&{
#
&#}|{
AP
ABP
Ain
ABinABP
And Rule of Probability
Big Rule III:
P{A & B} = P{A|B} P{B} = P{B|A} P{A}
Memory trick: like “canceling fractions”, but
make bar vertical, not a fraction
Note: 2 ways to do this. Good strategy: look
at both, as one is often easier.
The And Rule of Probability
HW:
4.89, 4.91a
4.95 (see 4.92)
And now for something completely different
Recall
Distribution
of majors of
students in
this course:
Stat 155, Section 2, Majors
0
0.05
0.1
0.15
0.2
0.25
0.3
0.35
0.4
Busine
ss /
Man
.
Biolog
y
Public
Poli
cy /
Health
Pharm
/ Nur
sing
Jour
nalis
m /
Comm
.
Env. S
ci.
Other
Undec
ided
Fre
qu
ency
And now for something completely different
Three nurses died & went to heaven where they were met at the Pearly Gates by St. Peter.
And now for something completely different
To the first, he asked, "What did you do on Earth and why should you go to heaven?" "I was a nurse in an inner city hospital," she replied. "I worked to bring healing and peace to the poor suffering city children." "Very noble," said St. Peter. "You may enter." And in through the gates she went.
And now for something completely different
To the next, he asked the same question, "So what did you do on Earth?" "I was a nurse at a missionary hospital in Africa," she replied. "For many years, I worked with a skeleton crew of doctors and nurses who tried to reach out to as many peoples and tribes with a hand of healing and with a message of God's love." "How touching," said St. Peter. "You too may enter." And in she went.
And now for something completely different
He then came to the last nurse, to whom he asked, "So, what did you do back on Earth?" After some hesitation, she explained, "I was just a nurse at an H.M.O." St. Peter pondered this for a moment, and then said, "Okay, you may enter also." "Whew!" said the nurse. "For a moment there, I thought you weren't going to let me in."
And now for something completely different
"Oh, you can come in," said St. Peter, "but you can only stay for three days..."
Big Rules of Probability
Example illustrating power (and use) of rules:
Toss a Coin:
if H take a ball from I: R R G G G
if T take a ball from II: R R G
Now study progressively harder problems…
Balls in Urns Example
H R R G G G T R R G
E.g. A:
P{R | H} = 2/5
(chance of R, if know got H)
Simple “equally likely” calculation (just
counting) works here
Related HW
HW: C13
A company makes 40% of its cars at factory A, and the rest at factory B. Factory A produces 10% lemons, and Factory B produces 5% lemons. A car is chosen at random. What is the probability that:
(a) It came from Factory A? (0.4)
(b) It is a lemon, if it came from Fact. A? (0.1)
Balls in Urns Example
H R R G G G T R R G
E.g. B: P{R & H} = ???
Try simple counting:
P{R & H} = ???
Caution: This is wrong!!!
Reason: balls are not equally likely.
41
8
2
#
#
total
HinR
Balls in Urns Example
H R R G G G T R R G
E.g. B: P{R & H} = ???
Correct Answer:
P{R & H} = P{H | R} P{R} (OK, but hard)
= P{R | H} P{H} = (2/5)(1/2) = 1/5
Note: < ¼ (from wrong answer above)
Related HW
HW: C13
(c) It is a lemon, from Factory A? (0.04)
(think carefully about contrast with (b))
Balls in Urns Example
H R R G G G T R R G
E.g. C: P{R} = ???
Try simple counting:
P{R} = ???
Caution: This is wrong!!!
Reason: again balls are not equally likely.
21
84
## totalR
Balls in Urns Example
H R R G G G T R R G
E.g. C: P{R} = ???
Note: now expect > ½, since R’s in II are
more likely (thus get more weight)
Need to take which urn into account, so write
event in terms of the urn ball came from
Balls in Urns Example
H R R G G G T R R G
E.g. C: Correct Answer:
P{R} = P{(R & H) or (R & T)} = (“expand”)
= P{R & H} + P{R & T} – 0 (or Rule)
= 1/5 + P{R | T} P{T} = (from B)
= 1/5 + (2/3)(1/2) = 8/15
Note: slightly > ½ (as expected)
Related HW
HW: C13
(d) It is a lemon? (0.07)
Balls in Urns Example
H R R G G G T R R G
E.g. D: P{H | R} = ???
• Saved for last, since this is hardest
• Although only “turn around” of e.g. A
• This is common: One Cond. Prob. much
easier than the reverse
Balls in Urns Example
H R R G G G T R R G
E.g. D: P{H | R} =
Makes sense: if see R, less likely from H
}{}|{}{}|{
}{}|{
}{
}&{
TPTRPHPHRP
HPHRP
RP
RHP
83
533
21
32
21
52
21
52
Related HW
HW: C13
(e) It came from Factory A, if it is a lemon? (4/7)
4.103
4.105
Plotting Bivariate Data
Recall
Toy Example:
(1,2)
(3,1)
(-1,0)
(2,-1)
Toy Scatterplot, Separate Points
-1.5
-1
-0.5
0
0.5
1
1.5
2
2.5
-2 -1 0 1 2 3 4
x
y
And now for something completely different
Viewing Higher Dimensional Data:
• Extend to higher dimensions
• E.g. replace pairs by triples
• Make “3-d scatterplot”
• As “points in space”
• Think about “point cloud”
And now for something completely different
Toy
3-d
data
set:
And now for something completely different
High
Light
One
Point
And now for something completely different
X
Coor
of
High
Light
And now for something completely different
Y
Coor
of
High
Light
And now for something completely different
Z
Coor
of
High
Light
And now for something completely different
Proj-
ection
on
X
Axis
And now for something completely different
1-d
View:
Proj-
ection
on
X
Axis
And now for something completely different
Proj-
ection
on
Y
Axis
And now for something completely different
1-d
View:
Proj-
ection
on
Y
Axis
And now for something completely different
Proj-
ection
on
Z
Axis
And now for something completely different
1-d
View:
Proj-
ection
on
Z
Axis
And now for something completely different
Proj-
ection
on
X-Y
Plane
And now for something completely different
Proj-
ection
on
X-Y
Plane
rotated
up
And now for something completely different
Proj-
ection
on
X-Z
Plane
And now for something completely different
Proj-
ection
on
X-Z
Plane
rotated
up
And now for something completely different
Proj-
ection
on
Y-Z
Plane
And now for something completely different
Proj-
ection
on
Y-Z
Plane
rotated
up
And now for something completely different
Now
Look
At
All
Three
And now for something completely different
Put
Into
Single
Plot -
1d on
Diagn’l
And now for something completely different
Put
Into
Single
Plot -
2d off
Diagn’l
And now for something completely different
Called
Drafts-
man’s
Plot:
(study
3d
Objects
In 2d)
Recall Above Example
H R R G G G T R R G
E.g. D: P{H | R} =
Note: have “turned around” Cond. Probs…
}{}|{}{}|{
}{}|{
}{
}&{
TPTRPHPHRP
HPHRP
RP
RHP
83
533
21
32
21
52
21
52
Bayes Rule
Idea: Formal framework for turning around conditional probabilities
IF events are mutually exclusive and include everything
Set theoretically:
– intersections are empty
– union is sample space
– Called a “partition of the sample space”
kBB ,1
Bayes RuleIF events are mutually exclusive
and include everythingTHEN:
(decomposition of P{A} in terms of B’s)
Usefulness: turns around Cond. Probs.
So can write hard one in terms of easy ones
kBB ,1
}{}|{}{}|{}{}|{
}|{11
111
kk BPBAPBPBAPBPBAP
ABP
Bayes Rule
E.g. Balls & Urns, part D, above:
= Urn I (H)
= Urn II (T)
A = R (red ball)
Note: disjoint & includes everything
1B
2B
Bayes Rule Example
Disease Testing:
• Fundamental to modern medicine
• But most are not 100% accurate
• Study “Error Rate”
• Actually Error Rates, since 2 types of error
• Will see some surprises
(about turning around cond. probs.)
Disease Testing Example
Suppose 1% of population has a disease.
(fairly rare, but there are rarer diseases)
Tests are calibrated by applying to known cases:
Give test to 100 w/ Disease and 1000 Healthy
Suppose 80 have + reactions & 50 are +
What is “error rate”? (how good is the test???)
Disease Testing ExampleWhat is “error rate”?
Note: 2 types of “error”:
P{+ | H} = 50/1000 = 0.05
(Chance of healthy person called “sick”)
P{- | D} = (100 – 80) / 100 = 0.20
(Chance of sick person called “healthy”)
So “error rate” is ~ 20% or 5%?
(or something in between???)
Disease Testing ExampleCareful: We care about the opposite
conditional probabilities (turned around)
P{D | +}
I.e. IF have a + reaction
THEN what are chances of disease?
• Make much difference?
• Guess 80% or 95% (or in between)???
• Sell belongings and move to Bahamas???
Disease Testing ExampleApply Bayes Rule to turn around cond. probs.
Only ~14% !?! (what about 80% to 90%?)
HPHPDPDP
DPDPDP
|||
|
139.0)99.0)(05.0()01.0)(8.0(
)01.0)(8.0(
Disease Testing Example
Error rate only ~14% (unlikely have
disease?)
Reason 1: Rarity of disease magnifies errors
Reason 2: Test Population different from real
population
• View Bayes Rule Calculation as
adjustment for this
Bayes Rule HWC14: The workforce in a town has:
(20%, 50%, 30%)workers with
(no HS, HS-no C, C)education. Past experience indicates that
(10%, 30%, 90%)of workers with
(no HS, HS-no C, C)Education can perform a given task. Find the
probability that a randomly chosen worker:a. Can perform the task (0.44)b. Is College educated if (s)he can perform the task
(0.61)