applying probability

24
Applying Probability • Define problem of interest – in terms of “random variables” and/or “composite events” • Use real world knowledge, symmetry – to associate probs in [0,1] with ‘elementary events’ – all probs are conditional on real world knowledge • Use consistent prob rules – To associate probs with rand vars/ comp events – Multiplication and Addition Rules 1 ST2004 Week 7

Upload: tori

Post on 24-Feb-2016

68 views

Category:

Documents


0 download

DESCRIPTION

Applying Probability. Define problem of interest in terms of “random variables” and/or “composite events” Use real world knowledge, symmetry to associate probs in [0,1] with ‘elementary events’ all probs are conditional on real world knowledge Use consistent prob rules - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Applying Probability

ST2004 Week 7 1

Applying Probability

• Define problem of interest – in terms of “random variables” and/or “composite

events”• Use real world knowledge, symmetry – to associate probs in [0,1] with ‘elementary events’– all probs are conditional on real world knowledge

• Use consistent prob rules– To associate probs with rand vars/ comp events– Multiplication and Addition Rules

Page 2: Applying Probability

ST2004 Week 7 2

Probability

• Prob Rules Week 7– Basic in text, Ch2.2– Conditional Prob Bayes Rule in Ch 6– Fuller treatment in Ch 7 8

• Discrete Prob Dist Week 8– Ch 4 – see lab on Queuing– Ch 9

• Continuous Prob Dist Week 9– Ch 5 Normal dist– Ch 10

We give more emphasis to ‘event identities’. Book in Ch 7 uses more math shortcuts (binomial coeffs) and notation than we will use.

Best immediate preparation is Q1-12 in Ch 1. Formulate and approach via EXCEL before attempting probability solution.

Page 3: Applying Probability

ST2004 Week 7 6

Problems

• Dice: Seek prob dist of M2,S2 ,M3,S3 ,Mk,Sk

– Later E(S2) Var(S2) etc

• Mini-league: Seek prob dist of (NA, NB, NC) when– Pr( A beats B)=2 Pr(B beats A)

Pr( A beats B)=?– Pr( A beats B)=pAB; similarly pBC, pAC

– Later E(NA),Var(NA) and E(NA|NC=0),Var(NA|NC=0)

Page 4: Applying Probability

7ST2004 2010 Week 6

Events, Random Vars, Sample Space and Probability Rules

Event ASimplest Random VariableValues of A are TRUE/FALSE

Random Variable YValues of Y are y1, y2..yk (sample space; exhaustive list)

Events such as (Y= y)

Page 5: Applying Probability

8ST2004 2010 Week 6

Event AlgebraEvent IdentitiesRe-express compound events in and/or combinations of elementary events

Coin (H orT) Experiment Happened CardsAce (A ♠ orA♥or A ♣ or A♦)Redand (NOT♦) (2♥or.. or A♥)

( )

( )

( ) ( ) ( )( ) ( )

( ) Disjoint/Mutually Exclusive( ) Exhaustive

Not A AD A or B

D Aand B

D A and B or Aand B or Aand BA A and B or Aand B

A and A

S A or A

Page 6: Applying Probability

9ST2004 2010 Week 6

Event IdentitiesRe-express in terms of and/or combs of (..) (elementary events and/or simple compound events). Often there is more than one way.

“A out-right winner of league”. Use as elementary events Outcomes of games A/B, etc, and as relatively simple compound events, the scores NA , etc

“At least one Queen in two cards”

“Max of 3 dice is 3” and “Max of 3 dice is 3”

“Sun of 3 is 4”

( )

( )

( ) ( ) ( )( ) ( )

( ) Disjoint/Mutually Exclusive

( ) Exhaustive

Not A AD A or B

D Aand B

D A and B or Aand B or Aand BA A and B or Aand B

A and A

S A or A

Page 7: Applying Probability

ST2004 Week 7 10

Event Identities

1 1 2

1 2 3

1 2 3 4 1 2 3 4 5

Coins: Elementary events , , ........... (3)=First Head on 3rd toss

(3) , ,

( 3) First Head on 4th or Higher toss

( 3)

D

, , , , , , , .......

( 3) ( (1) (2

efine

Define

H T HF

F T T H

F

F T T T H OR T T T T H OR

AltF NOT F ORF

) (3))ORF

Page 8: Applying Probability

ST2004 Week 7 13

Event Identities

1 1

2 2 1

3 3 1 2

E = No common birth date in class

Define birth date of student (1,2,...365)

( any date, )( =any date except ),

any date , except and ...

.............

iY i

Y nAND Y n n

EAND Y n n n

Page 9: Applying Probability

ST2004 Week 7 17

Probability Rules

Pr( ) Pr( )

Event Identity

Whence Pr Pr Pr 1

Also Pr 0

Pr( ) 0Pr( ) 0 if , mut. exclPr( ... ) Pr( ) Pr( ) .

