stat 155, section 2, last time probability theory foundations of probability –events, sample space...

68
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

Upload: leonard-chapman

Post on 15-Jan-2016

220 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Stat 155, Section 2, Last Time Probability Theory Foundations of Probability –Events, Sample Space –Probability Function Simple Random Sampling (count

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

Page 2: Stat 155, Section 2, Last Time Probability Theory Foundations of Probability –Events, Sample Space –Probability Function Simple Random Sampling (count

Reading In Textbook

Approximate Reading for Today’s Material:

Pages 259-271 , 311-323

Approximate Reading for Next Class:

Pages 277-286, 291-305

Page 3: Stat 155, Section 2, Last Time Probability Theory Foundations of Probability –Events, Sample Space –Probability Function Simple Random Sampling (count

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

Page 4: Stat 155, Section 2, Last Time Probability Theory Foundations of Probability –Events, Sample Space –Probability Function Simple Random Sampling (count

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

Page 5: Stat 155, Section 2, Last Time Probability Theory Foundations of Probability –Events, Sample Space –Probability Function Simple Random Sampling (count

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

Page 6: Stat 155, Section 2, Last Time Probability Theory Foundations of Probability –Events, Sample Space –Probability Function Simple Random Sampling (count

Midterm IExample: What fraction of N(1,2) population

is smaller than 0?

Above results in:

Note:

“command

line”

Page 7: Stat 155, Section 2, Last Time Probability Theory Foundations of Probability –Events, Sample Space –Probability Function Simple Random Sampling (count

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)

Page 8: Stat 155, Section 2, Last Time Probability Theory Foundations of Probability –Events, Sample Space –Probability Function Simple Random Sampling (count

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?

Page 9: Stat 155, Section 2, Last Time Probability Theory Foundations of Probability –Events, Sample Space –Probability Function Simple Random Sampling (count

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

Page 10: Stat 155, Section 2, Last Time Probability Theory Foundations of Probability –Events, Sample Space –Probability Function Simple Random Sampling (count

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)

Page 11: Stat 155, Section 2, Last Time Probability Theory Foundations of Probability –Events, Sample Space –Probability Function Simple Random Sampling (count

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

Page 12: Stat 155, Section 2, Last Time Probability Theory Foundations of Probability –Events, Sample Space –Probability Function Simple Random Sampling (count

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

Page 13: Stat 155, Section 2, Last Time Probability Theory Foundations of Probability –Events, Sample Space –Probability Function Simple Random Sampling (count

Conditional Probability

General definition:

Probability of B given A =

Next, by multiplying by P{A}, get and rule of

probability

}{

}&{

#

&#}|{

AP

ABP

Ain

ABinABP

Page 14: Stat 155, Section 2, Last Time Probability Theory Foundations of Probability –Events, Sample Space –Probability Function Simple Random Sampling (count

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.

Page 15: Stat 155, Section 2, Last Time Probability Theory Foundations of Probability –Events, Sample Space –Probability Function Simple Random Sampling (count

The And Rule of Probability

HW:

4.89, 4.91a

4.95 (see 4.92)

Page 16: Stat 155, Section 2, Last Time Probability Theory Foundations of Probability –Events, Sample Space –Probability Function Simple Random Sampling (count

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

Page 17: Stat 155, Section 2, Last Time Probability Theory Foundations of Probability –Events, Sample Space –Probability Function Simple Random Sampling (count

And now for something completely different

Three nurses died & went to heaven where they were met at the Pearly Gates by St. Peter.

Page 18: Stat 155, Section 2, Last Time Probability Theory Foundations of Probability –Events, Sample Space –Probability Function Simple Random Sampling (count

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.

Page 19: Stat 155, Section 2, Last Time Probability Theory Foundations of Probability –Events, Sample Space –Probability Function Simple Random Sampling (count

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.

Page 20: Stat 155, Section 2, Last Time Probability Theory Foundations of Probability –Events, Sample Space –Probability Function Simple Random Sampling (count

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."

Page 21: Stat 155, Section 2, Last Time Probability Theory Foundations of Probability –Events, Sample Space –Probability Function Simple Random Sampling (count

And now for something completely different

"Oh, you can come in," said St. Peter, "but you can only stay for three days..."

Page 22: Stat 155, Section 2, Last Time Probability Theory Foundations of Probability –Events, Sample Space –Probability Function Simple Random Sampling (count

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…

Page 23: Stat 155, Section 2, Last Time Probability Theory Foundations of Probability –Events, Sample Space –Probability Function Simple Random Sampling (count

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

Page 24: Stat 155, Section 2, Last Time Probability Theory Foundations of Probability –Events, Sample Space –Probability Function Simple Random Sampling (count

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)

Page 25: Stat 155, Section 2, Last Time Probability Theory Foundations of Probability –Events, Sample Space –Probability Function Simple Random Sampling (count

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

Page 26: Stat 155, Section 2, Last Time Probability Theory Foundations of Probability –Events, Sample Space –Probability Function Simple Random Sampling (count

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)

Page 27: Stat 155, Section 2, Last Time Probability Theory Foundations of Probability –Events, Sample Space –Probability Function Simple Random Sampling (count

Related HW

HW: C13

(c) It is a lemon, from Factory A? (0.04)

(think carefully about contrast with (b))

Page 28: Stat 155, Section 2, Last Time Probability Theory Foundations of Probability –Events, Sample Space –Probability Function Simple Random Sampling (count

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

Page 29: Stat 155, Section 2, Last Time Probability Theory Foundations of Probability –Events, Sample Space –Probability Function Simple Random Sampling (count

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

Page 30: Stat 155, Section 2, Last Time Probability Theory Foundations of Probability –Events, Sample Space –Probability Function Simple Random Sampling (count

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)

Page 31: Stat 155, Section 2, Last Time Probability Theory Foundations of Probability –Events, Sample Space –Probability Function Simple Random Sampling (count

Related HW

HW: C13

(d) It is a lemon? (0.07)

Page 32: Stat 155, Section 2, Last Time Probability Theory Foundations of Probability –Events, Sample Space –Probability Function Simple Random Sampling (count

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

Page 33: Stat 155, Section 2, Last Time Probability Theory Foundations of Probability –Events, Sample Space –Probability Function Simple Random Sampling (count

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

Page 34: Stat 155, Section 2, Last Time Probability Theory Foundations of Probability –Events, Sample Space –Probability Function Simple Random Sampling (count

Related HW

HW: C13

(e) It came from Factory A, if it is a lemon? (4/7)

4.103

4.105

Page 35: Stat 155, Section 2, Last Time Probability Theory Foundations of Probability –Events, Sample Space –Probability Function Simple Random Sampling (count

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

Page 36: Stat 155, Section 2, Last Time Probability Theory Foundations of Probability –Events, Sample Space –Probability Function Simple Random Sampling (count

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”

Page 37: Stat 155, Section 2, Last Time Probability Theory Foundations of Probability –Events, Sample Space –Probability Function Simple Random Sampling (count

And now for something completely different

Toy

3-d

data

set:

Page 38: Stat 155, Section 2, Last Time Probability Theory Foundations of Probability –Events, Sample Space –Probability Function Simple Random Sampling (count

And now for something completely different

High

Light

One

Point

Page 39: Stat 155, Section 2, Last Time Probability Theory Foundations of Probability –Events, Sample Space –Probability Function Simple Random Sampling (count

And now for something completely different

X

Coor

of

High

Light

Page 40: Stat 155, Section 2, Last Time Probability Theory Foundations of Probability –Events, Sample Space –Probability Function Simple Random Sampling (count

And now for something completely different

Y

Coor

of

High

Light

Page 41: Stat 155, Section 2, Last Time Probability Theory Foundations of Probability –Events, Sample Space –Probability Function Simple Random Sampling (count

And now for something completely different

Z

Coor

of

High

Light

Page 42: Stat 155, Section 2, Last Time Probability Theory Foundations of Probability –Events, Sample Space –Probability Function Simple Random Sampling (count

And now for something completely different

Proj-

ection

on

X

Axis

Page 43: Stat 155, Section 2, Last Time Probability Theory Foundations of Probability –Events, Sample Space –Probability Function Simple Random Sampling (count

And now for something completely different

1-d

View:

Proj-

ection

on

X

Axis

Page 44: Stat 155, Section 2, Last Time Probability Theory Foundations of Probability –Events, Sample Space –Probability Function Simple Random Sampling (count

And now for something completely different

Proj-

ection

on

Y

Axis

Page 45: Stat 155, Section 2, Last Time Probability Theory Foundations of Probability –Events, Sample Space –Probability Function Simple Random Sampling (count

And now for something completely different

1-d

View:

Proj-

ection

on

Y

Axis

Page 46: Stat 155, Section 2, Last Time Probability Theory Foundations of Probability –Events, Sample Space –Probability Function Simple Random Sampling (count

And now for something completely different

Proj-

ection

on

Z

Axis

Page 47: Stat 155, Section 2, Last Time Probability Theory Foundations of Probability –Events, Sample Space –Probability Function Simple Random Sampling (count

And now for something completely different

1-d

View:

Proj-

ection

on

Z

Axis

Page 48: Stat 155, Section 2, Last Time Probability Theory Foundations of Probability –Events, Sample Space –Probability Function Simple Random Sampling (count

And now for something completely different

Proj-

ection

on

X-Y

Plane

Page 49: Stat 155, Section 2, Last Time Probability Theory Foundations of Probability –Events, Sample Space –Probability Function Simple Random Sampling (count

And now for something completely different

Proj-

ection

on

X-Y

Plane

rotated

up

Page 50: Stat 155, Section 2, Last Time Probability Theory Foundations of Probability –Events, Sample Space –Probability Function Simple Random Sampling (count

And now for something completely different

Proj-

ection

on

X-Z

Plane

Page 51: Stat 155, Section 2, Last Time Probability Theory Foundations of Probability –Events, Sample Space –Probability Function Simple Random Sampling (count

And now for something completely different

Proj-

ection

on

X-Z

Plane

rotated

up

Page 52: Stat 155, Section 2, Last Time Probability Theory Foundations of Probability –Events, Sample Space –Probability Function Simple Random Sampling (count

And now for something completely different

Proj-

ection

on

Y-Z

Plane

Page 53: Stat 155, Section 2, Last Time Probability Theory Foundations of Probability –Events, Sample Space –Probability Function Simple Random Sampling (count

And now for something completely different

Proj-

ection

on

Y-Z

Plane

rotated

up

Page 54: Stat 155, Section 2, Last Time Probability Theory Foundations of Probability –Events, Sample Space –Probability Function Simple Random Sampling (count

And now for something completely different

Now

Look

At

All

Three

Page 55: Stat 155, Section 2, Last Time Probability Theory Foundations of Probability –Events, Sample Space –Probability Function Simple Random Sampling (count

And now for something completely different

Put

Into

Single

Plot -

1d on

Diagn’l

Page 56: Stat 155, Section 2, Last Time Probability Theory Foundations of Probability –Events, Sample Space –Probability Function Simple Random Sampling (count

And now for something completely different

Put

Into

Single

Plot -

2d off

Diagn’l

Page 57: Stat 155, Section 2, Last Time Probability Theory Foundations of Probability –Events, Sample Space –Probability Function Simple Random Sampling (count

And now for something completely different

Called

Drafts-

man’s

Plot:

(study

3d

Objects

In 2d)

Page 58: Stat 155, Section 2, Last Time Probability Theory Foundations of Probability –Events, Sample Space –Probability Function Simple Random Sampling (count

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

Page 59: Stat 155, Section 2, Last Time Probability Theory Foundations of Probability –Events, Sample Space –Probability Function Simple Random Sampling (count

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

Page 60: Stat 155, Section 2, Last Time Probability Theory Foundations of Probability –Events, Sample Space –Probability Function Simple Random Sampling (count

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

Page 61: Stat 155, Section 2, Last Time Probability Theory Foundations of Probability –Events, Sample Space –Probability Function Simple Random Sampling (count

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

Page 62: Stat 155, Section 2, Last Time Probability Theory Foundations of Probability –Events, Sample Space –Probability Function Simple Random Sampling (count

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.)

Page 63: Stat 155, Section 2, Last Time Probability Theory Foundations of Probability –Events, Sample Space –Probability Function Simple Random Sampling (count

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???)

Page 64: Stat 155, Section 2, Last Time Probability Theory Foundations of Probability –Events, Sample Space –Probability Function Simple Random Sampling (count

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???)

Page 65: Stat 155, Section 2, Last Time Probability Theory Foundations of Probability –Events, Sample Space –Probability Function Simple Random Sampling (count

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???

Page 66: Stat 155, Section 2, Last Time Probability Theory Foundations of Probability –Events, Sample Space –Probability Function Simple Random Sampling (count

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(

Page 67: Stat 155, Section 2, Last Time Probability Theory Foundations of Probability –Events, Sample Space –Probability Function Simple Random Sampling (count

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

Page 68: Stat 155, Section 2, Last Time Probability Theory Foundations of Probability –Events, Sample Space –Probability Function Simple Random Sampling (count

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)