applying probability define problem of interest – in terms of “random variables” and/or...
TRANSCRIPT
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
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.
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)
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)
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 A
D A or B
D Aand B
D A and B or Aand B or Aand B
A A and B or Aand B
A and A
S A or A
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 A
D A or B
D Aand B
D A and B or Aand B or Aand B
A A and B or Aand B
A and A
S A or A
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 H
F
F T T H
F
F T T T H OR T T T T H OR
Alt
F NOT F ORF
) (3))ORF
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 n
AND Y n nE
AND Y n n n
ST2004 Week 7 17
Probability Rules
Pr( ) Pr( )
Event Identity
Whence Pr Pr Pr 1
Also Pr 0
Pr( ) 0
Pr( ) 0 if , mut. excl
Pr( ... ) Pr( ) Pr( ) .
Pr( ) [0,1]
Pr( ) 1
Pr( ) Pr( ) Pr( ) if mut. ex
P
cl
. r
A in
Aor B
A AisTRUE
A or A
A or A A A
A and A
Aand B A B
Aor B or Z A B
A B
( ) if mut. exclZ
Addition Rule
Plus real world knowledge
ST2004 Week 7 18
Coins/Dice/Cards
12
Coin Toss
Define (Heads), (Tails)
;
1 Pr( ) Pr( ) Pr( ) since mut. excl.
Real World Knowledge
Symmetry Pr( ) Pr( ) Pr( ) Pr( )
One Dice One Card
Define 6 (Throws 6) (Draws Queen)
Compu
H T H
H andT H orT
H orT H T
H T H T
Q
te Pr(6) Pr(6) Pr( ) Pr( )Q Q
ST2004 Week 7 19
Applying Prob Rules
disjoin
disjoi
t
nt
( ) ( )
Pr( ) Pr( ) P sincer( )
Pr( ) Pr( ) Pr( )
( ) ( ) ( ) ( )
Pr( ) Pr( ) Pr ( ) P
Pr(
)
)
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 A
A or B
or B
Pr( ) Pr( ) Pr( )A B Aand B
Generalisation of Addition Rule
Example
Define : Team A int winner; sim ,
Given symmetry Pr( ) Pr( ) Pr( )
Pr( ) ?
Pr( ) ?
Pr( ) ?
A at least jo B C
A B C
A
A or B
A or BorC
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
ST2004 Week 7 21
Conditional Probability
Pr( ) requires Real World Knowledge
Pr ( )
Pr( | ) Pr( )
Pr ( ) Real World Knowledge
includes
RWK
givenB
A
A
A B A given B
A
B TRUE
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 e
r )
as
(
AB
A
Aand B
a
A B B
Aand BA B
B
Aand B A B when stat inde
n
pendent
d B
Multiplication Rule
1
2
1 2
Dice
Define 6 6 on first roll;
also 6
Pr(6 6 ) ?and
1
2
1 2
Cards
Define Q Queen on first draw;
also Q
Pr(Q Q ) ?and
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 4
51 52 51 5248 3
51 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
52
4
52
3Pr
Pr(6on 2nd dice roll)
Q
ST2004 Week 7 26
Applying Cond Probability Rules
2 1
1 2
Define Queen on second card; also
Seek Pr( | ) given regular deck
Use Pr( | ) Pr( ) / Pr( ) Pr ( )B
Q Q
Q Q
A 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
ST2004 Week 7 27
Applying Cond Probability Rules
14
Mini-league
Define = 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
ST2004 Week 7 28
Bayes Rule & Thinking Backwards
Inverting the of conditionality
Pr evidence | At crime scene
Pr At crime scene | evidence
Pr( )Pr( | ) Pr( | )
Pr( )
Pr( | )Pr( )
Pr( | )Pr( ) Pr( | )Pr( )
Pr( | ) Pr( | )
Pr( | ) Pr(
direction
This
or This
BB A A B
A
A B B
A B B A B B
Alt Form
B A A B
B A
Pr( )
| ) Pr( )
Posterior Odds Prior Odds
B
A B B
See text, Ch 8.2
ST2004 Week 7 29
Bayes Rule & Thinking Backwards
Inverting the of conditionality
Pr evidence | At crime scene Pr At crime scene | evidence
Murder Committed
Either or unknown
In absence of evidence Pr( ) 0.5 Pr( )
Evidence Blood grou
direction
This or This
X Y
X 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 X
Y know A
XA E E X
E
E E X X E Y Y
Probs X Y
A
A
ST2004 Week 7 31
Bayes Rule & Thinking BackwardsMail Arrives:
Contains "viagra" Spam or not?
Given past data:
in general 5% of my mail is spam
Pr("viagra"|not spam) = 0.0005
Pr("viagra"|spam) = 0.05 Pr(spam|"viagra")=
Contains "v1agra" Spam or not?
Past data:
Pr("v1agra"|not spam) =
Pr("v1agra"|spam) = Pr(spam|"viagra")=
p
q
Probs
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
ST2004 Week 7 33
(sample space)
Dice
Define = max(Scores on two independent rolls)
Seek prob dist of
Two Lists: Poss
Probs
Define elementary events; use event identity & prob rules
M
M
Applying Probability Rules – Indep Case
ST2004 Week 7 34
Applying Probability Rules – Indep Case
Mini League
= 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 B
A B C B C
N
N
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
ST2004 Week 7 38
Conditional Distributions
Mini-league: A more skilled
What 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