Pr( ) [0,1]Pr( ) 1Pr( ) Pr( ) Pr( ) if mut. ex

P

cl

. r

A in

Aor B

A AisTRUE

A or A

A or A A A

A and AAand B A BAor B or Z A B

A B

( ) if mut. exclZ

Addition Rule

Plus real world knowledge

Page 10: Applying Probability

ST2004 Week 7 18

Coins/Dice/Cards

12

Coin TossDefine (Heads), (Tails)

;1 Pr( ) Pr( ) Pr( ) since mut. excl.

Real World KnowledgeSymmetry Pr( ) Pr( ) Pr( ) Pr( )

One Dice One CardDefine 6 (Throws 6) (Draws Queen)

Compu

H T HH andT H orT

H orT H T

H T H T

Q

te Pr(6) Pr(6) Pr( ) Pr( )Q Q

Page 11: Applying Probability

ST2004 Week 7 19

Applying Prob Rules

disjoin

disjoi

t

nt

( ) ( )

Pr( ) Pr( ) P sincer( )

Pr( ) Pr( ) Pr( )

( ) ( ) ( ) ( )

Pr( ) Pr( ) Pr ( ) PPr(

))

r (

Event Identity A A and B or A and B

A A and B A and B

Sim B A and B A and B

Event Identity A or B A and B or A and B or A or B

A or B A and B A and B AA or B

or B

Pr( ) Pr( ) Pr( )A B Aand B

Generalisation of Addition Rule

ExampleDefine : Team A int winner; sim ,Given symmetry Pr( ) Pr( ) Pr( )

Pr( ) ?Pr( ) ?Pr( ) ?

A at least jo B CA B C

AA or BA or BorC

Page 12: Applying Probability

ST2004 Week 7 20

Event Identities: PasswordDup in Password 3 Chars from A,B,C,D,E,F)

A B C D E F Duplicate? Not Dup?

using OR using ANDrep 1st 2nd 3rd 1st 2nd 3rd1 5 6 3 E F C FALSE TRUE2 6 3 2 F C B FALSE TRUE3 3 4 6 C D F FALSE TRUE4 6 1 6 F A F TRUE FALSE5 3 4 4 C D D TRUE FALSE6 5 4 3 E D C FALSE TRUE7 2 6 3 B F C FALSE TRUE8 4 6 4 D F D TRUE FALSE9 1 6 5 A F E FALSE TRUE10 5 4 3 E D C FALSE TRUE

Char Index Char

Elementary eventsand associated probs

Pr(Dup) via addition rules

Page 13: Applying Probability

ST2004 Week 7 21

Conditional Probability

Pr( ) requires Real World KnowledgePr ( )

Pr( | ) Pr( )Pr ( ) Real World Knowledge

includes

RWK

givenB

AA

A B A given BA

B TRUE

Page 14: Applying Probability

ST2004 Week 7 23

Probability RulesConditional Prob and Independence

Pr( ) Pr( | ) Pr( )Pr( )Pr( | )

Pr( )

Pr( ) Pr( ) P

Book uses

Equiv for

Important special c er )

