Data Science
Data science tests diagnostic test interpretation, hypothesis testing, study validity and common statistical traps.
Core rules
- Sensitivity = TP/(TP+FN); specificity = TN/(TN+FP); PPV = TP/(TP+FP); NPV = TN/(TN+FN).
- PPV and NPV depend on prevalence; sensitivity and specificity do not.
- ROC AUC 0.5 is chance; 1.0 is perfect discrimination.
- A p-value is the probability of data at least as extreme if the null hypothesis is true; it is not the probability that the null is true.
- A 95% CI for a ratio crossing 1 indicates no significant difference at the 0.05 threshold.
Worked example
A test has sensitivity 90% and specificity 90% in 1,000 patients with 10% prevalence. Diseased = 100: TP 90, FN 10. Non-diseased = 900: FP 90, TN 810. PPV = 90/(90+90) = 50%. NPV = 810/(810+10) = 98.8%. In a 1% prevalence population the same test has PPV about 8%, showing why screening tests need high specificity.
Traps
- Confusing PPV with sensitivity.
- Ignoring attrition or intention-to-treat effects.
- Treating surrogate endpoints as patient-important outcomes.
- Multiple comparisons inflate type I error.