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)
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( 1 st coin toss is 'H' OR 2 nd coin toss is 'H') –P( 1 st IQ > 136 OR 2 nd 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( 1 st coin toss = 'H' AND 2 nd coin toss = 'H') –P( 1 st spin > ½ AND 2 nd 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( 1 st coin toss is 'H' OR 2 nd coin toss is 'H') – ½ + ½ - (½ * ½) = ¾. –P( 1 st IQ > 136 OR 2 nd IQ > 136) – * .0027.
Empirical validation of probability laws An interlude in R occurs here.
Bayes' theorem Bayes' theorem provides a way to reverse conditional probabilities: Equivalently,
Deriving Bayes’ theorem
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 Specificity is
Here’s a hypothetical table Has EC Does not have EC Tests positive Tests negative
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)