as(

AB

A

Aand B

a

A B BAand BA BB

Aand B A B when stat inde

n

pendent

d B

Multiplication Rule

1

2

1 2

DiceDefine 6 6 on first roll; also 6Pr(6 6 ) ?and

1

2

1 2

CardsDefine Q Queen on first draw; also QPr(Q Q ) ?and

Page 15: Applying Probability

ST2004 Week 7 24

Decomposing with Cond Probs

2

2 2 1 1 2

1 2 1 2

1 2 1 2

1 2 1 2

2

2 1 1 2 1 1

Pr

Prob( 2nd card is Queen) Pr( )Event Identity

First Card is anything

Pr

Pr Pr

Pr | Pr( ) Pr | Pr( )

4 48 3 451 52 51 52

48 351 51

Q

Q AND Q Q OR Q AND Q

Q ANDQ OR Q OR Q

Q ANDQ OR Q OR Q

Q ANDQ Q ANDQ

Q Q Q Q Q Q

Q

4

524

52

3Pr

Pr(6on 2nd dice roll)

Q

Page 16: Applying Probability

ST2004 Week 7 26

Applying Cond Probability Rules

2 1

1 2

Define Queen on second card; also Seek Pr( | ) given regular deckUse Pr( | ) Pr( ) / Pr( ) Pr ( )B

Q QQ QA B Aand B B recall A

poss rel freqnot Q,not Q 848

Q,not Q 75not Q,Q 75

Q,Q 2Prob

Rel Freqs Q not Q Q not QQ 0.002 0.075 0.077 Q 0.005 0.072 0.077

not Q 0.075 0.848 0.923 not Q 0.072 0.851 0.9230.077 0.923 1 0.077 0.923 1

Page 17: Applying Probability

ST2004 Week 7 27

Applying Cond Probability Rules

14

Mini-leagueDefine = A outright winner; also ,

Given symmetry Pr( ) Pr( ) Pr( )

Pr( | one team is outright winner) ?

Pr( | team C is outright winner) ?

Pr( | C scored no wins) ?

Pr( | no info abou

A B C

A B C

A

A

A

A

t outright winner) ?

Write down event identitiesexplicitly

Justify use of + or explicitly

Page 18: Applying Probability

ST2004 Week 7 28

Bayes Rule & Thinking Backwards

Inverting the of conditionalityPr evidence | At crime scene

Pr At crime scene | evidence

Pr( )Pr( | ) Pr( | )Pr( )Pr( | )Pr( )

Pr( | )Pr( ) Pr( | )Pr( )

Pr( | ) Pr( | )Pr( | ) Pr(

directionThis

or This

BB A A BAA B B

A B B A B BAlt FormB A A BB A

Pr( )

| ) Pr( )Posterior Odds Prior Odds

BA B B

See text, Ch 8.2

Page 19: Applying Probability

ST2004 Week 7 29

Bayes Rule & Thinking Backwards

Inverting the of conditionalityPr evidence | At crime scene Pr At crime scene | evidence

Murder CommittedEither or unknown In absence of evidence Pr( ) 0.5 Pr( )

Evidence Blood grou

directionThis or This

X YX Y

E

p at crime scene

has blood group : Pr( | ) 1 blood group not known. But Pr( ) .10

Pr( Guilty)Pr( at crime scene| )= Pr( | Guilty)Pr( )

Pr( ) Pr( | Guilty)Pr( Guilty)+Pr( | Guilty)Pr( Guilty)

A

X A A XY know A

XA E E XE

E E X X E Y Y

Probs X YAA

Page 20: Applying Probability

ST2004 Week 7 31

Bayes Rule & Thinking BackwardsMail Arrives: Contains "viagra" Spam or not?

Given past data:in general 5% of my mail is spamPr("viagra"|not spam) = 0.0005Pr("viagra"|spam) = 0.05 Pr(spam|"viagra")=

Contains "v1agra" Spam or not?Past data:Pr("v1agra"|not spam) = Pr("v1agra"|spam) = Pr(spam|"viagra")=

pq

Probs

Page 21: Applying Probability

ST2004 Week 7 32

Probability Distributionsand Random Variables

• Output of a simulation exercise (thought expt)• Columns defined random variables Y– Discrete countable list of possible values– Continuous values– True/False values Random Var is ‘Event’

• Discrete random vars fully described by– 2 lists Poss Values y of Y

Associated Probs Pr(Y=y)

Main use ofprobability

Page 22: Applying Probability

ST2004 Week 7 33

(sample space)

DiceDefine = max(Scores on two independent rolls)Seek prob dist of Two Lists: Poss

ProbsDefine elementary events; use event identity & prob rules

MM

Applying Probability Rules – Indep Case

Page 23: Applying Probability

ST2004 Week 7 34

Applying Probability Rules – Indep CaseMiniLeague

= Number of wins by twice as good as , ; , evenly matched

Games independent (Sim using TWO random numbers)

Seek prob dist of Two lists: poss = sample space for

De

prob

i e

s

f n B

B

B

N BA B C B C

NN

Games wonOutright Winner

A best by factor a a

A/B A/C B/C A B C is All equal A best 2A A B 2 1 0 A 0.125 0.222 Pr(A beats B) 0.6667A A C 2 0 1 A 0.125 0.222 Pr(A beats C) 0.6667A C B 1 1 1 N/A 0.125 0.111 Pr(B beats C) 0.5A C C 1 0 2 C 0.125 0.111B A B 1 2 0 B 0.125 0.111B A C 1 1 1 N/A 0.125 0.111B C B 0 2 1 B 0.125 0.056B C C 0 1 2 C 0.125 0.056

Winner in Probs

Poss Outcomes

Page 24: Applying Probability

ST2004 Week 7 38

Conditional Distributions

Mini-league: A more skilledWhat is prob dist for ?

Know 0; what is prob dist for ?

Know 1; what is prob dist for ?

Know 2; what is prob dist for , ?

A

c A

c A

c A B

N

N N

N N

N N N

Probabilities must sum to 1!

Games wonOutright Winner

A best by factor a a

A/B A/C B/C A B C is All equal A best 2A A B 2 1 0 A 0.125 0.222 Pr(A beats B) 0.6667A A C 2 0 1 A 0.125 0.222 Pr(A beats C) 0.6667A C B 1 1 1 N/A 0.125 0.111 Pr(B beats C) 0.5A C C 1 0 2 C 0.125 0.111B A B 1 2 0 B 0.125 0.111B A C 1 1 1 N/A 0.125 0.111B C B 0 2 1 B 0.125 0.056B C C 0 1 2 C 0.125 0.056

Winner in Probs

Poss Outcomes