Lec 21
Lec 21
Statistics 102
Colin Rundel
Bird keepers are not 4x more likely to develop lung cancer than non-bird
keepers.
P(disease|exposed)
RR =
P(disease|unexposed)
P(disease|exposed)/[1 − P(disease|exposed)]
OR =
P(disease|unexposed)/[1 − P(disease|unexposed)]
3.91 × 0.05
0.95
P(lung cancer|birds) = = 0.171
1 + 3.91 × 0.05
0.95
Bird OR Curve
1.0
0.8
P(lung cancer | birds)
0.6
0.4
0.2
●
0.0
OR Curves
If you’ve ever watched the TV show House on Fox, you know that Dr.
House regularly states, “It’s never lupus.”
The test for lupus is very accurate if the person actually has lupus,
however is very inaccurate if the person does not. More specifically, the
test is 98% accurate if a person actually has the disease. The test is 74%
accurate if a person does not have the disease.
Lupus? Result
positive, 0.98
0.02*0.98 = 0.0196
yes, 0.02
negative, 0.02
0.02*0.02 = 0.0004
positive, 0.26
0.98*0.26 = 0.2548
no, 0.98
negative, 0.74
0.98*0.74 = 0.7252
P(+, Lupus)
P(Lupus|+) =
P(+, Lupus) + P(+, No Lupus)
0.0196
= = 0.0714
0.0196 + 0.2548
Statistics 102 (Colin Rundel) Lec 21 April 17, 2013 8 / 28
Sensitivity and Specificity
The example does not give us any information about how a diagnosis is
made, but what it does give us is just as important - the sensitivity and
the specificity of the test. These values are critical for our understanding
of what a positive or negative test result actually means.
P(Test − | Condition −)
= P(−|no lupus) = 0.74
Condition Condition
Positive Negative
So what?
Additionally, our brief foray into power analysis before the first midterm
should also give you an idea about the trade offs that are inherent in
minimizing false positive and false negative rates (increasing power
required either increasing α or n).
How should we use this information when we are trying to come up with a
decision?
Back to Spam
While not the only possible solution, we will consider a simple approach
where we choose a threshold probability and any email that exceeds that
probability is flagged.
Picking a threshold
Predicted probability
For our data set picking a threshold of 0.75 gives us the following results:
FN = 340 TP = 27
TN = 3545 FP = 9
What are the sensitivity and specificity for this particular decision rule?
Predicted probability
1.0 ●
●
●
●
0.8
●●
●
Sensitivity
0.6
●
●●
●
0.4
●
●
●
●●
0.2
●
●
●
●
●
●
0.0
●
●
●
1 − Specificity
1.0
0.8
True positive rate
0.6
0.4
0.2
0.0
Comparing models
1.0
0.8
True positive rate
0.6
0.4
0.2
Utility Functions
If you’ve taken an economics course you have probably heard of the idea of
utility functions, we can assign costs and benefits to each of the possible
outcomes and use those to calculate a utility for each circumstance.
To write down a utility function for a spam filter we need to consider the
costs / benefits of each out.
Outcome Utility
True Positive 1
True Negative 1
False Positive -50
False Negative -5
For the email data set picking a threshold of 0.75 gives us the following
results:
FN = 340 TP = 27
TN = 3545 FP = 9
Utility curve
●
−2e+04
−6e+04
U
−1e+05
p
Statistics 102 (Colin Rundel) Lec 21 April 17, 2013 26 / 28
Utility Functions
●
1600
U[p > 0.6]
1400
●
1200
Maximum Utility
1 (spam)
0 (not spam)
Predicted probability