Transcript 09/24/2015

Psychology 202a
Advanced Psychological
Statistics
September 24, 2015
Plan for today
•
•
•
•
•
•
Rules for probabilities of combined events
Probability simulation in R
Deriving Bayes' theorem.
An example of Bayes' theorem.
Sampling distributions.
Introducing hypothesis testing through the
binomial distribution.
The addition rule
• Used for combining events with an “OR”
link.
• Simple form (requires mutually exclusive
events): P(A or B) = P(A) + P(B)
• Examples:
– P(a die comes up 1 OR 2)
– P(spinner lands between 0 and ¼ OR between
½ and ¾)
– P( N(0,1) < -1.96 OR > 1.96)
The addition rule (cont.)
• The more complex form: P(A or B) = P(A)
+ P(B) – P(A and B).
• Does not require mutual exclusivity.
• Examples:
– P( 1st coin toss is 'H' OR 2nd coin toss is 'H')
– P( 1st IQ > 136 OR 2nd IQ > 136)
• But there's a problem: how do we get
P(A and B)?
The multiplication rule
• Used for combining events with an 'AND'
link.
• Simple form (requires independent events):
P(A and B) = P(A) P(B).
• Examples:
– P( 1st coin toss = 'H' AND 2nd coin toss = 'H')
– P( 1st spin > ½ AND 2nd spin < ¾ )
The multiplication rule (cont.)
• The more complex form (does not require
independence):
– P(A and B) = P(A) P(B|A) or
– P(A and B) = P(B) P(A|B)
• The vertical bar is read “given” and
indicates conditional probability.
The addition rule, revisited.
• Examples:
– P( 1st coin toss is 'H' OR 2nd coin toss is 'H')
– ½ + ½ - (½ * ½) = ¾.
– P( 1st IQ > 136 OR 2nd IQ > 136)
– .00135 + .00135 - .00135*.00135  .0027.
Empirical validation of
probability laws
• An interlude in R occurs here.
Bayes' theorem
• Bayes' theorem provides a way to reverse
conditional probabilities:
P(A|B )P(B )
P(B|A ) =
.
P(A|B )P(B ) + P(A|B )P(B )
• Equivalently,
P(B|A )P(A )
P(A|B ) =
.
P(B|A )P(A ) + P(B|A )P(A )
Deriving Bayes’ theorem
P( A and B ) = P( A ) P(B | A )
P( A and B )
P(B | A ) =
P( A )
P(B ) P( A | B )
=
P( A )
P( A | B ) P(B )
=
.
P( A | B ) P(B ) + P( A | B ) P(B )
Example of Bayes’ theorem
• Medical tests
• Usually, we are told the test’s sensitivity
and its specificity.
• Let A denote “has earlobe cancer.”
• Let B denote “tests positive for earlobe
cancer.”
• Sensitivity is P(B | A ).
• Specificity is P(B | A ).
Here’s a hypothetical table
Has EC
Does not
have EC
Tests
positive
15
4
19
Tests
negative
2
1479
1481
17
1483
1500
From that table, we can get:
•
•
•
•
•
•
P(Have disease) = 17 / 1500
P(Test positive) = 19 / 1500
P(Have disease | test positive) = 15 / 19
P(Have disease | test negative) = 2 / 1481
P(Test positive | have disease) = 15 / 17
P(Test positive | no disease) = 4 / 1483
But a pharmaceutical company
gives us:
• Sensitivity = 15 / 17
• Specificity = 1479 / 1483
• If we know the base rate (probability of
having the disease), then we can use
Bayes’ theorem to figure out
P(disease | positive test).
• (worked out in R)