Stat 31, Section 1, Last Time Big Rules of Probability –The not rule –The or rule –The and...

42
Stat 31, Section 1, Last Time Big Rules of Probability The not rule The or rule The and rule P{A & B} = P{A|B}P{B} = P{B|A}P{A} Bayes Rule (turn around Conditional Probabilities) Independence

description

New Ball & Urn Example H  R R R R G G T  R R G Again toss coin, and draw ball: Same, so R & I are independent events Not true above, but works here, since proportions of R & G are same

Transcript of Stat 31, Section 1, Last Time Big Rules of Probability –The not rule –The or rule –The and...

Page 1: Stat 31, Section 1, Last Time Big Rules of Probability –The not rule –The or rule –The and rule P{A & B} = P{A|B}P{B} = P{B|A}P{A} Bayes Rule (turn around.

Stat 31, Section 1, Last Time

• Big Rules of Probability– The not rule– The or rule– The and rule

P{A & B} = P{A|B}P{B} = P{B|A}P{A}• Bayes Rule

(turn around Conditional Probabilities)• Independence

Page 2: Stat 31, Section 1, Last Time Big Rules of Probability –The not rule –The or rule –The and rule P{A & B} = P{A|B}P{B} = P{B|A}P{A} Bayes Rule (turn around.

Independence(Need one more major concept at this level)

An event A does not depend on B, when:

Knowledge of B does not change

chances of A:

P{A | B} = P{A}

Page 3: Stat 31, Section 1, Last Time Big Rules of Probability –The not rule –The or rule –The and rule P{A & B} = P{A|B}P{B} = P{B|A}P{A} Bayes Rule (turn around.

New Ball & Urn ExampleH R R R R G G T R R G

Again toss coin, and draw ball:

Same, so R & I are independent events

Not true above, but works here, since proportions of

R & G are same

32| IRP

0|| IIPIIRPIPIRPRP

32

21

32

21

32

Page 4: Stat 31, Section 1, Last Time Big Rules of Probability –The not rule –The or rule –The and rule P{A & B} = P{A|B}P{B} = P{B|A}P{A} Bayes Rule (turn around.

Independence

Note, when A in independent of B:

so

And thus

i.e. B is independent of A

BAPBPAP &}{

BPBAPBAPAP &|

ABPAPBAPBP |&}{

Page 5: Stat 31, Section 1, Last Time Big Rules of Probability –The not rule –The or rule –The and rule P{A & B} = P{A|B}P{B} = P{B|A}P{A} Bayes Rule (turn around.

Independence

Note, when A in independent of B:

It follows that: B is independent of A

I.e. “independence” is symmetric in A and B

(as expected)

More formal treatments use symmetric version as definition

(to avoid hassles with 0 probabilities)

Page 6: Stat 31, Section 1, Last Time Big Rules of Probability –The not rule –The or rule –The and rule P{A & B} = P{A|B}P{B} = P{B|A}P{A} Bayes Rule (turn around.

Independence

HW:

4.33

Page 7: Stat 31, Section 1, Last Time Big Rules of Probability –The not rule –The or rule –The and rule P{A & B} = P{A|B}P{B} = P{B|A}P{A} Bayes Rule (turn around.

Special Case of “And” Rule

For A and B independent:

P{A & B} = P{A | B} P{B} = P{B | A} P{A} =

= P{A} P{B}

i.e. When independent, just multiply probabilities…

Page 8: Stat 31, Section 1, Last Time Big Rules of Probability –The not rule –The or rule –The and rule P{A & B} = P{A|B}P{B} = P{B|A}P{A} Bayes Rule (turn around.

Independent “And” Rule

E.g. Toss a coin until the 1st Head appears, find P{3 tosses}:

Model: tosses are independent

(saw this was reasonable last time, using “equally likely sample space ideas)

P{3 tosses} =

When have 3: group with parentheses

321 && HTTP

Page 9: Stat 31, Section 1, Last Time Big Rules of Probability –The not rule –The or rule –The and rule P{A & B} = P{A|B}P{B} = P{B|A}P{A} Bayes Rule (turn around.

Independent “And” Rule

E.g. Toss a coin until the 1st Head appears, find P{3 tosses}

(by indep:)

I.e. “just multiply”

321 && HTTP 321 && HTTP

21213 &&| TTPTTHP

1123 | TPTTPHP

123 TPTPHP

Page 10: Stat 31, Section 1, Last Time Big Rules of Probability –The not rule –The or rule –The and rule P{A & B} = P{A|B}P{B} = P{B|A}P{A} Bayes Rule (turn around.

Independent “And” Rule

E.g. Toss a coin until the 1st Head appears, P{3 tosses}

• Multiplication idea holds in general

• So from now on will just say:

“Since Independent, multiply probabilities”

• Similarly for Exclusive Or rule,

Will just “add probabilities”

123 TPTPHP

Page 11: Stat 31, Section 1, Last Time Big Rules of Probability –The not rule –The or rule –The and rule P{A & B} = P{A|B}P{B} = P{B|A}P{A} Bayes Rule (turn around.

Independent “And” Rule

HW:

4.31

4.35

Page 12: Stat 31, Section 1, Last Time Big Rules of Probability –The not rule –The or rule –The and rule P{A & B} = P{A|B}P{B} = P{B|A}P{A} Bayes Rule (turn around.

Overview of Special Cases

Careful: these can be tricky to keep separate

OR works like adding, for mutually exclusive

AND works like multiplying, for independent

Page 13: Stat 31, Section 1, Last Time Big Rules of Probability –The not rule –The or rule –The and rule P{A & B} = P{A|B}P{B} = P{B|A}P{A} Bayes Rule (turn around.

Overview of Special Cases

Caution: special cases are different

Mutually exclusive independent

For A and B mutually exclusive:

P{A | B} = 0 P{A}

Thus not independent

Page 14: Stat 31, Section 1, Last Time Big Rules of Probability –The not rule –The or rule –The and rule P{A & B} = P{A|B}P{B} = P{B|A}P{A} Bayes Rule (turn around.

Overview of Special CasesHW: C13 Suppose events A, B, C all have

probability 0.4, A & B are independent, and A & C are mutually exclusive.

(a) Find P{A or B} (0.64)

(b) Find P{A or C} (0.8)

(c) Find P{A and B} (0.16)

(d) Find P{A and C} (0)

Page 15: Stat 31, Section 1, Last Time Big Rules of Probability –The not rule –The or rule –The and rule P{A & B} = P{A|B}P{B} = P{B|A}P{A} Bayes Rule (turn around.

Random Variables

Text, Section 4.3 (we are currently jumping)

Idea: take probability to next level

Needed for probability structure of political

polls, etc.

Page 16: Stat 31, Section 1, Last Time Big Rules of Probability –The not rule –The or rule –The and rule P{A & B} = P{A|B}P{B} = P{B|A}P{A} Bayes Rule (turn around.

Random Variables

Definition:

A random variable, usually denoted as X,

is a quantity that “takes on values at

random”

Page 17: Stat 31, Section 1, Last Time Big Rules of Probability –The not rule –The or rule –The and rule P{A & B} = P{A|B}P{B} = P{B|A}P{A} Bayes Rule (turn around.

Random Variables

Two main types

(that require different mathematical models)

• Discrete, i.e. counting

(so look only at “counting numbers”, 1,2,3,…)

• Continuous, i.e. measuring

(harder math, since need all fractions, etc.)

Page 18: Stat 31, Section 1, Last Time Big Rules of Probability –The not rule –The or rule –The and rule P{A & B} = P{A|B}P{B} = P{B|A}P{A} Bayes Rule (turn around.

Random Variables

E.g: X = # for Candidate A in a randomly selected political poll: discrete

(recall all that means)

Power of the random variable idea:

• Gives something to “get a hold of…”

• Similar in spirit to high school algebra:

Give unknowns a name, so can work with

Page 19: Stat 31, Section 1, Last Time Big Rules of Probability –The not rule –The or rule –The and rule P{A & B} = P{A|B}P{B} = P{B|A}P{A} Bayes Rule (turn around.

Random Variables

E.g: X = # that comes up, in die rolling:

Discrete

• But not too interesting

• Since can study by simple methods

• As done above

• Don’t really need random variable concept

Page 20: Stat 31, Section 1, Last Time Big Rules of Probability –The not rule –The or rule –The and rule P{A & B} = P{A|B}P{B} = P{B|A}P{A} Bayes Rule (turn around.

Random Variables

E.g: X = # that comes up, in die rolling:

Discrete

• But not very interesting

• Since can study by simple methods

• As done above

• Don’t really need random variable concept

Page 21: Stat 31, Section 1, Last Time Big Rules of Probability –The not rule –The or rule –The and rule P{A & B} = P{A|B}P{B} = P{B|A}P{A} Bayes Rule (turn around.

Random Variables

E.g: Measurement error:

Let X = measurement:

Continuous

• How to model probabilities???

Page 22: Stat 31, Section 1, Last Time Big Rules of Probability –The not rule –The or rule –The and rule P{A & B} = P{A|B}P{B} = P{B|A}P{A} Bayes Rule (turn around.

Random Variables

HW on discrete vs. continuous:

4.40 ((b) discrete, (c) continuous, (d) could be either, but discrete is more common)

Page 23: Stat 31, Section 1, Last Time Big Rules of Probability –The not rule –The or rule –The and rule P{A & B} = P{A|B}P{B} = P{B|A}P{A} Bayes Rule (turn around.

And now for something completely different

My idea about “visualization” last time:• 30% really liked it• 70% less enthusiastic…• Depends on mode of thinking

– “Visual thinkers” loved it– But didn’t connect with others

• So don’t plan to continue that…

Page 24: Stat 31, Section 1, Last Time Big Rules of Probability –The not rule –The or rule –The and rule P{A & B} = P{A|B}P{B} = P{B|A}P{A} Bayes Rule (turn around.

Random VariablesA die rolling example

(where random variable concept is useful)Win $9 if 5 or 6, Pay $4, if 1, 2 or 3,

otherwise (4) break evenNotes:• Don’t care about number that comes up• Random Variable abstraction allows

focussing on important points• Are you keen to play? (will calculate…)

Page 25: Stat 31, Section 1, Last Time Big Rules of Probability –The not rule –The or rule –The and rule P{A & B} = P{A|B}P{B} = P{B|A}P{A} Bayes Rule (turn around.

Random Variables

Die rolling example

Win $9 if 5 or 6, Pay $4, if 1, 2 or 4

Let X = “net winnings”

Note: X takes on values 9, -4 and 0

Probability Structure of X is summarized by:

P{X = 9} = 1/3 P{X = -4} = ½ P{X = 0} = 1/6

(should you want to play?, study later)

Page 26: Stat 31, Section 1, Last Time Big Rules of Probability –The not rule –The or rule –The and rule P{A & B} = P{A|B}P{B} = P{B|A}P{A} Bayes Rule (turn around.

Random Variables

Die rolling example, for X = “net winnings”:

Win $9 if 5 or 6, Pay $4, if 1, 2 or 4

Probability Structure of X is summarized by:

P{X = 9} = 1/3 P{X = -4} = ½ P{X = 0} = 1/6

Convenient form: a tableWinning 9 -4 0

Prob. 1/3 1/2 1/6

Page 27: Stat 31, Section 1, Last Time Big Rules of Probability –The not rule –The or rule –The and rule P{A & B} = P{A|B}P{B} = P{B|A}P{A} Bayes Rule (turn around.

Summary of Prob. StructureIn general: for discrete X, summarize

“distribution” (i.e. full prob. Structure) by a table:

Where:i. All are between 0 and 1ii. (so get a prob. funct’n as above)

Values x1 x2 … xk

Prob. p1 p2 … pk

11

k

iip

ip

Page 28: Stat 31, Section 1, Last Time Big Rules of Probability –The not rule –The or rule –The and rule P{A & B} = P{A|B}P{B} = P{B|A}P{A} Bayes Rule (turn around.

Summary of Prob. Structure

Summarize distribution, for discrete X,

by a table:

Power of this idea:

• Get probs by summing table values

• Special case of disjoint OR rule

Values x1 x2 … xk

Prob. p1 p2 … pk

Page 29: Stat 31, Section 1, Last Time Big Rules of Probability –The not rule –The or rule –The and rule P{A & B} = P{A|B}P{B} = P{B|A}P{A} Bayes Rule (turn around.

Summary of Prob. Structure

E.g. Die Rolling game above:

P{X = 9} = 1/3

P{X < 2} = P{X = 0} + P{X = -4} = 1/6 +½ = 2/3

P{X = 5} = 0 (not in table!)

Winning 9 -4 0Prob. 1/3 1/2 1/6

Page 30: Stat 31, Section 1, Last Time Big Rules of Probability –The not rule –The or rule –The and rule P{A & B} = P{A|B}P{B} = P{B|A}P{A} Bayes Rule (turn around.

Summary of Prob. Structure

E.g. Die Rolling game above:Winning 9 -4 0Prob. 1/3 1/2 1/6

0

0&90|9

XP

XXPXXP

3

2

2131

31

6131

09

XPXP

Page 31: Stat 31, Section 1, Last Time Big Rules of Probability –The not rule –The or rule –The and rule P{A & B} = P{A|B}P{B} = P{B|A}P{A} Bayes Rule (turn around.

Summary of Prob. Structure

HW:

4.47 & (d) Find P{X = 3 | X >= 2} (0.24)

4.50 (0.144, …, 0.352)

Page 32: Stat 31, Section 1, Last Time Big Rules of Probability –The not rule –The or rule –The and rule P{A & B} = P{A|B}P{B} = P{B|A}P{A} Bayes Rule (turn around.

Random Variables

Now consider continuous random variables

Recall: for measurements (not counting)

Model for continuous random variables:

Calculate probabilities as areas,

under “probability density curve”, f(x)

Page 33: Stat 31, Section 1, Last Time Big Rules of Probability –The not rule –The or rule –The and rule P{A & B} = P{A|B}P{B} = P{B|A}P{A} Bayes Rule (turn around.

Continuous Random Variables

Model probabilities for continuous random

variables, as areas under “probability

density curve”, f(x):

= Area( )

a b

(calculus notation)

bXaP

b

a

dxxf )(

Page 34: Stat 31, Section 1, Last Time Big Rules of Probability –The not rule –The or rule –The and rule P{A & B} = P{A|B}P{B} = P{B|A}P{A} Bayes Rule (turn around.

Continuous Random Variablese.g. Uniform Distribution

Idea: choose random number from [0,1]

Use constant density: f(x) = C

Models “equally likely”

To choose C, want: Area

1 = P{X in [0,1]} = CSo want C = 1. 0 1

Page 35: Stat 31, Section 1, Last Time Big Rules of Probability –The not rule –The or rule –The and rule P{A & B} = P{A|B}P{B} = P{B|A}P{A} Bayes Rule (turn around.

Uniform Random Variable

HW:

4.52 (0.73, 0, 0.73, 0.2, 0.5)

4.54 (1, ½, 1/8)

Page 36: Stat 31, Section 1, Last Time Big Rules of Probability –The not rule –The or rule –The and rule P{A & B} = P{A|B}P{B} = P{B|A}P{A} Bayes Rule (turn around.

Continuous Random Variablese.g. Normal Distribution

Idea: Draw at random from a normal population

f(x) is the normal curve (studied above)

Review some earlier concepts:

Page 37: Stat 31, Section 1, Last Time Big Rules of Probability –The not rule –The or rule –The and rule P{A & B} = P{A|B}P{B} = P{B|A}P{A} Bayes Rule (turn around.

Normal Curve Mathematics

The “normal density curve” is:

usual “function” of

circle constant = 3.14…

natural number = 2.7…

,2

21

21)(

x

exf

x

Page 38: Stat 31, Section 1, Last Time Big Rules of Probability –The not rule –The or rule –The and rule P{A & B} = P{A|B}P{B} = P{B|A}P{A} Bayes Rule (turn around.

Normal Curve Mathematics

Main Ideas:

• Basic shape is:

• “Shifted to mu”:

• “Scaled by sigma”:

• Make Total Area = 1: divide by

• as , but never

2

21x

e

2

0

221 x

e2

21

x

e

0)( xf x

Page 39: Stat 31, Section 1, Last Time Big Rules of Probability –The not rule –The or rule –The and rule P{A & B} = P{A|B}P{B} = P{B|A}P{A} Bayes Rule (turn around.

Computation of Normal Areas

EXCEL Computation:

works in terms of “lower areas”

E.g. for

Area < 1.3

)5.0,1(N

Page 40: Stat 31, Section 1, Last Time Big Rules of Probability –The not rule –The or rule –The and rule P{A & B} = P{A|B}P{B} = P{B|A}P{A} Bayes Rule (turn around.

Computation of Normal Probs

EXCEL Computation:

probs given by “lower areas”

E.g. for X ~ N(1,0.5)

P{X < 1.3} = 0.73

Page 41: Stat 31, Section 1, Last Time Big Rules of Probability –The not rule –The or rule –The and rule P{A & B} = P{A|B}P{B} = P{B|A}P{A} Bayes Rule (turn around.

Normal Random VariablesAs above, compute probabilities as areas,

In EXCEL, use NORMDIST & NORMINV

E.g. above: X ~ N(1,0.5)

P{X < 1.3} =NORMDIST(1.3,1,0.5,TRUE)

= 0.73 (as in pic above)

Page 42: Stat 31, Section 1, Last Time Big Rules of Probability –The not rule –The or rule –The and rule P{A & B} = P{A|B}P{B} = P{B|A}P{A} Bayes Rule (turn around.

Normal Random VariablesHW:

4.55