Biostatistics
M2 MVA · Semester 2 · Modelling · 5 ECTS
Contents
- Introduction and overview
- 0. Review: statistical inference for clinical data
- 1. Clinical research questions and study designs
- 2. Randomized controlled trials: design and sample size
- 3. Therapeutic evaluation and biases in clinical research
- 4. Censored data I: survival functions, Kaplan–Meier and the log-rank test
- 5. Censored data II: the Cox model and time-dependent covariates
- 6. Validating predictive models in health science
- 7. Introduction to causal inference
- 8. Complements: further designs and survival topics
- 9. Research directions and open problems
- Exercises
- Projects and assessment
- References
Introduction and overview
| Module | Biostatistics |
| Official title | Biostatistics |
| Instructors | R. PORCHER (master-mva.com, 2026–2027) |
| Period | Semester 2 · period 2 (04/01/2027 – 02/04/2027) |
| Credits and volume | 5 ECTS · 27 h (lectures 24 h, project 3 h) per the Université Paris-Saclay programme table |
| Label | ModellingTrack Santé |
| Language | Not displayed; the course description on master-mva.com is written in English |
| Assessment | Final exam (60%) and home project and presentation (40%) (master-mva.com, “Mode de validation”); the Université Paris-Saclay course detail gives the nature of the assessment as “Evaluation Continue non Intégrale” |
| Prerequisites | No formal prerequisites, but undergraduate courses in probability or statistics will help (master-mva.com, “Prè-requis”) |
Audience: a student trained in mathematics, computer science or physics who will analyse clinical data, build a risk score or work with physicians, and who needs the statistical language in which medicine decides what works.
Empirical first: give a drug with no effect at all to the patients of a cohort who happen to start it during follow-up, then compare “users” with “non-users” from the start of follow-up. The users can die at one third of the rate of the non-users (ch. 3, Proposition 3.10), only because they had to stay alive long enough to start the drug. Mantel and Byar (1974) used heart-transplant data to show how this waiting time biases a naive comparison in favour of transplantation.
Biostatistics is the statistics of clinical research. The course follows the two goals that the official description puts at its centre, prediction and causation, and the methods it singles out as not covered elsewhere in the master: the design of studies and trials, the analysis of censored (time-to-event) data, and causal inference.
It is the statistical companion of the other courses of the Santé track, such as Deep Learning for Medical Imaging and Representation Learning for Computer Vision and Medical Imaging, whose models end up evaluated in clinical studies. It shares the bootstrap and Monte Carlo tools of Computational Statistics and the causal graphs of Introduction to Probabilistic Graphical Models and Deep Generative Models.
What you will be able to do
- Translate a clinical question into an estimand, and choose a study design that can answer it.
- Compute and interpret risk differences, risk ratios, odds ratios, hazard ratios and numbers needed to treat, with their confidence intervals.
- Plan a randomized trial: randomization scheme, endpoints, sample size for binary, continuous and time-to-event outcomes, and interim analyses.
- Recognize selection, information, confounding and time-dependent biases, and quantify them in simple models.
- Estimate survival curves from censored data with the Kaplan–Meier and Nelson–Aalen estimators, and compare groups with the log-rank test.
- Fit and check a Cox proportional hazards model, use time-dependent covariates, and estimate cumulative incidences under competing risks.
- Validate a clinical prediction model: discrimination, calibration, Brier score, optimism correction and decision curves.
- Define causal effects with potential outcomes and estimate them from observational data by standardization, inverse probability weighting and doubly robust estimators.
- Read a causal diagram, choose an adjustment set, and emulate a target trial with observational data.
- Implement these methods from scratch in NumPy, and check them on simulated data where the truth is known.
Official objectives and syllabus (2026–2027)
The course description on master-mva.com aims at introducing both the concepts and the methods used in clinical (or medical) research, as part of the health-science theme of the master. It emphasizes the principles and concepts that underlie the different goals of clinical research, prediction and causation, and it develops specific statistical methods to plan studies and to analyse their data.
The description focuses on notions and methods that are not covered by other courses of the master, such as design, survival analysis and causal inference, treated from both the theoretical and the applied point of view and illustrated on several practical examples. It announces 7 lectures of 3 hours, each comprising formal lectures and practical work, and a final 3-hour presentation of the group home projects.
| Official topic | Course section |
|---|---|
| Theme: design of clinical studies and trials | ch. 1 (research questions, cohort and case-control designs, phases of drug development); ch. 2 (randomization, concealment and blinding, endpoints, sample size, non-inferiority, multiplicity, analysis populations); ch. 8, sections 8.1–8.4 and 8.7 (estimands, non-compliance, group-sequential designs, cluster and crossover trials, sample size of survival trials) |
| Theme: principles of therapeutic evaluation | ch. 3, section 3.1 (efficacy and effectiveness, explanatory and pragmatic trials, the principles of a fair comparison, absolute and relative effects, numbers needed to treat and to harm); intention to treat in section 2.7; subgroup analyses in section 8.5 |
| Theme: biases in clinical research | ch. 3, section 3.2 (selection and information bias, misclassification, regression to the mean) |
| Theme: confounding bias | ch. 3, section 3.3 (Simpson’s paradox, stratification, Mantel–Haenszel); formal treatment in ch. 7 |
| Theme: time-dependent bias | ch. 3, section 3.4 (immortal time, Propositions 3.10–3.11, lead-time and length-time bias); time-dependent covariates and landmark analysis in ch. 5, section 5.4; target trial emulation in section 7.7 |
| Theme: introduction to the analysis of censored data (survival, time-to-event data) | ch. 4 (hazard, censoring, likelihood, Kaplan–Meier, Greenwood, Nelson–Aalen, log-rank test); ch. 5 (Cox model, partial likelihood, proportional hazards, time-dependent covariates); sections 8.6–8.8 (restricted mean survival time, sample size, competing risks) |
| Theme: principles of the validation of predictive models in health science | ch. 6 (discrimination, calibration, Brier score, optimism and internal validation, net benefit); section 8.9 (survival models, external validation and updating) |
| Theme: introduction to causal inference | ch. 7 (potential outcomes, g-formula, inverse probability weighting, propensity score, doubly robust estimation, causal diagrams, target trial emulation, E-value) |
| “Les intervenants” (heading that closes the list of themes) | Fiche above: Raphaël Porcher (Université Paris Cité, as listed on master-mva.com) |
| Objective: the two goals of clinical research, prediction and causation | ch. 1, section 1.1, then ch. 6 (prediction) and ch. 7 (causation) |
| Objective: methods to plan studies and analyse their data | Planning: ch. 2, sections 8.3–8.4 and 8.7; analysis: ch. 3 to ch. 8 |
| Objective: methods illustrated on several practical examples | Worked examples and runnable Python in every chapter (kidney stones, immortal time, simulated trials and cohorts); the projects use public clinical data sets |
| Organisation: 7 lectures of 3 hours, each with formal lectures and practical work | Sessions 1–8 of the session plan, each with exercises and a lab in the Practice column |
| Organisation: final group home project presentation (3 hours) | Session 9 of the session plan; group projects |
| Université Paris-Saclay course detail: “Nature de l’évaluation: Evaluation Continue non Intégrale” | Fiche above (Assessment row) and Projects and assessment |
Extensions beyond the syllabus: the review ch. 0, decision curves (section 6.6), doubly robust estimation and the E-value (ch. 7), group-sequential designs and competing risks (ch. 8), and the research directions of ch. 9.
Where this course fits in the programme
Official prerequisites: there are no formal prerequisites, but undergraduate courses in probability or statistics will help. The course is a second-semester Modelling course of 5 ECTS of the Santé track, taught by Raphaël Porcher (Université Paris Cité, as listed on master-mva.com).
- Refreshers — Probability and Statistics for ch. 0 and the asymptotics used throughout; Scientific Python, NumPy and PyTorch for the labs; Linear Algebra, Analysis and Optimization for the Newton iterations of the logistic and Cox models.
- First-semester courses that prepare it — Introduction to Statistical Learning (risk, overfitting, cross-validation); Computational Statistics (bootstrap, Monte Carlo); Introduction to Probabilistic Graphical Models and Deep Generative Models (directed graphs, d-separation); Medical Image Analysis Based on Generative, Geometric and Biophysical Models (the clinical side of the Santé track).
- Related second-semester courses — Deep Learning for Medical Imaging and Representation Learning for Computer Vision and Medical Imaging (models whose validation follows ch. 6); Functional Brain Imaging and Brain–Computer Interfaces; Bayesian Machine Learning; Responsible Machine Learning (fairness and causality); Stopping Times and Online Algorithms (the stopping problems behind interim analyses); Regulating AI (medical AI as a regulated product).
- Alongside and after the course — the Hospital Immersion: Paired Project with a Physician, where the questions of ch. 1 are met in practice, and the Research Internship.
Course outline
- Review: statistical inference for clinical data — Wald intervals and the delta method, effect measures of a two-by-two table, tests and power, logistic regression.
- Clinical research questions and study designs — describing, predicting and explaining; cohort and case-control studies; phases of drug development.
- Randomized controlled trials: design and sample size — why and how to randomize, concealment and blinding, endpoints, sample size, non-inferiority, multiplicity, intention to treat.
- Therapeutic evaluation and biases in clinical research — absolute and relative effects, selection and information bias, regression to the mean, confounding and Mantel–Haenszel, immortal time.
- Censored data I — survival function and hazard, censoring, likelihood, the Kaplan–Meier estimator and Greenwood’s formula, the log-rank test.
- Censored data II — the Cox model and its partial likelihood, checking proportional hazards, time-dependent covariates and landmark analysis.
- Validating predictive models in health science — discrimination, calibration, Brier score, optimism and internal validation, net benefit.
- Introduction to causal inference — potential outcomes, standardization, inverse probability weighting, the propensity score, doubly robust estimation, causal diagrams, target trial emulation, sensitivity analysis.
- Complements: further designs and survival topics — estimands, non-compliance, group-sequential designs, cluster trials, subgroups, restricted mean survival time, sample size of survival trials, competing risks, validation of survival models (self-study).
- Research directions and open problems — principal strata, machine learning for survival data, heterogeneous treatment effects, real-world evidence, prediction models with AI, platform trials (self-study).
Session plan
27 h in class = 9 sessions of 3 h.
The volume is the Université Paris-Saclay programme table (lectures 24 h, project 3 h). master-mva.com announces 7 lectures of 3 h, each combining formal lectures and practical work, followed by a 3 h presentation of the group home projects, which makes 24 h; the plan below uses the 3 extra lecture hours of the programme table for an eighth lecture session. The split of the content into sessions is a proposal.
Level 1 = foundations, 2 = core results and methods, 3 = advanced or research-level material; the level never decreases.
| Session | Hours | Level | Content | Practice |
|---|---|---|---|---|
| 1 | 3 h | 1 | ch. 0 Review: Wald intervals, delta method, effect measures, tests, logistic regression; ch. 1 Clinical research questions, cohort and case-control designs, phases of drug development | Ex. 1–2; lab: Codes 0.9 and 1.6 |
| 2 | 3 h | 1 | ch. 2.1–2.4 Randomized trials: potential outcomes and randomization, procedures, concealment and blinding, endpoints, sample size | Ex. 3; lab: Code 2.9 (power by simulation, block lists) |
| 3 | 3 h | 2 | ch. 2.5–2.7 Non-inferiority, multiplicity, intention to treat; ch. 3.1–3.2 Therapeutic evaluation, bias, misclassification, regression to the mean | Ex. 9 |
| 4 | 3 h | 2 | ch. 3.3–3.4 Confounding, Simpson’s paradox, Mantel–Haenszel, immortal time | Ex. 4; lab: Code 3.12 |
| 5 | 3 h | 2 | ch. 4 Censored data I: hazard, censoring, likelihood, Kaplan–Meier, Greenwood, Nelson–Aalen, log-rank | Ex. 5, 10; lab: Code 4.12 |
| 6 | 3 h | 2 | ch. 5 Censored data II: Cox model, partial likelihood, proportional hazards, time-dependent covariates | Ex. 6, 11; lab: Code 5.7 |
| 7 | 3 h | 2 | ch. 6 Validating predictive models: discrimination, calibration, Brier score, optimism, net benefit | Ex. 7, 12; lab: Code 6.14 |
| 8 | 3 h | 3 | ch. 7 Causal inference: potential outcomes, g-formula, IPW, propensity score, AIPW, causal diagrams, target trials, E-value | Ex. 8, 13, 16, 18; lab: Code 7.13 |
| 9 | 3 h | 3 | Presentation of the group home projects (the official final session) | Projects |
Self-study, outside the 27 h (about 9 h in total): ch. 8 Complements: further designs and survival topics (≈ 4 h, with Ex. 14, 15, 17 and Codes 8.6, 8.15) · ch. 9 Research directions and open problems (≈ 3 h) · the written-exam proposal of the Projects and assessment section, as a self-test before the final exam (≈ 2 h).
How to study this module
- Read ch. 0 even if inference feels familiar: the delta method and the score equations of the logistic model come back in every later chapter.
- Redo each worked example with a pencil before running its code; then change one number (the effect, the censoring, the sample size) and predict the new output before you run it again.
- Run every code block: they use NumPy, SciPy and scikit-learn only, with fixed seeds and simulated data, and each runs in a few seconds on a laptop (about ten for the Cox code of ch. 5). The survival and causal estimators are written from scratch so that every formula of the page is visible in the code.
- Read the sections of ch. 8 as their chapters are taught: 8.1–8.5 after session 3, 8.6–8.8 after session 6, 8.9 after session 7.
- After each session, solve the exercises of the Practice column; the ★★★ exercises are good starting points for the home project.
- Keep a running list of the biases met in ch. 3: ch. 5 and ch. 7 give the analyses that remove them, and the final exam is likely to ask for that link.
0. Review: statistical inference for clinical data
Clinical research reports almost every result as an effect measure with a confidence interval or a test. This chapter recalls the M1-level tools behind those numbers, on the objects used throughout the course: proportions, two-by-two tables and the logistic model.
0.1 Wald intervals and the delta method
Definition 0.1 — Asymptotically normal estimator, Wald interval An estimator \hat\theta_n of a real parameter \theta is asymptotically normal with asymptotic variance \sigma^2 if \sqrt{n}\,(\hat\theta_n - \theta) \xrightarrow{\ d\ } \mathcal{N}(0, \sigma^2).
Let \widehat{\mathrm{se}} satisfy \sqrt{n}\,\widehat{\mathrm{se}} \to \sigma in probability, and let z_q be the q-quantile of the standard normal law, so that z_{0.975} = 1.96. The Wald interval \hat\theta_n \pm z_{1-\alpha/2}\, \widehat{\mathrm{se}} then has asymptotic coverage 1 - \alpha.
For a proportion \hat p = X/n with X \sim \mathrm{Bin}(n, p), the central limit theorem gives the standard error \sqrt{\hat p (1 - \hat p)/n}. Ratios are better handled on the log scale, which needs the delta method.
Proposition 0.2 — Delta method Assume \sqrt{n}(\hat\theta_n - \theta) converges in distribution to \mathcal{N}(0, \sigma^2), and let g be differentiable at \theta. Then \sqrt{n}\,\big(g(\hat\theta_n) - g(\theta)\big) \xrightarrow{\ d\ } \mathcal{N}\big(0,\ g'(\theta)^2 \sigma^2\big).
Proof. Asymptotic normality implies \hat\theta_n \to \theta in probability. By differentiability, g(\hat\theta_n) - g(\theta) = \big(g'(\theta) + r_n\big)(\hat\theta_n - \theta), \qquad r_n \to 0 \text{ in probability}.
Multiply by \sqrt n. The term g'(\theta)\sqrt{n}(\hat\theta_n - \theta) converges to \mathcal{N}(0, g'(\theta)^2\sigma^2).
The remainder r_n \sqrt{n}(\hat\theta_n - \theta) is the product of a term bounded in probability and a term tending to zero, so it tends to zero. Slutsky’s lemma concludes. ∎
The multivariate version replaces g'(\theta)^2\sigma^2 by \nabla g(\theta)^\top \Sigma\, \nabla g(\theta).
0.2 Two-by-two tables and effect measures
Definition 0.3 — Risk difference, risk ratio, odds ratio Let p_1 and p_0 be the probabilities of an event, for example death within one year, in a treated and a control group. The three usual effect measures are \mathrm{RD} = p_1 - p_0, \qquad \mathrm{RR} = \frac{p_1}{p_0}, \qquad \mathrm{OR} = \frac{p_1/(1-p_1)}{p_0/(1-p_0)} .
The number needed to treat is \mathrm{NNT} = 1/|\mathrm{RD}|: the number of patients to treat to avoid one event, on average.
When the event is rare in both groups, 1 - p_a \approx 1 and the odds ratio is close to the risk ratio. With frequent events they differ, and the odds ratio is always further from 1 than the risk ratio.
Proposition 0.4 — Standard errors on the log scale Let a events occur among n_1 treated patients and c among n_0 controls, independently, and set b = n_1 - a, d = n_0 - c. Then, asymptotically, \widehat{\mathrm{Var}}(\log \widehat{\mathrm{RR}}) = \frac1a - \frac1{n_1} + \frac1c - \frac1{n_0}, \qquad \widehat{\mathrm{Var}}(\log \widehat{\mathrm{OR}}) = \frac1a + \frac1b + \frac1c + \frac1d .
Proof. For one group, apply Proposition 0.2 with g(p) = \log p. Since g'(p) = 1/p, \mathrm{Var}(\log \hat p) \approx \frac{1}{p^2}\cdot\frac{p(1-p)}{n} = \frac{1}{np} - \frac1n , which is estimated by 1/a - 1/n_1.
For the odds, take g(p) = \log\frac{p}{1-p}, so that g'(p) = \frac{1}{p(1-p)}. Then \mathrm{Var}(g(\hat p)) \approx \frac{1}{np(1-p)} = \frac{1}{np} + \frac{1}{n(1-p)}, estimated by 1/a + 1/b. The two groups are independent, so the variances of the log ratios are sums. ∎
The interval for the odds ratio is due to Woolf (1955). The intervals are computed on the log scale and then exponentiated, so they are not symmetric around the estimate.
Example 0.5 — A two-arm trial A trial records 30 deaths among 200 treated patients and 50 among 200 controls, so \hat p_1 = 0.15 and \hat p_0 = 0.25. Code 0.9 gives:
- risk difference -0.10, 95 % CI [-0.178, -0.022], hence \mathrm{NNT} = 10;
- risk ratio 0.60, 95 % CI [0.399, 0.902];
- odds ratio 0.529, 95 % CI [0.320, 0.876].
All three intervals exclude the value of no effect, which is 0 for a difference and 1 for a ratio.
0.3 Tests, errors and power
Definition 0.6 — Test, error rates, p-value A test of a null hypothesis H_0 rejects H_0 when a statistic falls in a rejection region.
- Its type I error rate \alpha is the probability of rejecting H_0 when H_0 is true.
- Its power 1 - \beta is the probability of rejecting H_0 under a given alternative; \beta is the type II error rate.
- The p-value is the smallest level at which the observed data lead to rejection.
The two-sided Wald test of \theta = \theta_0 at level \alpha rejects exactly when \theta_0 lies outside the Wald interval of level 1 - \alpha. This duality is used in ch. 2 for non-inferiority trials.
Reading a p-value A p-value is not the probability that H_0 is true. A large p-value in a small trial is not evidence that the treatment has no effect: “absence of evidence is not evidence of absence” (Altman and Bland, 1995). Report the effect and its confidence interval, not only the test.
0.4 Likelihood and logistic regression
Definition 0.7 — Logistic regression For a binary outcome Y and a covariate vector x \in \mathbb{R}^p whose first entry is 1, \log \frac{P(Y = 1 \mid x)}{1 - P(Y = 1 \mid x)} = x^\top \beta .
For a binary covariate x_j, e^{\beta_j} is the odds ratio comparing x_j = 1 with x_j = 0 at fixed values of the other covariates.
Proposition 0.8 — Score, information and Newton–Raphson Write p_i = 1/(1 + e^{-x_i^\top\beta}). The log-likelihood \ell(\beta) of independent observations (x_i, y_i) has score and observed information U(\beta) = \sum_i x_i\,(y_i - p_i), \qquad I(\beta) = -\nabla^2 \ell(\beta) = \sum_i p_i(1 - p_i)\, x_i x_i^\top .
Hence \ell is concave, so any root of U is the maximum likelihood estimator. The Newton iteration \beta \leftarrow \beta + I(\beta)^{-1} U(\beta) finds it in a few steps in practice; step halving guarantees convergence when the estimator exists. Under the usual regularity conditions, \hat\beta is approximately \mathcal{N}(\beta, I(\hat\beta)^{-1}).
Proof. The contribution of observation i is \ell_i = y_i x_i^\top\beta - \log(1 + e^{x_i^\top\beta}). Its gradient is x_i(y_i - p_i).
The gradient of p_i is p_i(1 - p_i)x_i, so the Hessian of \ell is -\sum_i p_i(1-p_i)x_ix_i^\top, a negative semi-definite matrix: \ell is concave.
The asymptotic normality is the general theory of maximum likelihood (van der Vaart, 1998, chapter 5). ∎
The first component of U(\hat\beta) = 0 reads \sum_i (y_i - \hat p_i) = 0: the fitted risks average to the observed proportion. Chapter 6 uses this identity to explain why calibration can never be judged on the development data.
Code 0.9 — Effect measures of Example 0.5, and the same odds ratio by logistic regression
import numpy as np
from scipy import stats
# 2x2 table: events / patients in each arm (Example 0.5)
a, n1 = 30, 200 # treated: 30 events out of 200
c, n0 = 50, 200 # control: 50 events out of 200
p1, p0 = a / n1, c / n0
z = stats.norm.ppf(0.975)
rd = p1 - p0
se_rd = np.sqrt(p1 * (1 - p1) / n1 + p0 * (1 - p0) / n0)
rr = p1 / p0
se_logrr = np.sqrt(1 / a - 1 / n1 + 1 / c - 1 / n0)
odds = (a * (n0 - c)) / ((n1 - a) * c)
se_logor = np.sqrt(1 / a + 1 / (n1 - a) + 1 / c + 1 / (n0 - c))
print(f"RD {rd:.3f} [{rd - z*se_rd:.3f}, {rd + z*se_rd:.3f}]")
print(f"RR {rr:.3f} [{rr*np.exp(-z*se_logrr):.3f}, {rr*np.exp(z*se_logrr):.3f}]")
print(f"OR {odds:.3f} [{odds*np.exp(-z*se_logor):.3f}, {odds*np.exp(z*se_logor):.3f}]")
# The same odds ratio from a logistic regression fitted by Newton-Raphson
x = np.r_[np.ones(n1), np.zeros(n0)]
y = np.r_[np.ones(a), np.zeros(n1 - a), np.ones(c), np.zeros(n0 - c)]
X = np.c_[np.ones_like(x), x]
beta = np.zeros(2)
for _ in range(25):
p = 1 / (1 + np.exp(-X @ beta))
score = X.T @ (y - p)
info = X.T @ (X * (p * (1 - p))[:, None])
beta += np.linalg.solve(info, score)
se = np.sqrt(np.diag(np.linalg.inv(info)))
print(f"logistic: OR {np.exp(beta[1]):.3f}, SE(log OR) {se[1]:.4f} vs Woolf {se_logor:.4f}")
# RD -0.100 [-0.178, -0.022]
# RR 0.600 [0.399, 0.902]
# OR 0.529 [0.320, 0.876]
# logistic: OR 0.529, SE(log OR) 0.2567 vs Woolf 0.2567Key takeaways — chapter 0
- Wald intervals rest on asymptotic normality; ratios get their intervals on the log scale through the delta method.
- Risk difference, risk ratio and odds ratio answer different questions; the number needed to treat is the inverse of the risk difference.
- Power is the probability of detecting a given effect; a non-significant test is not a proof of no effect.
- The logistic log-likelihood is concave; its score equations make the fitted risks average to the observed proportion.
1. Clinical research questions and study designs
A study is designed to answer a question, and the same data can answer some questions and not others. This chapter separates the kinds of questions that clinical research asks, describes the observational and experimental designs that answer them, and proves the property that makes case-control studies work.
1.1 Describe, predict, explain
Definition 1.1 — Descriptive, predictive and causal questions
- A descriptive question asks for a quantity in a population: the prevalence of diabetes in a country, the median survival after a diagnosis.
- A predictive question asks for the risk of an outcome for an individual, given the information available at a given time. It is diagnostic when the outcome is present now and prognostic when it occurs later. Any variable that improves the prediction may be used, whatever its causal role.
- A causal question asks what would happen to the outcome if an intervention were applied, for instance a treatment. The variables used for adjustment are chosen by causal reasoning (ch. 7), not by their predictive value.
The official course description puts the second and third goals at its centre: ch. 6 is about prediction, ch. 7 about causation, and the designs of ch. 1–2 serve both.
Example 1.2 — One cohort, two questions
- Grey hair predicts death within ten years in a cohort of adults. It belongs in a prognostic model, yet dyeing one’s hair would not change one’s risk.
- A study of the effect of statins on myocardial infarction must not adjust for the LDL cholesterol measured after the start of treatment. That variable is a consequence of the treatment and carries part of its effect.
- The same cholesterol value may be an excellent predictor in a model that forecasts infarction, since there the question is not causal.
1.2 Observational designs
Definition 1.3 — Cohort, case-control and cross-sectional studies
- In a cohort study, subjects are classified by exposure and followed forward in time, either prospectively or from historical records; incidences, risk ratios and rates can be estimated.
- In a case-control study, subjects with the outcome (cases) and without it (controls) are sampled separately, and their past exposure is measured. The design is efficient for rare outcomes, but the risk of the outcome cannot be estimated directly.
- In a cross-sectional study, exposure and outcome are measured at the same time, which gives prevalences.
Theorem 1.4 — Case-control sampling preserves the odds ratio Let E be a binary exposure and D a binary disease in a source population. Suppose cases are sampled with probability s_1 and non-cases with probability s_0, independently of exposure. Then the exposure odds ratio in the sample equals the disease odds ratio in the population: \frac{P(E \mid D, S)\,/\,P(\bar E \mid D, S)}{P(E \mid \bar D, S)\,/\,P(\bar E \mid \bar D, S)} = \frac{P(D \mid E)\,/\,P(\bar D \mid E)}{P(D \mid \bar E)\,/\,P(\bar D \mid \bar E)} .
Proof. Sampling depends on D only, so P(E \mid D, S) = P(E \mid D), and the same holds for \bar D. The sample exposure odds ratio is therefore the population exposure odds ratio.
By Bayes’ formula, \frac{P(E \mid D)}{P(\bar E \mid D)} = \frac{P(D \mid E)\,P(E)}{P(D \mid \bar E)\,P(\bar E)}, \qquad \frac{P(E \mid \bar D)}{P(\bar E \mid \bar D)} = \frac{P(\bar D \mid E)\,P(E)}{P(\bar D \mid \bar E)\,P(\bar E)} .
In the ratio of these two expressions the prevalence terms cancel, which leaves the disease odds ratio. ∎
The theorem goes back to Cornfield (1951). When the disease is rare, the odds ratio approximates the risk ratio (ch. 0), so a case-control study estimates a risk ratio without ever following a cohort.
Example 1.5 — A simulated case-control study In a population of one million, 10 % are exposed. The risk of disease is 1 % if exposed and 1/3 % if not, so the risk ratio is 3.
Code 1.6 samples all cases and four controls per case. It finds an odds ratio of 2.99 in the full cohort and 2.92 in the case-control sample.
The proportion of cases among exposed subjects of the sample, 0.38, means nothing: it reflects the 1:4 sampling ratio chosen by the investigator, not a risk.
Code 1.6 — Case-control sampling
import numpy as np
rng = np.random.default_rng(1)
# Source population: exposure E, disease D with risk 1 % if exposed, 1/3 % if not
N = 1_000_000
E = rng.random(N) < 0.10
D = rng.random(N) < np.where(E, 0.010, 0.010 / 3)
def odds_ratio(e, d):
a, b = np.sum(e & d), np.sum(e & ~d)
c, dd = np.sum(~e & d), np.sum(~e & ~d)
return (a * dd) / (b * c)
rr = D[E].mean() / D[~E].mean()
print(f"cohort: RR {rr:.2f}, OR {odds_ratio(E, D):.2f}")
# Case-control study: all cases, 4 controls per case drawn among non-cases
cases = np.flatnonzero(D)
controls = rng.choice(np.flatnonzero(~D), size=4 * cases.size, replace=False)
idx = np.r_[cases, controls]
print(f"case-control ({cases.size} cases): OR {odds_ratio(E[idx], D[idx]):.2f}")
print(f"naive 'risk' among exposed in the case-control sample: {D[idx][E[idx]].mean():.2f}")
# cohort: RR 2.97, OR 2.99
# case-control (4093 cases): OR 2.92
# naive 'risk' among exposed in the case-control sample: 0.38The theorem assumes that controls represent the source population of the cases and that exposure is measured alike in both groups; ch. 3 shows what happens otherwise.
1.3 Experimental designs and the phases of drug development
In an experimental study the investigator assigns the intervention. A new drug goes through four phases before and after it reaches the market.
Definition 1.7 — Phases of clinical development
- Phase I: first administration to humans, often healthy volunteers; safety, pharmacokinetics and the choice of dose, on a few dozen subjects.
- Phase II: preliminary evidence of efficacy and refinement of the dose in patients, in single-arm or small randomized trials.
- Phase III: confirmatory randomized controlled trial against placebo or the standard of care, with a pre-specified primary endpoint and analysis, usually on hundreds or thousands of patients.
- Phase IV: surveillance after marketing approval, to detect rare or late adverse effects.
Each design comes with a reporting guideline that lists what a paper must state: CONSORT for randomized trials (Schulz et al., 2010), STROBE for observational studies (von Elm et al., 2007), and TRIPOD for prediction models (ch. 6).
1.4 Framing the question
A clinical question is framed by the PICO scheme: Population, Intervention, Comparator, Outcome. Regulatory guidance now asks for a more precise target, the estimand, which also says how events such as stopping treatment or taking a rescue medication are handled; section 8.1 presents it.
Key takeaways — chapter 1
- Descriptive, predictive and causal questions need different analyses; a good predictor need not be a cause.
- Cohort studies estimate risks; case-control studies estimate odds ratios, which approximate risk ratios for rare outcomes (Theorem 1.4).
- Drugs are developed in four phases; phase III trials are randomized and confirmatory.
- A study starts from a precise question: population, intervention, comparator and outcome.
2. Randomized controlled trials: design and sample size
The randomized controlled trial is the reference design to evaluate a treatment. This chapter explains why randomization works, how it is carried out, and how the number of patients is computed. It then covers non-inferiority, repeated looks at the data, and the choice of the analysis population.
2.1 Why randomize
Definition 2.1 — Potential outcomes For each patient and each treatment a \in \{0, 1\}, let Y(a) be the outcome that would be observed if the patient received a. The observed outcome of a patient who receives A is Y = A\,Y(1) + (1 - A)\,Y(0) \qquad \text{(consistency)}.
The individual effect Y(1) - Y(0) is never observed, since each patient receives one treatment only. The average treatment effect is \mathrm{ATE} = E[Y(1) - Y(0)].
This formalism goes back to Neyman (1923) and Rubin (1974); ch. 7 develops it for observational data.
Theorem 2.2 — Randomization identifies the average effect Let L denote all baseline characteristics of a patient, measured or not. Suppose that the assignment A is independent of (Y(0), Y(1), L) and that 0 < P(A = 1) < 1. Then E[Y \mid A = 1] - E[Y \mid A = 0] = E[Y(1) - Y(0)] .
Proof. By consistency, E[Y \mid A = 1] = E[Y(1) \mid A = 1]. By independence, this equals E[Y(1)].
The same argument gives E[Y \mid A = 0] = E[Y(0)], and the difference is the average treatment effect. ∎
The difference of the sample means is therefore an unbiased estimate of the average effect. The independence holds for unmeasured characteristics too, which no adjustment of an observational study can guarantee (ch. 3 and 7).
2.2 Randomization procedures, concealment and blinding
Definition 2.3 — Randomization procedures
- Simple randomization assigns each patient by an independent fair coin.
- Permuted blocks cut the allocation list into blocks of size 2k, each a random permutation of k treated and k control assignments, so that the arms are balanced after every block.
- Stratified randomization uses a separate block list within each stratum of a strong prognostic factor, such as the centre or the stage of the disease.
- Minimization (Taves, 1974; Pocock and Simon, 1975) assigns each new patient to the arm that minimizes an imbalance score over several prognostic factors, usually with a random element.
Proposition 2.4 — Imbalance under simple randomization With n patients, the size N_1 of the treated arm is \mathrm{Bin}(n, 1/2). With a continuity correction, P\big(|N_1 - n/2| \ge k\big) \approx 2\Big(1 - \Phi\Big(\frac{2k - 1}{\sqrt n}\Big)\Big).
Proof. By the central limit theorem, N_1 is approximately normal with mean n/2 and variance n/4. The integer event |N_1 - n/2| \ge k is replaced by |N_1 - n/2| \ge k - 1/2, and the standardized threshold is (k - 1/2)/(\sqrt n/2). ∎
With n = 100 and k = 5, the probability of a split at least as unbalanced as 45/55 is 0.368, both exactly and by the formula. Block randomization removes this risk, which matters for small trials and for subgroups.
Definition 2.5 — Allocation concealment and blinding
- Allocation concealment means that whoever enrols a patient cannot know the next assignment. Without it, investigators may consciously or not steer patients to an arm, which is a selection bias.
- Blinding (masking) hides the assignment after randomization, from patients, caregivers, outcome assessors or analysts. With a placebo, a trial can be double blind.
When blinding is impossible, as for surgery, the outcome can still be assessed by a blinded committee (the PROBE design: prospective randomized open blinded end-point).
2.3 Endpoints
Definition 2.6 — Endpoints
- The primary endpoint is the single pre-specified outcome on which the trial is sized and judged.
- Secondary endpoints support the interpretation, but a positive secondary result cannot rescue a negative primary one.
- A surrogate endpoint is a biomarker meant to stand in for a clinical outcome, such as blood pressure for stroke.
- A composite endpoint counts the first of several events, such as death, infarction or stroke.
Surrogates can mislead In the Cardiac Arrhythmia Suppression Trial (CAST Investigators, 1989), encainide and flecainide suppressed ventricular arrhythmias after myocardial infarction, a surrogate believed to predict sudden death, yet they increased mortality compared with placebo.
2.4 Sample size for a superiority trial
Theorem 2.7 — Sample size of a two-arm trial Two arms of n patients have outcomes with means \mu_1, \mu_0 and variances \sigma_1^2, \sigma_0^2.
The two-sided z-test of equal means at level \alpha has power 1 - \beta at the difference \Delta = \mu_1 - \mu_0 when
Key result — sample size per arm n = \frac{(z_{1-\alpha/2} + z_{1-\beta})^2\,(\sigma_1^2 + \sigma_0^2)}{\Delta^2}
For a binary endpoint, \sigma_a^2 = p_a(1 - p_a).
Proof. The statistic is Z = (\bar Y_1 - \bar Y_0)/\mathrm{se} with \mathrm{se} = \sqrt{(\sigma_1^2 + \sigma_0^2)/n}. Under the alternative, Z is approximately \mathcal{N}(\Delta/\mathrm{se}, 1); take \Delta > 0.
Neglecting the rejection in the wrong direction, the power is P(Z > z_{1-\alpha/2}) = \Phi\big(\Delta/\mathrm{se} - z_{1-\alpha/2}\big).
Setting it to 1 - \beta gives \Delta/\mathrm{se} = z_{1-\alpha/2} + z_{1-\beta}. Squaring and solving for n gives the formula. ∎
Halving the expected effect multiplies the trial by four, and the formula is only as good as the assumed effect and variance.
Example 2.8 — A trial on mortality The control mortality is p_0 = 0.30 and the trial must detect p_1 = 0.20 with \alpha = 0.05 and power 0.90. Then z_{0.975} + z_{0.90} = 1.960 + 1.282 = 3.242 and n = \frac{3.242^2 \times (0.21 + 0.16)}{0.10^2} = 388.8, \quad \text{so } 389 \text{ patients per arm}.
With 10 % expected losses to follow-up, 389/0.9 gives 433 per arm. Code 2.9 checks the power by simulation.
Code 2.9 — Sample size, simulated power and block randomization
import numpy as np
from scipy import stats
rng = np.random.default_rng(2)
def n_per_arm(p0, p1, alpha=0.05, power=0.90):
z = stats.norm.ppf(1 - alpha / 2) + stats.norm.ppf(power)
return int(np.ceil(z**2 * (p0 * (1 - p0) + p1 * (1 - p1)) / (p1 - p0) ** 2))
n = n_per_arm(0.30, 0.20)
print("n per arm:", n)
# Power of the two-sided z-test by simulation (10 000 trials)
def z_test(x1, x0, n):
p1, p0 = x1 / n, x0 / n
se = np.sqrt(p1 * (1 - p1) / n + p0 * (1 - p0) / n)
return (p1 - p0) / se
reps = 10_000
z_alt = z_test(rng.binomial(n, 0.20, reps), rng.binomial(n, 0.30, reps), n)
z_null = z_test(rng.binomial(n, 0.30, reps), rng.binomial(n, 0.30, reps), n)
print(f"simulated power {np.mean(np.abs(z_alt) > 1.96):.3f}, "
f"type I error {np.mean(np.abs(z_null) > 1.96):.3f}")
# Permuted blocks of size 4, stratified by centre (3 centres, 10 patients each)
def block_list(n_patients):
seq = []
while len(seq) < n_patients:
seq += list(rng.permutation(["A", "A", "B", "B"]))
return seq[:n_patients]
for centre in range(3):
print("centre", centre, "".join(block_list(10)))
# n per arm: 389
# simulated power 0.899, type I error 0.050
# centre 0 BBAAAABBBA
# centre 1 BABAABABAB
# centre 2 BABABABABA2.5 Non-inferiority and equivalence
A new treatment that is cheaper, safer or easier to take need not be better: it is enough that it is not much worse.
Definition 2.10 — Non-inferiority and equivalence Let larger outcomes be better, and let \delta > 0 be a non-inferiority margin fixed in advance. A non-inferiority trial tests H_0: \mu_1 - \mu_0 \le -\delta \qquad \text{against} \qquad H_1: \mu_1 - \mu_0 > -\delta .
An equivalence trial shows |\mu_1 - \mu_0| < \delta by two one-sided tests.
Proposition 2.11 — Non-inferiority by a confidence interval The one-sided Wald test of non-inferiority at level \alpha/2 rejects H_0 exactly when the lower bound of the two-sided 1 - \alpha interval for \mu_1 - \mu_0 lies above -\delta.
If the true difference is \Delta \ge 0, the sample size is that of Theorem 2.7 with \Delta replaced by \Delta + \delta.
Proof. The test rejects when \frac{\bar Y_1 - \bar Y_0 + \delta}{\mathrm{se}} > z_{1-\alpha/2}, \quad \text{that is, when} \quad \bar Y_1 - \bar Y_0 - z_{1-\alpha/2}\,\mathrm{se} > -\delta .
Under the alternative the statistic is centred at (\Delta + \delta)/\mathrm{se}, and the power calculation of Theorem 2.7 applies unchanged. ∎
Pitfalls of non-inferiority The margin must be smaller than the effect of the active comparator against placebo, which is known only from historical trials (the constancy assumption). Poor compliance makes the two arms look alike and so favours non-inferiority; the intention-to-treat analysis of section 2.7 is therefore not conservative here, and both it and the per-protocol analysis are reported (Piaggio et al., 2012).
2.6 Multiplicity and interim analyses
Every additional test is another chance of a false positive.
Proposition 2.12 — Bonferroni correction If each of K tests is performed at level \alpha/K, the probability of at least one false rejection (the family-wise error rate) is at most \alpha, whatever the dependence between the tests.
Proof. Let R_k be the event that true null hypothesis k is rejected. By the union bound, P\Big(\bigcup_k R_k\Big) \le \sum_k P(R_k) \le K \cdot \frac{\alpha}{K} = \alpha .
∎
Holm’s step-down procedure (Holm, 1979) controls the same error rate and is uniformly more powerful.
Repeated looks at accumulating data are a form of multiplicity: trials are monitored for safety and efficacy, and stopping at the first p < 0.05 inflates the type I error. Section 8.3 computes this inflation and the group-sequential boundaries that control it.
2.7 Analysis populations and non-compliance
Definition 2.13 — Intention to treat, per protocol
- The intention-to-treat (ITT) analysis includes every randomized patient, in the arm to which the patient was randomized, whatever the treatment actually received.
- The per-protocol analysis keeps only the patients who followed the protocol.
- The as-treated analysis groups patients by the treatment actually received.
Only the ITT comparison inherits Theorem 2.2. The other two compare groups selected after randomization, and adherence is itself prognostic. In the Coronary Drug Project (1980), patients who took at least 80 % of their placebo had a much lower five-year mortality than those who did not.
Under non-compliance the ITT effect is diluted towards zero (section 8.2): it estimates the effect of assigning a treatment, while a valid per-protocol comparison needs the causal methods of ch. 7.
Two common variants of the parallel-group design, cluster and crossover trials, are treated in section 8.4.
Key takeaways — chapter 2
- Randomization makes treatment independent of all baseline factors, measured or not, so the difference of means estimates the average effect (Theorem 2.2).
- Blocks and stratification keep arms balanced; concealment and blinding protect the comparison after randomization.
- The sample size per arm (Theorem 2.7) grows like 1/\Delta^2: halving the effect multiplies it by four.
- Non-inferiority is shown by a confidence interval above -\delta; repeated looks need group-sequential boundaries.
- Intention to treat preserves randomization; per-protocol and as-treated analyses compare groups selected after randomization.
3. Therapeutic evaluation and biases in clinical research
An estimate can be precise and wrong. This chapter states what a treatment effect should be measured against, defines bias, reviews its main sources, and studies in detail the two named in the official syllabus: confounding bias and time-dependent bias.
3.1 Principles of therapeutic evaluation
A treatment is evaluated for efficacy, its effect under the controlled conditions of an explanatory trial, and for effectiveness, its effect in routine care, which a pragmatic trial measures with broad eligibility and usual practice (Schwartz and Lellouch, 1967).
A fair evaluation rests on the principles of ch. 2:
- a concurrent control group, since historical controls differ in case mix and care;
- randomized, concealed allocation and, when possible, blinded assessment;
- one pre-specified, clinically relevant primary endpoint;
- the analysis of all randomized patients (intention to treat, section 2.7).
Every decision then weighs benefit against harm, on the absolute scale.
Example 3.1 — A constant relative effect, a varying absolute benefit Suppose a treatment reduces the risk of stroke by a quarter in every patient, so \mathrm{RR} = 0.75. A patient with baseline risk p_0 gains \mathrm{RD} = p_0(1 - \mathrm{RR}), \qquad \mathrm{NNT} = \frac{1}{p_0(1 - \mathrm{RR})} .
- With p_0 = 0.20, the NNT is 20.
- With p_0 = 0.02, the NNT is 200.
Suppose the treatment also causes a major bleed in 1 % of patients, whatever their risk. The number needed to harm is then \mathrm{NNH} = 1/0.01 = 100. Per 100 patients treated:
- at p_0 = 0.20, 5 strokes are prevented for 1 bleed;
- at p_0 = 0.02, 0.5 stroke is prevented for 1 bleed.
The same relative effect can justify treating high-risk patients and not low-risk ones.
Effects reported in subgroups are fragile; section 8.5 shows how to test them.
3.2 Bias and its main sources
Definition 3.2 — Bias The bias of an estimator \hat\theta of an estimand \theta is E[\hat\theta] - \theta, or the difference between the limit of \hat\theta and \theta when the sample size grows (asymptotic bias). Random error shrinks as the sample grows; bias does not.
Epidemiology classifies biases in three families:
- selection bias, from the way subjects enter or remain in the analysis;
- information bias, from errors in measuring exposure, outcome or covariates;
- confounding, from common causes of exposure and outcome (section 3.3).
Selection bias arises when hospital controls are used in a case-control study, when patients lost to follow-up have a different prognosis, or when only “healthy users” persist with a preventive drug.
Proposition 3.3 — Non-differential misclassification of the outcome Suppose a binary outcome is recorded with the same sensitivity \mathrm{Se} and specificity \mathrm{Sp} in both arms. The recorded risk is p^* = \mathrm{Se}\, p + (1 - \mathrm{Sp})(1 - p) in each arm, and \mathrm{RD}^* = (\mathrm{Se} + \mathrm{Sp} - 1)\, \mathrm{RD}.
Proof. The map p \mapsto \mathrm{Se}\,p + (1-\mathrm{Sp})(1-p) is affine with slope \mathrm{Se} + \mathrm{Sp} - 1, and a difference of images of an affine map is the slope times the difference. ∎
The observed difference is shrunk towards zero: with \mathrm{Se} = 0.8 and \mathrm{Sp} = 0.9, it keeps 70 % of its size. Differential errors can bias in either direction, as when cases recall past exposures better than controls (recall bias).
A third source of error mimics a treatment effect when patients are selected on an extreme measurement.
Proposition 3.4 — Regression to the mean Let a baseline measurement X_1 and a follow-up measurement X_2 be jointly normal, with the same mean \mu, the same variance and correlation \rho. Then E[X_2 \mid X_1 = x] = \mu + \rho\,(x - \mu).
Proof. For a bivariate normal pair, E[X_2 \mid X_1 = x] = \mu + \frac{\mathrm{Cov}(X_1, X_2)}{\mathrm{Var}(X_1)}\,(x - \mu), and the ratio equals \rho when the variances are equal. ∎
Patients enrolled because their systolic pressure is 170 mmHg, in a population with mean 140 and test–retest correlation 0.7, will have an expected pressure of 161 at the next visit, without any treatment. Only a concurrent, randomized control group separates this drop from the effect of a drug.
3.3 Confounding
Definition 3.5 — Confounding and confounder There is confounding when the crude association between an exposure A and an outcome Y differs from the causal effect of A on Y because of common causes. A confounder L is, informally, a variable that
- is associated with A;
- is a cause of Y, or a proxy for a cause, among the unexposed;
- is not affected by A.
In therapeutic studies the most common form is confounding by indication: physicians treat the patients who need it most, who also have the worst prognosis.
Example 3.6 — Simpson’s paradox: kidney stones Charig et al. (1986) compared open surgery (A) with percutaneous nephrolithotomy (B). The success rates were:
| Stone size | Open surgery (A) | Percutaneous (B) |
|---|---|---|
| Small | 81/87 (93 %) | 234/270 (87 %) |
| Large | 192/263 (73 %) | 55/80 (69 %) |
| All | 273/350 (78 %) | 289/350 (83 %) |
Surgery A does better for small stones and for large stones, yet worse overall. Large stones are both harder to treat and more often treated by A: stone size confounds the crude comparison.
The first remedy is to compare like with like within strata of the confounder, then to pool the stratum-specific comparisons.
Definition 3.7 — Mantel–Haenszel odds ratio In stratum k, let a_k, b_k be the events and non-events among the exposed, c_k, d_k among the unexposed, and n_k the stratum size. The Mantel–Haenszel (1959) estimator of a common odds ratio is \widehat{\mathrm{OR}}_{\mathrm{MH}} = \frac{\sum_k a_k d_k / n_k}{\sum_k b_k c_k / n_k} .
Proposition 3.8 — Consistency of the Mantel–Haenszel estimator If the odds ratio \psi is the same in every stratum, \widehat{\mathrm{OR}}_{\mathrm{MH}} converges to \psi when the stratum sizes grow with a fixed number of strata.
Proof. In stratum k, with n_{1k} exposed and n_{0k} unexposed subjects and risks p_{1k}, p_{0k}, the law of large numbers gives \frac{a_k d_k}{n_k} \approx \frac{n_{1k}n_{0k}}{n_k}\, p_{1k}(1 - p_{0k}), \qquad \frac{b_k c_k}{n_k} \approx \frac{n_{1k}n_{0k}}{n_k}\, (1 - p_{1k})\,p_{0k} .
A common odds ratio means p_{1k}(1 - p_{0k}) = \psi\,(1 - p_{1k})\,p_{0k} in every stratum. Each term of the numerator is thus \psi times the matching term of the denominator, and the ratio of the sums tends to \psi. ∎
The estimator remains consistent when the number of strata grows with fixed small strata, such as matched pairs, where the unconditional maximum likelihood estimator is inconsistent (Breslow, 1981). On the kidney-stone data, Code 3.12 gives stratum odds ratios of 2.08 and 1.23, a Mantel–Haenszel odds ratio of 1.45 in favour of A, and a crude odds ratio of 0.75.
Regression, standardization and propensity scores (ch. 7) also adjust for confounders, but only for measured ones: residual confounding remains the main weakness of observational studies.
3.4 Time-dependent bias: immortal time
Many exposures start during follow-up, such as a drug prescribed after discharge. Classifying subjects by their exposure status at the end of follow-up biases the comparison in favour of the exposure.
Definition 3.9 — Immortal time Immortal time is a period of follow-up during which, by construction of the analysis, the outcome cannot occur in the group to which the time is attributed. The typical case is the time between cohort entry and the start of treatment, counted as treated time for subjects classified as “ever treated” because they eventually start the treatment (Suissa, 2008).
Proposition 3.10 — Size of the immortal-time bias Let the time to death be T \sim \mathrm{Exp}(\lambda) and the time to start of treatment be W \sim \mathrm{Exp}(\mu), independent, so that the treatment has no effect. Classify subjects as ever treated if W < T and never treated otherwise, and compute each group’s death rate as deaths divided by person-time from entry. Then the rate ratio converges to \frac{\text{rate}_{\text{ever}}}{\text{rate}_{\text{never}}} = \frac{\lambda}{2\lambda + \mu} < \frac12 .
Proof. Without censoring, every subject eventually dies.
- Never treated. Deaths occur with probability P(T < W) = \lambda/(\lambda + \mu), and the person-time is E[T\,\mathbb{1}\{T < W\}] = \int_0^\infty t\,\lambda e^{-\lambda t} e^{-\mu t}\,dt = \frac{\lambda}{(\lambda + \mu)^2}, so the rate is \lambda + \mu.
- Ever treated. Deaths occur with probability \mu/(\lambda + \mu), and the person-time is E[T] - \frac{\lambda}{(\lambda+\mu)^2} = \frac{1}{\lambda} - \frac{\lambda}{(\lambda+\mu)^2} = \frac{\mu\,(2\lambda + \mu)}{\lambda\,(\lambda + \mu)^2}, so the rate is \lambda(\lambda + \mu)/(2\lambda + \mu).
The empirical rates converge to these ratios of expectations by the law of large numbers, and dividing the two rates gives the result. ∎
When the waiting time to treatment has the same mean as the survival time (\mu = \lambda), a useless drug appears to divide mortality by three. The never-treated rate is inflated too, because those subjects are selected for dying early.
Proposition 3.11 — The correct person-time split In the model of Proposition 3.10, attribute each subject’s time before W to the untreated state and the time after W to the treated state. Then both death rates converge to \lambda, and the rate ratio to 1.
Proof. Untreated state. Each subject spends \min(T, W) \sim \mathrm{Exp}(\lambda + \mu) there, with mean 1/(\lambda+\mu), and dies there with probability \lambda/(\lambda + \mu): the rate is \lambda.
Treated state. A subject enters it with probability \mu/(\lambda + \mu). By the memoryless property, the remaining time T - W given T > W is \mathrm{Exp}(\lambda), with mean 1/\lambda, and it ends in death. The rate is \frac{\mu/(\lambda+\mu)}{\mu/\big(\lambda(\lambda+\mu)\big)} = \lambda .
∎
The person-time split becomes a time-dependent covariate in the Cox model of ch. 5 (Mantel and Byar, 1974); landmark analyses and target trial emulation (ch. 7) are the other remedies. Lévesque et al. (2010) show the bias at work in a cohort of statin users.
Other time-related biases
- Time-window bias: exposure measured over windows of different lengths for cases and controls.
- Lead-time bias: earlier diagnosis by screening lengthens survival from diagnosis even when death is not delayed.
- Length-time bias: screening preferentially detects slowly progressing tumours.
Code 3.12 — Mantel–Haenszel on the kidney-stone data, and immortal time by simulation
import numpy as np
rng = np.random.default_rng(4)
# Kidney stones (Charig et al., 1986): successes and patients, open surgery (A) vs PCNL (B)
strata = {"small": (81, 87, 234, 270), "large": (192, 263, 55, 80)}
num = den = 0.0
for name, (sa, na, sb, nb) in strata.items():
a, b, c, d = sa, na - sa, sb, nb - sb # A success, A failure, B success, B failure
n = na + nb
print(f"{name}: A {sa/na:.2f}, B {sb/nb:.2f}, OR {a*d/(b*c):.2f}")
num += a * d / n
den += b * c / n
SA, NA = 81 + 192, 87 + 263
SB, NB = 234 + 55, 270 + 80
print(f"crude: A {SA/NA:.2f}, B {SB/NB:.2f}, OR {SA*(NB-SB)/((NA-SA)*SB):.2f}")
print(f"Mantel-Haenszel OR {num/den:.2f}")
# Immortal time bias: death T ~ Exp(lam), treatment start W ~ Exp(mu), no effect at all
lam, mu, n = 0.1, 0.1, 200_000
T = rng.exponential(1 / lam, n)
W = rng.exponential(1 / mu, n)
ever = W < T
naive = (ever.sum() / T[ever].sum()) / ((~ever).sum() / T[~ever].sum())
print(f"naive 'ever vs never' rate ratio {naive:.3f}, theory {lam/(2*lam+mu):.3f}")
# Correct person-time split: untreated time [0, min(W, T)), treated time [W, T)
pt_untreated = np.minimum(W, T).sum()
pt_treated = np.clip(T - W, 0, None).sum()
d_untreated, d_treated = (~ever).sum(), ever.sum()
print(f"person-time rate ratio {(d_treated/pt_treated)/(d_untreated/pt_untreated):.3f}")
# small: A 0.93, B 0.87, OR 2.08
# large: A 0.73, B 0.69, OR 1.23
# crude: A 0.78, B 0.83, OR 0.75
# Mantel-Haenszel OR 1.45
# naive 'ever vs never' rate ratio 0.334, theory 0.333
# person-time rate ratio 0.997Key takeaways — chapter 3
- A fair evaluation needs a concurrent randomized control, a pre-specified endpoint and intention to treat; a constant relative effect gives absolute benefits proportional to the baseline risk, to be weighed against absolute harms.
- Bias does not shrink with the sample size; its sources are selection, information and confounding.
- Non-differential outcome misclassification shrinks the risk difference by \mathrm{Se} + \mathrm{Sp} - 1; regression to the mean needs a concurrent control group.
- Confounding can reverse an association (Simpson’s paradox); stratification and the Mantel–Haenszel estimator remove confounding by measured factors.
- Classifying subjects by exposure ever received creates immortal time: a useless treatment can look protective by a factor of 2 or more; person-time must be split at the start of treatment.
4. Censored data I: survival functions, Kaplan–Meier and the log-rank test
In many clinical studies the outcome is a time: time to death, to relapse, to discharge from hospital. For many patients follow-up ends before the event, and their time is only known to exceed the follow-up: it is censored. This chapter defines the objects that describe a time to event and estimates them without any parametric model.
4.1 Survival function and hazard
Definition 4.1 — Survival function, hazard, cumulative hazard For a non-negative random time T with density f: S(t) = P(T > t), \qquad h(t) = \lim_{dt \to 0} \frac{P(t \le T < t + dt \mid T \ge t)}{dt} = \frac{f(t)}{S(t)}, \qquad H(t) = \int_0^t h(u)\,du .
The hazard h(t) is the instantaneous event rate among the subjects still event-free at t.
Proposition 4.2 — From hazard to survival In continuous time, S(t) = \exp\big(-H(t)\big).
In discrete time, with h_u = P(T = u \mid T \ge u), the survival is S(t) = \prod_{u \le t} (1 - h_u).
Proof. Since f = -S', the hazard is h = -S'/S = -(\log S)'. Integrating from 0 with S(0) = 1 gives \log S(t) = -H(t).
In discrete time, surviving beyond t means surviving each time u \le t given survival up to u; the chain rule of conditional probabilities gives the product. ∎
Example 4.3 — Exponential and Weibull laws
- A constant hazard h(t) = \lambda gives S(t) = e^{-\lambda t}, with mean 1/\lambda and median \log 2/\lambda.
- The Weibull hazard h(t) = \lambda\gamma t^{\gamma - 1} gives S(t) = \exp(-\lambda t^\gamma). It increases with time when \gamma > 1 (ageing) and decreases when \gamma < 1 (the risk just after surgery).
4.2 Censoring
Definition 4.4 — Right censoring Let C be the time at which follow-up stops. One observes X = \min(T, C), \qquad \delta = \mathbb{1}\{T \le C\}.
Censoring is independent (or non-informative) when T and C are independent, possibly given covariates.
Censoring comes from the end of the study (administrative censoring), from losses to follow-up and from withdrawals. Independence is plausible for the first and doubtful when patients leave because they feel worse.
A related phenomenon is left truncation: subjects enter observation at a time V > 0, for instance at the date of referral, and are seen only if T > V. Risk sets then include a subject only after its entry time, as in the (\text{start}, \text{stop}] format of ch. 5.
Example 4.5 — Why naive summaries fail Ten patients are followed for at most 15 months (Example 4.9 below). Five die and five are censored.
- The proportion of deaths, 5/10, underestimates the risk, since censored patients could still die; excluding them overestimates it.
- The mean of the observed times underestimates the mean survival.
Both summaries depend on the follow-up duration, a property of the study, not of the disease.
4.3 Likelihood under right censoring
Proposition 4.6 — Censored-data likelihood Under independent censoring whose distribution does not involve the parameters of T, the likelihood of (x_i, \delta_i)_{i \le n} is proportional to \prod_{i=1}^n f(x_i)^{\delta_i}\, S(x_i)^{1 - \delta_i} = \prod_{i=1}^n h(x_i)^{\delta_i}\, \exp\big(-H(x_i)\big).
Proof. An event observed at x has probability P(T \in dx, C > x) = f(x)\,dx\; P(C > x). A censoring at x has probability P(T > x)\, P(C \in dx).
The factors involving C do not depend on the parameters of T and drop out. The second form uses f = hS and S = e^{-H}. ∎
For the exponential law, the log-likelihood is D\log\lambda - \lambda \sum_i x_i with D = \sum_i \delta_i the number of events, so that
\hat\lambda = \frac{D}{\sum_i x_i} = \frac{\text{number of events}}{\text{person-time}} .
The observed information is D/\hat\lambda^2, so \mathrm{se}(\log \hat\lambda) = 1/\sqrt{D}: the precision depends on the number of events, not on the number of patients. For the ten patients of Example 4.9, D = 5 over 78 months of follow-up gives \hat\lambda = 0.064 per month and an estimated median survival of \log 2/\hat\lambda = 10.8 months.
4.4 The Kaplan–Meier estimator
Definition 4.7 — Kaplan–Meier estimator Let t_1 < \dots < t_K be the distinct event times, d_j the number of events at t_j, and n_j the number of subjects at risk just before t_j, that is, with X_i \ge t_j. The Kaplan–Meier (1958) estimator is
Key result — Kaplan–Meier estimator \hat S(t) = \prod_{j:\ t_j \le t} \Big(1 - \frac{d_j}{n_j}\Big)
The estimator applies Proposition 4.2 in discrete time: each conditional probability of surviving an event time is estimated by the proportion of survivors among those at risk. Censored subjects count in the risk sets until they leave, and independent censoring makes those at risk representative. The curve drops only at event times; it is the nonparametric maximum likelihood estimator.
Theorem 4.8 — Greenwood’s formula The variance of the Kaplan–Meier estimator is estimated by \widehat{\mathrm{Var}}\big(\hat S(t)\big) = \hat S(t)^2 \sum_{j:\ t_j \le t} \frac{d_j}{n_j(n_j - d_j)} .
Proof. Sketch. Write \log \hat S(t) = \sum_j \log(1 - \hat h_j) with \hat h_j = d_j/n_j. Given the risk set, d_j is approximately binomial (n_j, h_j), and the terms are uncorrelated because each is centred given the past (a martingale structure).
By the delta method, \mathrm{Var}\big(\log(1 - \hat h_j)\big) \approx \frac{h_j}{n_j(1 - h_j)}, \quad \text{estimated by} \quad \frac{d_j}{n_j(n_j - d_j)} .
Summing gives the variance of \log\hat S(t), and a second delta method, with g = \exp, multiplies it by \hat S(t)^2. A rigorous proof uses counting processes (Andersen et al., 1993, ch. IV). ∎
Intervals computed on the \log(-\log) scale stay within [0, 1] and have better coverage than the plain Wald interval.
Example 4.9 — Kaplan–Meier by hand Ten patients have the following follow-up times in months, where “+” marks a censored time: 3, 4+, 5, 5, 6+, 8, 9+, 11, 12+, 15+.
| t_j | n_j | d_j | 1 - d_j/n_j | \hat S(t_j) | Greenwood s.e. |
|---|---|---|---|---|---|
| 3 | 10 | 1 | 0.900 | 0.900 | 0.095 |
| 5 | 8 | 2 | 0.750 | 0.675 | 0.155 |
| 8 | 5 | 1 | 0.800 | 0.540 | 0.173 |
| 11 | 3 | 1 | 0.667 | 0.360 | 0.187 |
The patient censored at 4 months leaves the risk set before t = 5, hence n_2 = 8. The median survival is the first time at which \hat S \le 0.5: \hat t_{0.5} = 11 \text{ months}, close to the exponential estimate of 10.8 months.
Definition 4.10 — Nelson–Aalen estimator The cumulative hazard is estimated by \hat H(t) = \sum_{j:\ t_j \le t} \frac{d_j}{n_j} .
Since 1 - x \le e^{-x}, the survival estimate e^{-\hat H(t)} is slightly above \hat S(t).
4.5 Comparing two groups: the log-rank test
Theorem 4.11 — Log-rank test At each event time t_j, let n_j subjects be at risk, n_{1j} of them in group 1, and let d_j events occur, d_{1j} of them in group 1.
Under H_0: S_1 = S_0, and conditionally on these margins, d_{1j} is hypergeometric with E_{1j} = d_j\,\frac{n_{1j}}{n_j}, \qquad V_j = d_j\,\frac{n_{1j}}{n_j}\Big(1 - \frac{n_{1j}}{n_j}\Big)\frac{n_j - d_j}{n_j - 1} .
With O_1 = \sum_j d_{1j}, E_1 = \sum_j E_{1j} and V = \sum_j V_j, the statistic \frac{(O_1 - E_1)^2}{V} is approximately \chi^2_1 under H_0.
Proof. Sketch. Under H_0 every subject at risk at t_j has the same hazard. Given that d_j of the n_j subjects fail, every subset of d_j subjects is equally likely to be the one that fails, so d_{1j} is hypergeometric with the stated mean and variance.
The centred terms d_{1j} - E_{1j} have mean zero given the past of the study: they form a martingale difference sequence. The martingale central limit theorem then makes (O_1 - E_1)/\sqrt V asymptotically standard normal (Fleming and Harrington, 1991; Andersen et al., 1993). ∎
The test is due to Mantel (1966) and Peto and Peto (1972). It is the locally most powerful rank test against proportional-hazards alternatives (ch. 5) and loses power when the survival curves cross. Weighted versions put more weight on early differences (Gehan–Breslow) or, with suitable parameters, late ones (the Fleming–Harrington family), and the stratified log-rank test sums O - E and V over strata of a prognostic factor.
When hazards are not proportional, a single hazard ratio summarizes a difference poorly; the restricted mean survival time of section 8.6, the area under the survival curve up to a horizon, is then preferred.
Code 4.12 — Kaplan–Meier, Greenwood and log-rank from scratch
import numpy as np
from scipy import stats
rng = np.random.default_rng(5)
def kaplan_meier(time, event):
"""Event times, KM survival and Greenwood standard error."""
t = np.unique(time[event == 1])
n = np.array([(time >= s).sum() for s in t]) # at risk just before s
d = np.array([((time == s) & (event == 1)).sum() for s in t])
S = np.cumprod(1 - d / n)
with np.errstate(divide="ignore", invalid="ignore"):
gw = np.cumsum(d / (n * (n - d)))
return t, S, S * np.sqrt(gw)
def logrank(time, event, group):
O = E = V = 0.0
for s in np.unique(time[event == 1]):
at_risk = time >= s
n, n1 = at_risk.sum(), (at_risk & (group == 1)).sum()
d = ((time == s) & (event == 1)).sum()
d1 = ((time == s) & (event == 1) & (group == 1)).sum()
O += d1
E += d * n1 / n
if n > 1:
V += d * (n1 / n) * (1 - n1 / n) * (n - d) / (n - 1)
chi2 = (O - E) ** 2 / V
return O, E, chi2, stats.chi2.sf(chi2, 1)
# Example 4.9 by hand: months, 1 = death, 0 = censored
time = np.array([3, 4, 5, 5, 6, 8, 9, 11, 12, 15])
event = np.array([1, 0, 1, 1, 0, 1, 0, 1, 0, 0])
for s, S, se in zip(*kaplan_meier(time, event)):
print(f"t={s:2d} S={S:.3f} se={se:.3f}")
# Simulated trial: exponential survival, hazard ratio 0.6, uniform censoring
n = 150
group = np.r_[np.zeros(n), np.ones(n)]
T = rng.exponential(1 / np.where(group == 1, 0.06, 0.10))
C = rng.uniform(0, 24, 2 * n)
X, delta = np.minimum(T, C), (T <= C).astype(int)
t, S, se = kaplan_meier(X[group == 0], delta[group == 0])
k = np.searchsorted(t, 12, side="right") - 1
print(f"control S(12) = {S[k]:.3f} +/- {1.96*se[k]:.3f}; truth {np.exp(-0.10*12):.3f}")
O, E, chi2, p = logrank(X, delta, group)
print(f"log-rank: O={O:.0f}, E={E:.1f}, chi2={chi2:.2f}, p={p:.1e}")
# t= 3 S=0.900 se=0.095
# t= 5 S=0.675 se=0.155
# t= 8 S=0.540 se=0.173
# t=11 S=0.360 se=0.187
# control S(12) = 0.268 +/- 0.089; truth 0.301
# log-rank: O=60, E=85.5, chi2=17.72, p=2.6e-05Key takeaways — chapter 4
- A time to event is described by its survival function or its hazard, linked by S = e^{-H}.
- Censored observations contribute S(x) to the likelihood; with a constant hazard the estimate is events divided by person-time.
- The Kaplan–Meier estimator multiplies the conditional survival proportions at the event times; Greenwood’s formula gives its variance.
- The log-rank test sums observed minus expected events over the risk sets; it is optimal under proportional hazards.
5. Censored data II: the Cox model and time-dependent covariates
The log-rank test compares groups; clinical studies need to estimate an effect while accounting for several covariates, some of which change over time. The Cox model does this without specifying the baseline hazard. This chapter derives its partial likelihood, shows how to check its main assumption, and uses it to remove the immortal-time bias of ch. 3.
5.1 Proportional hazards
Definition 5.1 — Cox proportional hazards model The hazard of a subject with covariates x \in \mathbb{R}^p is h(t \mid x) = h_0(t)\, \exp(x^\top \beta), where the baseline hazard h_0 is left unspecified. Then S(t \mid x) = S_0(t)^{\exp(x^\top\beta)}.
The ratio of the hazards of two subjects does not depend on time: this is the proportional hazards assumption. For a binary treatment indicator x_j, e^{\beta_j} is the hazard ratio of treated versus untreated patients with the same other covariates.
5.2 The partial likelihood
Let R(t) = \{j : X_j \ge t\} be the risk set at t, and assume first that event times are distinct.
Theorem 5.2 — Partial likelihood (Cox, 1972, 1975) The parameter \beta is estimated by maximizing
Key result — Cox partial likelihood L(\beta) = \prod_{i:\ \delta_i = 1} \frac{\exp(x_i^\top\beta)}{\sum_{j \in R(x_i)} \exp(x_j^\top\beta)}
Write w_j = e^{x_j^\top\beta}, and let \bar x(\beta, t) and V(\beta, t) be the mean and covariance of the covariates over R(t) with weights proportional to w_j. The score and information are U(\beta) = \sum_{i:\ \delta_i = 1} \big(x_i - \bar x(\beta, x_i)\big), \qquad I(\beta) = \sum_{i:\ \delta_i = 1} V(\beta, x_i).
The log partial likelihood is concave, and \hat\beta is approximately \mathcal{N}(\beta, I(\hat\beta)^{-1}).
Proof. Given that exactly one event occurs at time t among the subjects of R(t), the probability that it is subject i is \frac{h_0(t)\,e^{x_i^\top\beta}\,dt}{\sum_{j \in R(t)} h_0(t)\,e^{x_j^\top\beta}\,dt} = \frac{w_i}{\sum_{j \in R(t)} w_j} : the baseline hazard cancels. The product of these probabilities over the event times is L(\beta).
The log of one factor is x_i^\top\beta - \log \sum_j w_j. Its gradient is x_i - \bar x(\beta, t), and its Hessian is -V(\beta, t), a covariance matrix and hence positive semi-definite: the log partial likelihood is concave.
The asymptotic normality follows from counting-process martingale theory (Andersen and Gill, 1982). ∎
With tied event times, Breslow’s approximation lets every tied event use the full risk set, which is what Code 5.7 does; Efron’s approximation is more accurate when ties are many.
Proposition 5.3 — The score test is the log-rank test For a single binary covariate (the group) and distinct event times, the score test of \beta = 0 in the Cox model is the log-rank test of Theorem 4.11.
Proof. At \beta = 0 all weights equal 1, so \bar x(0, t_j) = n_{1j}/n_j and U(0) = \sum_j (d_{1j} - n_{1j}/n_j) = O_1 - E_1.
The variance of a binary covariate over the risk set is V(0, t_j) = \frac{n_{1j}}{n_j}\Big(1 - \frac{n_{1j}}{n_j}\Big), which is V_j when d_j = 1. The score statistic U(0)^2/I(0) is therefore the log-rank statistic. ∎
Definition 5.4 — Breslow estimator and predicted survival The baseline cumulative hazard is estimated by \hat H_0(t) = \sum_{j:\ t_j \le t} \frac{d_j}{\sum_{l \in R(t_j)} \exp(x_l^\top \hat\beta)} , and the predicted survival of a new subject is \hat S(t \mid x) = \exp\big(-\hat H_0(t)\, e^{x^\top\hat\beta}\big).
With \hat\beta = 0 the Breslow estimator is the Nelson–Aalen estimator. Predicted survival curves are what a prognostic model reports, and section 8.9 shows how they are validated.
5.3 Checking proportional hazards
- Graphically, curves of \log(-\log \hat S_g(t)) against \log t should be parallel across the groups g.
- With residuals, the Schoenfeld residual of an event i is r_i = x_i - \bar x(\hat\beta, x_i). If the true coefficient varies with time, the residuals scaled by D\, I(\hat\beta)^{-1}, with D the number of events, have a mean close to \beta(t) - \hat\beta; Grambsch and Therneau (1994) turn this into a test.
- Remedies include stratifying the baseline hazard on the offending variable, letting the coefficient change over time through an interaction with a function of t, and reporting restricted mean survival times (section 8.6).
The hazards of hazard ratios Even in a randomized trial, the hazard ratio at a late time compares the survivors of each arm, who are no longer exchangeable once the treatment has selected them. Hernán (2010) recommends reporting adjusted survival curves or their differences rather than period-specific hazard ratios.
5.4 Time-dependent covariates
Definition 5.5 — Cox model with time-dependent covariates The hazard may depend on the current value of a covariate process x(t) known at time t: h\big(t \mid x(t)\big) = h_0(t)\, \exp\big(x(t)^\top\beta\big).
In the counting-process format, each subject is split into intervals (\text{start}, \text{stop}] on which the covariates are constant, and the risk set at t contains the intervals with \text{start} < t \le \text{stop}.
The same format handles left truncation, since a subject enters the risk sets only after its first start time.
Example 5.6 — Immortal time, analysed correctly Return to the useless treatment of Proposition 3.10 with \lambda = \mu = 0.1. Code 5.7 fits two Cox models on 4000 simulated subjects:
- with treatment coded at baseline as “ever treated”, the hazard ratio is 0.28;
- with x(t) = \mathbb{1}\{W < t\}, each treated subject contributing an untreated interval (0, W] and a treated interval (W, T], the hazard ratio is 0.93, with 95 % interval [0.86, 1.01].
The second analysis is the person-time split of Proposition 3.11 inside the Cox model; its interval covers 1, the absence of effect.
A landmark analysis (Anderson, Cain and Gelber, 1983) is the simple alternative: choose a time s, classify subjects by their treatment status at s, and analyse survival from s among those still alive.
Internal covariates A time-dependent covariate that is itself affected by earlier treatment, such as a biomarker measured during follow-up, can be used for prediction. It cannot simply be adjusted for when estimating the total effect of treatment, because it lies on the causal path; this needs the g-methods introduced in ch. 7.
Code 5.7 — The Cox model from scratch, with time-dependent covariates
import numpy as np
rng = np.random.default_rng(7)
def cox(start, stop, event, X, iters=30):
"""Cox partial likelihood (Breslow ties), counting-process data (start, stop]."""
X = np.atleast_2d(X.T).T
beta = np.zeros(X.shape[1])
times = np.unique(stop[event == 1])
for _ in range(iters):
U, I = np.zeros_like(beta), np.zeros((beta.size, beta.size))
for t in times:
R = (start < t) & (stop >= t) # risk set at t
D = (stop == t) & (event == 1) # failures at t
w = np.exp(X[R] @ beta)
xbar = w @ X[R] / w.sum()
cov = (X[R] * w[:, None]).T @ X[R] / w.sum() - np.outer(xbar, xbar)
U += X[D].sum(0) - D.sum() * xbar
I += D.sum() * cov
step = np.linalg.solve(I, U)
beta += step
if np.abs(step).max() < 1e-9:
break
return beta, np.sqrt(np.diag(np.linalg.inv(I)))
# (a) Recovering known log hazard ratios: h(t|x) = 0.1 exp(0.7 x1 - 0.5 x2)
n = 1000
X = np.c_[rng.integers(0, 2, n), rng.standard_normal(n)]
T = rng.exponential(1 / (0.1 * np.exp(X @ np.array([0.7, -0.5]))))
C = rng.uniform(0, 15, n)
b, se = cox(np.zeros(n), np.minimum(T, C), (T <= C).astype(int), X)
print("beta", b.round(3), "se", se.round(3))
# (b) Immortal time (ch. 3): useless treatment started at W ~ Exp(0.1), death T ~ Exp(0.1)
n = 4000
T, W = rng.exponential(10, n), rng.exponential(10, n)
ever = (W < T).astype(float)
b_naive, _ = cox(np.zeros(n), T, np.ones(n, int), ever)
# split treated subjects into (0, W] untreated and (W, T] treated
s = np.r_[np.zeros(n), W[W < T]]
e = np.r_[np.minimum(W, T), T[W < T]]
d = np.r_[(T <= W).astype(int), np.ones(int(ever.sum()), int)]
z = np.r_[np.zeros(n), np.ones(int(ever.sum()))]
b_td, se_td = cox(s, e, d, z)
lo, hi = np.exp(b_td[0] + np.array([-1.96, 1.96]) * se_td[0])
print(f"HR naive {np.exp(b_naive[0]):.2f}; time-dependent {np.exp(b_td[0]):.2f} [{lo:.2f}, {hi:.2f}]")
# beta [ 0.714 -0.523] se [0.086 0.045]
# HR naive 0.28; time-dependent 0.93 [0.86, 1.01]Key takeaways — chapter 5
- The Cox model multiplies an unspecified baseline hazard by e^{x^\top\beta}; e^{\beta_j} is a hazard ratio.
- The partial likelihood is a product over events of the probability that the failing subject is the one observed; it is concave, and its score test for one binary covariate is the log-rank test.
- Proportional hazards are checked with log–log plots and Schoenfeld residuals; when they fail, stratify, model \beta(t) or report restricted mean survival times.
- Exposures that start during follow-up must enter as time-dependent covariates or through a landmark: the ever-treated coding manufactures a protective effect.
6. Validating predictive models in health science
A prediction model is useful only if its predictions are accurate for new patients. This chapter defines what “accurate” means for a risk model (discrimination, calibration, overall error and clinical usefulness), explains why performance measured on the development data is optimistic, and shows how to correct it.
6.1 Prediction models and their life cycle
Definition 6.1 — Clinical prediction model A clinical prediction model is a function \hat p(x) that gives the probability of an outcome from predictors x available at the moment of prediction. The outcome is present now for a diagnostic model and occurs within a horizon \tau for a prognostic one.
A model goes through development, internal validation on the development population, external validation on patients from another time or place, and ideally an impact study. TRIPOD (Collins et al., 2015) and TRIPOD+AI (Collins et al., 2024) list what a report must contain. Performance has four aspects (Steyerberg et al., 2010), taken in turn below.
6.2 Discrimination
Definition 6.2 — ROC curve and AUC For a threshold c, the sensitivity is \mathrm{Se}(c) = P(\hat p \ge c \mid Y = 1) and the specificity is \mathrm{Sp}(c) = P(\hat p < c \mid Y = 0). The ROC curve traces (1 - \mathrm{Sp}(c), \mathrm{Se}(c)) as c varies, and the AUC is the area under it.
Theorem 6.3 — The AUC is a probability of correct ranking Let S_1 be the score of a random patient with the outcome (a case) and S_0 that of an independent random patient without it (a control). Then \mathrm{AUC} = P(S_1 > S_0) + \tfrac12\, P(S_1 = S_0).
The empirical AUC is the Mann–Whitney statistic divided by the number of case–control pairs.
Proof. For continuous scores, parametrize the curve by the false-positive rate u = P(S_0 \ge c). Then \mathrm{AUC} = \int_0^1 \mathrm{Se}\big(c(u)\big)\,du = \int P(S_1 \ge c)\, dF_{S_0}(c) = P(S_1 \ge S_0), where the last step conditions on S_0 = c and uses independence. With ties, the curve has diagonal segments, and the trapezoids contribute half of P(S_1 = S_0) (Hanley and McNeil, 1982). ∎
The AUC depends only on the ranks of the predictions, so it is unchanged by any increasing transformation of \hat p: a model can rank patients exactly as the true risk does, with the same AUC, and still predict odds that are all ten times too high.
Example 6.4 — AUC by hand Three cases have scores 0.8, 0.6, 0.4 and four controls have 0.7, 0.3, 0.2, 0.1. Of the 12 case–control pairs, the case scores higher in 4 + 3 + 3 = 10, so \mathrm{AUC} = 10/12 = 0.833 .
For time-to-event outcomes, Harrell’s C (Harrell et al., 1982) is the proportion of usable pairs, those whose shorter time is an event, in which the subject who fails first has the higher predicted risk. It depends on censoring, which Uno et al. (2011) correct by inverse probability of censoring weights.
6.3 Calibration
Definition 6.5 — Calibration A model is (strongly) calibrated if P\big(Y = 1 \mid \hat p(X) = p\big) = p \quad \text{for all } p .
Two weaker summaries are used in practice. Calibration-in-the-large compares the mean predicted risk with the observed proportion. The calibration slope is the coefficient b of the recalibration model \mathrm{logit}\, P(Y = 1) = a + b\, \mathrm{logit}\, \hat p(X).
A slope below 1 means that the predictions are too extreme, the signature of overfitting.
Proposition 6.6 — Apparent calibration-in-the-large and slope are always perfect For a logistic model with an intercept, fitted by maximum likelihood, the apparent calibration-in-the-large is exact and the apparent calibration slope is 1.
Proof. The score equations give \sum_i x_i(y_i - \hat p_i) = 0. The intercept component reads \sum_i (y_i - \hat p_i) = 0: the mean prediction equals the observed proportion.
Refit (a, b) on the linear predictor \hat\eta_i = x_i^\top\hat\beta. At (a, b) = (0, 1) the fitted risks are \hat p_i, and the two score equations of the recalibration model hold: \sum_i (y_i - \hat p_i) = 0, \qquad \sum_i \hat\eta_i\,(y_i - \hat p_i) = \hat\beta^\top \sum_i x_i\,(y_i - \hat p_i) = 0 .
The log-likelihood is concave (Proposition 0.8), so (0, 1) is its maximizer. ∎
Calibration can therefore only be assessed on new data or by resampling. A calibration plot shows the observed proportion against the predicted risk, by groups or with a smoother; Van Calster et al. (2019) call calibration “the Achilles heel of predictive analytics”.
6.4 Overall performance: the Brier score
Definition 6.7 — Brier score The Brier (1950) score is the mean squared error of the predicted probabilities, \mathrm{BS} = \frac1n \sum_{i=1}^n (\hat p_i - y_i)^2 .
Proposition 6.8 — Decomposition of the Brier score Let \pi(x) = P(Y = 1 \mid X = x) be the true risk. Then E\big[(\hat p(X) - Y)^2\big] = E\big[(\hat p(X) - \pi(X))^2\big] + E\big[\pi(X)\,(1 - \pi(X))\big].
Hence the expected Brier score is minimized by the true risk and by no other prediction: it is a strictly proper scoring rule.
Proof. Write \hat p - Y = (\hat p - \pi) + (\pi - Y) and expand the square. The cross term has expectation E\big[(\hat p(X) - \pi(X))\, E[\pi(X) - Y \mid X]\big] = 0, and E[(\pi(X) - Y)^2 \mid X] = \pi(X)(1 - \pi(X)). The first term vanishes only if \hat p = \pi almost surely. ∎
The second term is irreducible: it depends on how predictable the outcome is. Predicting the prevalence \bar y for everyone scores \bar y(1 - \bar y), and the scaled Brier score is 1 - \frac{\mathrm{BS}}{\bar y\,(1 - \bar y)} .
6.5 Overfitting, optimism and internal validation
Definition 6.9 — Optimism The optimism of a performance measure is the difference between its apparent value, on the development data, and its expected value on new patients from the same population.
Algorithm 6.10 — Bootstrap correction of optimism (Efron, 1983; Harrell et al., 1996)
- Fit the model on the full data and compute the apparent performance P_{\text{app}}.
- For b = 1, \dots, B: draw a bootstrap sample, repeat the whole modelling procedure on it (variable selection included), and compute the performance of the resulting model on the bootstrap sample, P_b^{\text{boot}}, and on the original data, P_b^{\text{orig}}.
- Estimate the optimism by the mean of P_b^{\text{boot}} - P_b^{\text{orig}}, and report P_{\text{app}} minus this optimism.
A single train–test split wastes data and gives unstable estimates; the bootstrap or repeated cross-validation is preferred (Steyerberg et al., 2001). The optimism grows with the number of candidate predictors per event. The rule of ten events per variable (Peduzzi et al., 1996) has given way to sample-size calculations that target, among other criteria, an expected calibration slope of at least 0.9 (Riley et al., 2020). Shrinkage, uniform (Van Houwelingen and Le Cessie, 1990) or penalized, reduces overfitting.
Example 6.11 — Optimism in a small data set Code 6.14 fits a logistic model with 20 candidate predictors, of which 4 matter, on 200 patients with 70 events (3.5 events per variable). It then checks the model on 20 000 new patients from the same population:
- AUC: apparent 0.857, bootstrap-corrected 0.790, on new patients 0.724;
- calibration slope on new patients: 0.46.
The bootstrap removes only half of the optimism seen on new patients (0.067 of 0.133): at so few events per variable its estimate is itself noisy. The slope shows predictions far too extreme.
6.6 Clinical usefulness: net benefit
A model is used to decide whom to treat, and discrimination and calibration do not say whether these decisions improve.
Definition 6.12 — Net benefit When patients with \hat p \ge t are treated, the net benefit at threshold t is \mathrm{NB}(t) = \frac{\mathrm{TP}}{n} - \frac{\mathrm{FP}}{n}\cdot \frac{t}{1 - t}, where TP and FP count true and false positives. A decision curve plots \mathrm{NB}(t) over a range of thresholds (Vickers and Elkin, 2006), together with “treat none”, whose net benefit is 0, and “treat all”, whose net benefit at prevalence \bar y is \bar y - (1 - \bar y)\,\frac{t}{1 - t} .
Proposition 6.13 — Meaning of the threshold Suppose treating a patient who has the outcome brings a benefit B, and treating one who does not causes a harm H. Treating a patient of risk p is worthwhile if and only if p > t with t = \frac{H}{H + B}, \qquad \text{equivalently} \qquad \frac{H}{B} = \frac{t}{1 - t} .
The net benefit is then the expected utility per patient of the model-guided policy, relative to treating nobody, in units of B.
Proof. The expected utility of treating a patient of risk p is pB - (1 - p)H, positive exactly when p > H/(H + B).
For the policy “treat if \hat p \ge t”, the utility per patient is (B \cdot \mathrm{TP} - H \cdot \mathrm{FP})/n. Dividing by B and replacing H/B by t/(1-t) gives \mathrm{NB}(t). ∎
In Code 6.14 the prevalence is 0.32. At t = 0.1 the model’s net benefit (0.232) is below that of treating everyone (0.240), so the model is useless there. At t = 0.2 it beats both alternatives (0.166 against 0.145 and 0).
Validation on patients from another setting (external validation), the updating of a model for a new setting, and the measures used for survival models are presented in section 8.9.
Code 6.14 — Apparent and corrected performance, calibration and net benefit
import numpy as np
from sklearn.metrics import roc_auc_score
rng = np.random.default_rng(9)
def fit_logistic(X, y, iters=25):
"""Maximum likelihood logistic regression with intercept (Newton-Raphson)."""
Z = np.c_[np.ones(len(y)), X]
b = np.zeros(Z.shape[1])
for _ in range(iters):
p = 1 / (1 + np.exp(-Z @ b))
b += np.linalg.solve(Z.T @ (Z * (p * (1 - p))[:, None]), Z.T @ (y - p))
return b
def predict(b, X):
return 1 / (1 + np.exp(-(b[0] + X @ b[1:])))
beta = np.r_[0.8, -0.6, 0.5, 0.4, np.zeros(16)] # 4 real predictors, 16 noise
def draw(n):
X = rng.standard_normal((n, beta.size))
return X, (rng.random(n) < 1 / (1 + np.exp(-(-1.0 + X @ beta)))).astype(int)
X, y = draw(200) # development sample
Xv, yv = draw(20_000) # large external sample
b = fit_logistic(X, y)
auc_app = roc_auc_score(y, predict(b, X))
print(f"events {y.sum()}, candidate predictors {X.shape[1]}")
# Bootstrap optimism correction (Efron 1983; Harrell et al. 1996)
optimism = []
for _ in range(200):
i = rng.integers(0, len(y), len(y))
bb = fit_logistic(X[i], y[i])
optimism.append(roc_auc_score(y[i], predict(bb, X[i])) - roc_auc_score(y, predict(bb, X)))
p = predict(b, Xv)
slope = fit_logistic(np.log(p / (1 - p))[:, None], yv)[1] # logistic recalibration
print(f"AUC apparent {auc_app:.3f}, optimism-corrected {auc_app - np.mean(optimism):.3f}, "
f"external {roc_auc_score(yv, p):.3f}")
print(f"external: calibration slope {slope:.2f}, mean risk {p.mean():.3f} "
f"vs observed {yv.mean():.3f}, Brier {np.mean((p - yv) ** 2):.3f}")
# Net benefit at threshold t (Vickers and Elkin, 2006)
for t in (0.1, 0.2, 0.4):
tp, fp = np.mean((p >= t) & (yv == 1)), np.mean((p >= t) & (yv == 0))
nb_all = yv.mean() - (1 - yv.mean()) * t / (1 - t)
print(f"t={t}: net benefit model {tp - fp * t / (1 - t):.3f}, treat all {nb_all:.3f}")
# events 70, candidate predictors 20
# AUC apparent 0.857, optimism-corrected 0.790, external 0.724
# external: calibration slope 0.46, mean risk 0.341 vs observed 0.316, Brier 0.203
# t=0.1: net benefit model 0.232, treat all 0.240
# t=0.2: net benefit model 0.166, treat all 0.145
# t=0.4: net benefit model 0.064, treat all -0.140Key takeaways — chapter 6
- Validation assesses discrimination (AUC, C index), calibration (calibration-in-the-large, slope, plots), overall error (Brier score) and clinical usefulness (net benefit).
- The AUC is the probability that a case is ranked above a control; it ignores calibration.
- On its own data, a maximum likelihood logistic model always has perfect calibration-in-the-large and slope, so calibration needs new data or resampling.
- Apparent performance is optimistic; the bootstrap must repeat the whole modelling procedure, and few events per variable give predictions that are too extreme.
- A model is useful at a threshold only if its net benefit beats both treating everyone and treating no one.
7. Introduction to causal inference
Randomization answers causal questions by design (ch. 2). When a trial is impossible, the effect of a treatment must be estimated from observational data, where treated and untreated patients differ. This chapter states the assumptions that make this possible and the estimators that follow.
7.1 Causal estimands
Recall the potential outcomes Y(1), Y(0) of Definition 2.1 and the consistency relation Y = Y(A), which also assumes that one patient’s treatment does not affect another’s outcome (no interference).
Definition 7.1 — Causal estimands
- The average treatment effect is \mathrm{ATE} = E[Y(1)] - E[Y(0)].
- The average effect in the treated is \mathrm{ATT} = E[Y(1) - Y(0) \mid A = 1].
- For a binary outcome, the causal risk ratio is P(Y(1) = 1)/P(Y(0) = 1).
These are marginal (population-average) effects. Conditional effects, given covariates, can differ from them even without confounding when the measure is an odds ratio or a hazard ratio, which are not collapsible (Exercise 16).
7.2 Identification by standardization
Theorem 7.2 — g-formula Let L be a set of baseline covariates, and assume
- consistency: Y = Y(A);
- conditional exchangeability: Y(a) \perp A \mid L for a = 0, 1;
- positivity: P(A = a \mid L) > 0 almost surely.
Then the mean potential outcome is identified from the observed distribution: E[Y(a)] = E\big[\, E[Y \mid A = a, L] \,\big] = \int E[Y \mid A = a, L = l]\, dP_L(l).
Proof. By the tower property, E[Y(a)] = E\big[E[Y(a) \mid L]\big].
By exchangeability, E[Y(a) \mid L] = E[Y(a) \mid A = a, L]; positivity makes this conditioning well defined.
By consistency, E[Y(a) \mid A = a, L] = E[Y \mid A = a, L]. ∎
The formula, due to Robins (1986), standardizes the outcome to the covariate distribution of the whole population. In practice one fits an outcome model \hat m_a(l) and averages \hat m_1(L_i) - \hat m_0(L_i) over the sample (g-computation).
Example 7.3 — Standardizing the kidney-stone data In Example 3.6, 51 % of patients have small stones and 49 % large ones. Assuming stone size is the only confounder, the standardized success rates are 0.931 \times 0.51 + 0.730 \times 0.49 = 0.833 \ \text{(A)}, \qquad 0.867 \times 0.51 + 0.688 \times 0.49 = 0.779 \ \text{(B)}.
The standardized difference is +0.054 in favour of A, against a crude difference of -0.046.
7.3 Inverse probability weighting
Theorem 7.4 — Inverse probability weighting Under the assumptions of Theorem 7.2, with \pi_a(L) = P(A = a \mid L), E[Y(a)] = E\left[\frac{\mathbb{1}\{A = a\}\, Y}{\pi_a(L)}\right].
Proof. By consistency, \mathbb{1}\{A = a\}Y = \mathbb{1}\{A = a\}Y(a). Condition on L: E\left[\frac{\mathbb{1}\{A = a\}\, Y(a)}{\pi_a(L)} \,\Big|\, L\right] = \frac{P(A = a \mid L)\; E[Y(a) \mid L]}{\pi_a(L)} = E[Y(a) \mid L], where exchangeability factorizes the expectation and positivity allows the division. Taking expectations gives the result. ∎
Weighting each patient by the inverse probability of the treatment received creates a pseudo-population in which treatment is independent of L. The Horvitz–Thompson (1952) form divides by n, the more stable Hájek form by the sum of the weights. Near-violations of positivity produce huge weights, which stabilization or truncation tame at the price of some bias.
7.4 The propensity score
Definition 7.5 — Propensity score The propensity score is e(L) = P(A = 1 \mid L), the probability of receiving the treatment given the covariates.
Theorem 7.6 — Rosenbaum and Rubin (1983)
- Balancing: A \perp L \mid e(L).
- If (Y(0), Y(1)) \perp A \mid L, then (Y(0), Y(1)) \perp A \mid e(L).
Proof.
Since e(L) is a function of L, P(A = 1 \mid L, e(L)) = e(L). By the tower property, P\big(A = 1 \mid e(L)\big) = E\big[P(A = 1 \mid L) \mid e(L)\big] = e(L). The two conditional probabilities coincide, so A is independent of L given e(L).
Write Y^\ast = (Y(0), Y(1)). By the tower property and exchangeability given L, P\big(A = 1 \mid Y^\ast, e(L)\big) = E\big[P(A = 1 \mid Y^\ast, L) \mid Y^\ast, e(L)\big] = E\big[e(L) \mid Y^\ast, e(L)\big] = e(L), which does not depend on Y^\ast. ∎
A scalar score thus replaces a high-dimensional L for matching, stratification or weighting. The fitted model is judged by the balance it achieves, measured by standardized mean differences (below 0.1), not by its AUC (Austin, 2011).
7.5 Doubly robust estimation
Proposition 7.7 — Augmented IPW is doubly robust Let \hat m_a be an outcome model and \hat e a propensity model. The augmented IPW estimator of the ATE is \hat\psi = \frac1n \sum_{i=1}^n \left[\hat m_1(L_i) - \hat m_0(L_i) + \frac{A_i\,(Y_i - \hat m_1(L_i))}{\hat e(L_i)} - \frac{(1 - A_i)(Y_i - \hat m_0(L_i))}{1 - \hat e(L_i)}\right].
It is consistent if either the outcome model or the propensity model is correctly specified (Robins, Rotnitzky and Zhao, 1994).
Proof. Consider the treated term, and let m_1, e be the limits of the fitted models, \mu_1(L) = E[Y \mid A = 1, L] the true regression and \pi(L) the true propensity score.
Conditioning on L, E[A(Y - m_1(L)) \mid L] = \pi(L)\,(\mu_1(L) - m_1(L)). The limit of the treated part minus E[Y(1)] = E[\mu_1(L)] is therefore E\left[\big(\mu_1(L) - m_1(L)\big)\,\frac{\pi(L) - e(L)}{e(L)}\right], which vanishes if m_1 = \mu_1 or e = \pi. The control term is symmetric. ∎
The bias is a product of the two errors. This is why the estimator tolerates flexible, slowly converging machine-learning fits of both models, the starting point of double machine learning (ch. 9).
Example 7.8 — Estimators compared In Code 7.13, two confounders drive treatment and the true effect is 2, with an outcome that depends on e^{L_1}:
- the naive difference of means is 4.80;
- g-computation with a model linear in L_1 gives 2.31, and with the correct model 2.00;
- IPW with the correct propensity model gives 2.00;
- AIPW gives 2.04 with a wrong outcome model, 2.00 with a wrong propensity model, and 2.36 when both are wrong.
7.6 Causal diagrams
Definition 7.9 — Causal DAG, paths and colliders A causal directed acyclic graph has an arrow X \to Y when X is a direct cause of Y. Along a path:
- a chain A \to M \to Y goes through a mediator M;
- a fork A \leftarrow L \to Y goes through a common cause L;
- a collider A \to C \leftarrow Y meets at a common effect C.
A path is blocked by a set Z if it contains a chain or fork whose middle node is in Z, or a collider such that neither it nor any of its descendants is in Z.
Theorem 7.10 — Back-door criterion (Pearl, 1995) A set L of covariates satisfies the back-door criterion relative to a treatment A and an outcome Y if
- no element of L is a descendant of A, and
- L blocks every path between A and Y that starts with an arrow into A.
Then conditional exchangeability holds given L, and Theorem 7.2 identifies the effect.
Proof. See Pearl (2009, section 3.3). The idea: the blocked back-door paths carry no association, and the remaining paths from A to Y are causal. Excluding descendants of A prevents blocking part of the effect or opening colliders. ∎
The criterion explains the checklist of Definition 3.5, and it explains two errors: adjusting for a mediator (the LDL cholesterol of Example 1.2) removes part of the effect, and adjusting for a collider creates an association.
Example 7.11 — Collider bias Two independent diseases each have prevalence 0.1, and a patient is hospitalized if he or she has either one. Among hospitalized patients:
- if the second disease is absent, the first is certainly present;
- if the second disease is present, the first has probability 0.1.
Restricting to hospital patients, a form of conditioning on a common effect, makes the two diseases strongly negatively associated (Berkson’s bias). Many selection biases have this structure (Hernán, Hernández-Díaz and Robins, 2004).
7.7 Target trial emulation
Definition 7.12 — Target trial emulation To answer a causal question with observational data, first write the protocol of the randomized trial that would answer it: eligibility criteria, treatment strategies, assignment, time zero, follow-up, outcome, causal contrast and analysis plan. Then emulate each element with the data, and adjust for baseline confounders as if assignment had been random given them (Hernán and Robins, 2016).
Aligning eligibility, treatment assignment and the start of follow-up at time zero removes the immortal time of ch. 3 by construction (Hernán et al., 2016). When strategies differ only after time zero, such as “start within six months”, patients are cloned into every compatible strategy, censored when they deviate, and reweighted. The emulation still assumes no unmeasured confounding.
The E-value of VanderWeele and Ding (2017) measures how strong such confounding would have to be. For an observed risk ratio \mathrm{RR} > 1, E = \mathrm{RR} + \sqrt{\mathrm{RR}\,(\mathrm{RR} - 1)} is the minimum risk ratio that an unmeasured confounder would need with both treatment and outcome to explain the estimate away. For \mathrm{RR} = 2, E = 3.41; a protective ratio is first inverted.
Code 7.13 — g-computation, IPW and AIPW on simulated confounded data
import numpy as np
rng = np.random.default_rng(10)
def fit_logistic(Z, y, iters=25):
b = np.zeros(Z.shape[1])
for _ in range(iters):
p = 1 / (1 + np.exp(-Z @ b))
b += np.linalg.solve(Z.T @ (Z * (p * (1 - p))[:, None]), Z.T @ (y - p))
return 1 / (1 + np.exp(-Z @ b))
# Confounders L1, L2; treatment depends on both; true average treatment effect = 2
n = 50_000
L1, L2 = rng.standard_normal(n), rng.standard_normal(n)
A = (rng.random(n) < 1 / (1 + np.exp(-(-1 + 1.2 * L1 - 0.6 * L2)))).astype(float)
Y = 2 * A + 2 * np.exp(L1) + L2 + rng.standard_normal(n)
one = np.ones(n)
def outcome_model(features): # linear regression of Y on (1, A, features)
F = np.c_[one, A, features]
coef = np.linalg.lstsq(F, Y, rcond=None)[0]
m1 = np.c_[one, one, features] @ coef
m0 = np.c_[one, 0 * one, features] @ coef
return m1, m0
def aipw(m1, m0, e):
return np.mean(m1 - m0 + A * (Y - m1) / e - (1 - A) * (Y - m0) / (1 - e))
e_good = fit_logistic(np.c_[one, L1, L2], A) # correct propensity model
e_bad = fit_logistic(np.c_[one, L2], A) # omits L1
m1_bad, m0_bad = outcome_model(np.c_[L1, L2]) # linear in L1: misspecified
m1_good, m0_good = outcome_model(np.c_[np.exp(L1), L2])
w1, w0 = A / e_good, (1 - A) / (1 - e_good)
print(f"naive difference {Y[A == 1].mean() - Y[A == 0].mean():.3f}")
print(f"g-formula, wrong model {np.mean(m1_bad - m0_bad):.3f}")
print(f"g-formula, right model {np.mean(m1_good - m0_good):.3f}")
print(f"IPW (Hajek) {(w1 @ Y) / w1.sum() - (w0 @ Y) / w0.sum():.3f}")
print(f"AIPW, wrong outcome {aipw(m1_bad, m0_bad, e_good):.3f}")
print(f"AIPW, wrong propensity {aipw(m1_good, m0_good, e_bad):.3f}")
print(f"AIPW, both wrong {aipw(m1_bad, m0_bad, e_bad):.3f}")
# naive difference 4.799
# g-formula, wrong model 2.312
# g-formula, right model 1.997
# IPW (Hajek) 2.001
# AIPW, wrong outcome 2.036
# AIPW, wrong propensity 1.996
# AIPW, both wrong 2.364Key takeaways — chapter 7
- Causal effects compare potential outcomes; they are identified from observational data under consistency, conditional exchangeability and positivity.
- Standardization (g-formula) averages an outcome model; inverse probability weighting reweights by the propensity score; both remove measured confounding only.
- The propensity score balances the covariates it is built from; judge it by balance, not by discrimination.
- Augmented IPW is consistent if either model is correct, and its bias is a product of the two errors.
- Causal diagrams say which covariates to adjust for: confounders yes, mediators and colliders no; target trial emulation aligns time zero and removes immortal time.
8. Complements: further designs and survival topics
This chapter is for self-study. It completes the design chapters with estimands, non-compliance, interim analyses, cluster trials and subgroups, and the survival chapters with the restricted mean survival time, the sample size of survival trials, competing risks and the validation of survival models. Each section relies only on the chapters it cites.
8.1 Estimands and intercurrent events
The PICO question of section 1.4 leaves open what happens when patients stop their treatment, take a rescue medication or die before the endpoint is measured. The ICH E9(R1) addendum (2019) asks for an explicit estimand.
Definition 8.1 — Estimand An estimand is the precise treatment effect that a study targets. It is specified by five attributes:
- the population of patients;
- the treatment conditions that are compared;
- the variable (endpoint) measured on each patient;
- the handling of intercurrent events, which occur after the start of treatment and affect the interpretation of the endpoint, such as stopping treatment, taking a rescue medication, or dying;
- the population-level summary: a difference of means, a risk ratio, a hazard ratio.
The addendum names five strategies for intercurrent events: treatment policy, hypothetical, composite, while on treatment, and principal stratum.
Example 8.2 — An estimand in diabetes A trial compares a new drug with placebo on HbA1c at week 26. Some patients receive rescue insulin when their glucose gets too high.
- Under the treatment-policy strategy, the outcome is HbA1c at week 26 whatever the rescue: the effect of prescribing the drug in practice.
- Under the hypothetical strategy, the target is the HbA1c that would have been observed without rescue: a pharmacological effect, which needs modelling assumptions to be estimated.
The two estimands answer different questions and can differ substantially.
8.2 Non-compliance and the complier average effect
Section 2.7 noted that non-compliance dilutes the intention-to-treat effect. Let Z be the randomized arm and D the treatment received, and suppose that controls cannot obtain the treatment.
Proposition 8.3 — Dilution of the ITT effect Call compliers the patients who take the treatment if assigned to it, and never-takers the others. Assume randomization and that the arm affects the outcome only through the treatment received (exclusion restriction). With \pi_c the proportion of compliers, E[Y \mid Z = 1] - E[Y \mid Z = 0] = \pi_c \; E[Y(1) - Y(0) \mid \text{complier}] .
Proof. By randomization, the proportion of compliers and the distribution of potential outcomes within each type are the same in both arms.
Never-takers receive no treatment in either arm, so they contribute E[Y(0) \mid \text{never-taker}] to both means, and their contributions cancel.
Compliers receive D = Z: they contribute \pi_c E[Y(1) \mid \text{complier}] in arm 1 and \pi_c E[Y(0) \mid \text{complier}] in arm 0. The difference is the formula. ∎
Dividing the ITT effect by \pi_c estimates the effect among compliers. This is the instrumental-variable estimator, with randomization as the instrument (Angrist, Imbens and Rubin, 1996).
8.3 Interim analyses and group-sequential designs
Section 2.6 noted that repeated looks at accumulating data are a form of multiplicity: stopping a trial at the first p < 0.05 inflates the type I error.
Proposition 8.4 — Two looks at the data Let Z_1 be the test statistic after half the patients and Z_2 after all of them, both standard normal under H_0. Then \mathrm{Corr}(Z_1, Z_2) = \sqrt{1/2}, and testing at 1.96 at both looks has a type I error of about 0.083 instead of 0.05.
Proof. Write Z_1 = S_{m}/\sqrt{m} and Z_2 = S_{2m}/\sqrt{2m}, where S_k is a sum of k independent standardized contributions. Then \mathrm{Cov}(S_m, S_{2m}) = \mathrm{Var}(S_m) = m, so the correlation is m/\sqrt{m \cdot 2m} = \sqrt{1/2}.
The error is 1 - P(|Z_1| < 1.96, |Z_2| < 1.96) for this bivariate normal pair, which numerical integration or simulation (Code 8.6) puts at 0.083. ∎
Definition 8.5 — Group sequential designs A group sequential design plans K analyses and a boundary c_k for each, chosen so that the overall type I error is \alpha.
- Pocock (1977) uses a constant boundary.
- O’Brien and Fleming (1979) use c_k = c\sqrt{K/k}: very strict at the first looks and close to 1.96 at the end.
- Alpha-spending functions (Lan and DeMets, 1983) fix how much error is spent as information accrues, so that the number and timing of looks need not be fixed in advance.
In practice an independent data monitoring committee performs the interim analyses, so that the investigators stay blind to the accumulating results.
Code 8.6 — Type I error of repeated looks and O’Brien–Fleming boundaries
import numpy as np
from scipy import optimize
# K equally spaced looks at the accumulating z-statistic of a trial under H0.
# Z_k = S_k / sqrt(k) where S_k is a sum of k independent N(0, 1) increments.
def crossing_prob(bounds, reps=400_000, seed=3):
rng = np.random.default_rng(seed)
K = len(bounds)
S = np.cumsum(rng.standard_normal((reps, K)), axis=1)
Z = S / np.sqrt(np.arange(1, K + 1))
return np.mean((np.abs(Z) > np.asarray(bounds)).any(axis=1))
for K in (1, 2, 3, 5):
print(f"{K} looks at 1.96: type I error {crossing_prob([1.96] * K):.3f}")
# O'Brien-Fleming boundaries c * sqrt(K / k), with c tuned to a 5 % type I error
K = 5
f = lambda c: crossing_prob(c * np.sqrt(K / np.arange(1, K + 1))) - 0.05
c = optimize.brentq(f, 1.8, 2.4, xtol=1e-3)
print("O'Brien-Fleming, 5 looks:", np.round(c * np.sqrt(K / np.arange(1, K + 1)), 2))
# 1 looks at 1.96: type I error 0.050
# 2 looks at 1.96: type I error 0.083
# 3 looks at 1.96: type I error 0.107
# 5 looks at 1.96: type I error 0.141
# O'Brien-Fleming, 5 looks: [4.56 3.23 2.63 2.28 2.04]With five looks, the final boundary of 2.04 is barely above 1.96: early stopping costs little power, which is why O’Brien–Fleming boundaries are popular.
8.4 Cluster and crossover trials
Some interventions act on groups: a hygiene programme in a hospital ward, a training of general practitioners. Such trials randomize clusters, and patients of the same cluster resemble each other.
Proposition 8.7 — Design effect Let k clusters of m patients be randomized, with outcomes of variance \sigma^2 and correlation \rho between two patients of the same cluster (the intracluster correlation). The variance of the mean over the n = km patients is \mathrm{Var}(\bar Y) = \frac{\sigma^2}{n}\,\big(1 + (m - 1)\rho\big).
Proof. The sum over one cluster has variance m\sigma^2 + m(m-1)\rho\sigma^2: m variance terms and m(m-1) covariance terms.
Clusters are independent, so the sum over k clusters has k times this variance. Dividing by n^2 = k^2m^2 gives the result. ∎
The factor 1 + (m-1)\rho multiplies the sample size of Theorem 2.7. With clusters of m = 20 and \rho = 0.05, it equals 1.95: the trial of Example 2.8 needs 759 patients per arm instead of 389.
In a crossover trial, each patient receives both treatments in random order, separated by a washout period. Each patient is his or her own control, which removes the between-patient variance. The design suits chronic, stable conditions and treatments without lasting (carry-over) effects.
8.5 Subgroup analyses
Trials often report effects in subgroups (men and women, age classes). These analyses are fragile.
Proposition 8.8 — Spurious subgroup findings Suppose a treatment has no effect at all, and the null hypothesis of no effect is tested at level 0.05 in each of K disjoint subgroups. The probability that at least one subgroup is “significant” is 1 - 0.95^K, \qquad \text{which is } 0.40 \text{ for } K = 10 .
Proof. Under the null hypothesis, the tests in disjoint subgroups are independent, each with a rejection probability of 0.05. The probability that none rejects is 0.95^K. ∎
The proper analysis tests the interaction, the difference between subgroup effects, for a few pre-specified subgroups. In the ISIS-2 trial (ISIS-2 Collaborative Group, 1988), aspirin appeared useless for patients born under Gemini or Libra, a result reported precisely to show how chance produces such findings.
8.6 Restricted mean survival time
When hazards are not proportional, a single hazard ratio summarizes the difference poorly. A summary that is always interpretable is the area under the survival curve up to a horizon.
Definition 8.9 — Restricted mean survival time For a horizon \tau, \mathrm{RMST}(\tau) = E\big[\min(T, \tau)\big] = \int_0^\tau S(t)\,dt .
The equality holds because E[Y] = \int_0^\infty P(Y > t)\,dt for any non-negative Y, and P(\min(T, \tau) > t) = S(t) for t < \tau.
The RMST is estimated by the area under the Kaplan–Meier curve. The difference between two arms is the mean event-free time gained over the horizon, in months, a quantity that patients understand (Royston and Parmar, 2013).
Example 8.10 — RMST by hand For the curve of Example 4.9 with \tau = 12 months, the area is a sum of rectangles: 3 \times 1 + 2 \times 0.9 + 3 \times 0.675 + 3 \times 0.54 + 1 \times 0.36 = 8.805 \text{ months}.
Over the first year, these patients live on average 8.8 months.
8.7 Sample size of a survival trial
For a time-to-event endpoint, the information in a trial is carried by the events, not by the patients.
Theorem 8.11 — Number of events (Schoenfeld, 1983) Let a proportion \pi of patients be allocated to the experimental arm, and let the hazards be proportional with hazard ratio \mathrm{HR}. The two-sided log-rank test at level \alpha has power 1 - \beta when the number of events is D = \frac{(z_{1-\alpha/2} + z_{1-\beta})^2}{\pi(1 - \pi)\,(\log \mathrm{HR})^2} .
Proof. Sketch. Under alternatives close to the null, the proportions of the two arms in the risk sets stay near \pi. Each event then adds about \pi(1 - \pi) to the variance V of Theorem 4.11.
Each event also adds about \pi(1-\pi)\log\mathrm{HR} to the expectation of O_1 - E_1. The statistic (O_1 - E_1)/\sqrt V is therefore approximately normal with mean \sqrt{D\pi(1-\pi)}\,\log\mathrm{HR} and variance 1.
The power computation of Theorem 2.7 then gives the formula. ∎
Example 8.12 — Sizing a cancer trial To detect \mathrm{HR} = 0.75 with 1:1 allocation, \alpha = 0.05 and power 0.80, D = \frac{(1.960 + 0.842)^2}{0.25 \times (\log 0.75)^2} = \frac{7.85}{0.25 \times 0.0828} = 379.4, \quad \text{so } 380 \text{ events}.
If half of the patients are expected to have an event during the planned accrual and follow-up, the trial needs about 760 patients. With power 0.90 the number of events becomes 508.
The expected proportion of events depends on the accrual rate, the follow-up and the control survival; trials therefore fix the number of events and analyse when it is reached.
8.8 Competing risks
A patient waiting for a transplant can die, or receive the transplant; an elderly patient followed for cancer recurrence can die of another cause. When one type of event prevents the others, the events compete.
Definition 8.13 — Cause-specific hazards and cumulative incidence Let T be the time to the first event and K \in \{1, \dots, k\} its cause. The cause-specific hazard of cause j is h_j(t) = \lim_{dt \to 0} \frac{P(t \le T < t + dt,\ K = j \mid T \ge t)}{dt} .
The overall survival is S(t) = \exp\big(-\sum_j H_j(t)\big), and the cumulative incidence function of cause j is F_j(t) = P(T \le t,\ K = j) = \int_0^t S(u^-)\, h_j(u)\, du .
Proposition 8.14 — One minus Kaplan–Meier overestimates the cumulative incidence Treat competing events as censored. Then one minus the Kaplan–Meier estimator of cause 1 targets 1 - e^{-H_1(t)}. This quantity satisfies 1 - e^{-H_1(t)} \ \ge\ F_1(t), with strict inequality as soon as competing events can occur before t.
Proof. The Kaplan–Meier estimator built from the events of cause 1 alone estimates \exp(-H_1(t)), by Proposition 4.2 applied to the cause-specific hazard. Since S(u) = e^{-H_1(u) - H_2(u)} \le e^{-H_1(u)}, F_1(t) = \int_0^t S(u)\, h_1(u)\, du \le \int_0^t e^{-H_1(u)}\, h_1(u)\, du = 1 - e^{-H_1(t)} .
Equality requires H_2 = 0 wherever h_1 > 0 on [0, t]. ∎
The quantity 1 - e^{-H_1(t)} describes a hypothetical world in which the competing event has been abolished, not the risk that patients actually face. The real-world risk is estimated by the Aalen–Johansen estimator (Aalen and Johansen, 1978), \hat F_j(t) = \sum_{i:\ t_i \le t} \hat S(t_i^-)\, \frac{d_{j,i}}{n_i}, where \hat S is the all-cause Kaplan–Meier estimator and d_{j,i} counts the events of cause j at t_i.
Two regression models answer two questions. The cause-specific Cox model, a Cox model for h_j with competing events censored, describes the aetiology. The Fine–Gray model (Fine and Gray, 1999) puts proportional hazards on the subdistribution hazard of F_j and is used to predict cumulative incidences (Putter, Fiocco and Geskus, 2007; Austin, Lee and Fine, 2016).
Code 8.15 — Aalen–Johansen against one minus Kaplan–Meier
import numpy as np
rng = np.random.default_rng(8)
# Two competing causes with constant cause-specific hazards, plus censoring
h1, h2, n = 0.05, 0.10, 5000
T = rng.exponential(1 / (h1 + h2), n)
cause = np.where(rng.random(n) < h1 / (h1 + h2), 1, 2)
C = rng.uniform(0, 30, n)
X = np.minimum(T, C)
status = np.where(T <= C, cause, 0) # 0 = censored
order = np.argsort(X)
X, status = X[order], status[order]
at_risk = n - np.arange(n) # no ties with continuous times
S_all = np.cumprod(1 - (status > 0) / at_risk) # all-cause KM
S_prev = np.r_[1.0, S_all[:-1]]
cif1 = np.cumsum(S_prev * (status == 1) / at_risk) # Aalen-Johansen, cause 1
one_minus_km = 1 - np.cumprod(1 - (status == 1) / at_risk)
k = np.searchsorted(X, 10.0) - 1
true_cif = h1 / (h1 + h2) * (1 - np.exp(-(h1 + h2) * 10))
print(f"t = 10: 1-KM {one_minus_km[k]:.3f} (target {1-np.exp(-h1*10):.3f}), "
f"Aalen-Johansen {cif1[k]:.3f} (true CIF {true_cif:.3f})")
# t = 10: 1-KM 0.387 (target 0.393), Aalen-Johansen 0.253 (true CIF 0.259)With constant hazards 0.05 and 0.10, the true cumulative incidence of cause 1 at 10 years is F_1(10) = \tfrac13\big(1 - e^{-1.5}\big) = 0.259, while one minus Kaplan–Meier targets 1 - e^{-0.5} = 0.393: a 50 % overestimate.
8.9 Validating survival models, external validation and updating
A prognostic model for a time to event predicts \hat S(\tau \mid x) at a horizon \tau, for instance with the Breslow estimator of Definition 5.4. Its validation adapts the measures of ch. 6 to censoring.
- Discrimination: Harrell’s or Uno’s C index (section 6.2), or the time-dependent AUC at \tau, which compares subjects with an event before \tau to those still event-free at \tau (Heagerty, Lumley and Pepe, 2000; Blanche, Dartigues and Jacqmin-Gadda, 2013).
- Calibration: within groups of predicted risk, compare the mean of 1 - \hat S(\tau \mid x) with the Kaplan–Meier estimate of the observed risk at \tau.
- Overall error: the Brier score at \tau with inverse probability of censoring weights (Graf et al., 1999), defined below.
Definition 8.16 — Brier score at a horizon Let \hat G be the Kaplan–Meier estimator of the censoring distribution. The IPCW Brier score at \tau is \mathrm{BS}(\tau) = \frac1n \sum_{i=1}^n \left[ \frac{\hat S(\tau \mid x_i)^2\, \mathbb{1}\{X_i \le \tau,\ \delta_i = 1\}}{\hat G(X_i)} + \frac{\big(1 - \hat S(\tau \mid x_i)\big)^2\, \mathbb{1}\{X_i > \tau\}}{\hat G(\tau)} \right].
Subjects censored before \tau get weight zero, and the others are up-weighted to represent them.
On patients from another time, place or setting, the case mix changes. A narrower range of patients lowers the AUC even for a correct model, and a different baseline risk shifts all predictions. Models are therefore updated in increasing order of complexity: the intercept (or the baseline hazard), then the calibration slope of Definition 6.5, then selected coefficients (Steyerberg, 2019). Royston and Altman (2013) describe these steps for Cox models.
Key takeaways — chapter 8
- An estimand fixes how intercurrent events are handled; the treatment-policy and hypothetical strategies answer different questions.
- Under one-sided non-compliance, the ITT effect is the proportion of compliers times the effect among them.
- Two looks at 1.96 give a type I error of 0.083; group-sequential boundaries such as O’Brien–Fleming restore 0.05.
- Clustering multiplies the sample size by 1 + (m-1)\rho; subgroup effects are judged by interaction tests.
- The restricted mean survival time is the area under the survival curve up to a horizon; the information of a survival trial is its number of events (Schoenfeld’s formula).
- With competing risks, one minus Kaplan–Meier overestimates the real-world risk; the Aalen–Johansen estimator does not.
- Survival models are validated at a horizon with IPCW versions of the C index, AUC and Brier score.
9. Research directions and open problems
This chapter is for self-study. It surveys questions that are open at the time of writing, with entry points into the literature; each section ends with a question that could start a project or an internship.
9.1 Estimands and principal strata
The ICH E9(R1) addendum (section 8.1) made intercurrent events explicit, but several of its strategies target quantities that are not identified without strong assumptions. The principal stratum strategy, for instance, targets the effect among patients who would not experience the intercurrent event under either treatment (Frangakis and Rubin, 2002). Membership of such a stratum is never observed, so estimation relies on untestable assumptions or on sensitivity analyses.
Open question: which estimands for trials with frequent treatment discontinuation and deaths are both clinically meaningful and estimable under assumptions that can be checked?
9.2 Machine learning for time-to-event data
Random survival forests (Ishwaran et al., 2008) relax both the linearity and the proportional hazards assumptions of ch. 5. Neural extensions of the Cox model such as DeepSurv (Katzman et al., 2018) replace the linear predictor by a network but keep proportional hazards. On low-dimensional clinical data, a systematic review by Christodoulou et al. (2019) found no performance benefit of machine learning over logistic regression for binary outcomes, and the gains reported for survival are similarly debated.
The censoring mechanism complicates both training and evaluation. Conformal methods give distribution-free lower prediction bounds on survival times under censoring (Candès, Lei and Ren, 2023), and the IPCW measures of section 8.9 remain the standard for evaluation.
Open question: when do flexible survival models improve calibrated individual predictions, and how should their uncertainty be reported to clinicians?
9.3 Heterogeneous treatment effects
The average effect of ch. 7 hides differences between patients. Causal forests (Wager and Athey, 2018), meta-learners (Künzel et al., 2019) and double machine learning with cross-fitting (Chernozhukov et al., 2018) estimate conditional average treatment effects; Proposition 7.7 explains why products of slowly converging errors remain acceptable.
The PATH statement (Kent et al., 2020) recommends a cautious, risk-based approach in trials: estimate a baseline risk model first, then model the treatment effect across risk strata. Validating a model of individual effects is hard, since individual effects are never observed.
Open question: how can a model of treatment-effect heterogeneity be validated externally, with calibration and discrimination measures analogous to those of ch. 6?
9.4 Real-world evidence and transportability
Target trial emulation (section 7.7) is now applied to large health-care databases. The RCT DUPLICATE initiative compared emulations with the trials they mimicked and reported results that agree for some questions and not for others (Franklin et al., 2021).
When trial results must be carried to a different target population, transportability methods reweight or standardize the trial to the covariate distribution of that population (Dahabreh et al., 2020). Both lines rest on exchangeability assumptions that sensitivity analyses, such as the E-value, can only partly probe.
Open question: which features of a clinical question and of a database predict whether an emulated target trial will reproduce the randomized result?
9.5 Prediction models with artificial intelligence
A review of prediction models for COVID-19 (Wynants et al., 2020) found that almost all were at high risk of bias, mostly because of small samples, poor handling of missing data and no proper validation, the failures that ch. 6 warns against. TRIPOD+AI (Collins et al., 2024) extends the reporting rules to machine-learning models.
Two further problems are specific to deployment. Dataset shift between hospitals or over time degrades calibration first. And a model can be accurate while encoding inequities: Obermeyer et al. (2019) showed that an algorithm that used health-care costs as a proxy for health needs underestimated the needs of Black patients.
Open question: how should a deployed clinical prediction model be monitored and updated so that its calibration stays acceptable in every patient group?
9.6 Adaptive and platform trials
Group-sequential designs (section 8.3) are the simplest adaptive designs. Platform trials evaluate several treatments under a master protocol, adding and dropping arms as evidence accrues (Woodcock and LaVange, 2017). The RECOVERY trial used this design during the COVID-19 pandemic and showed that dexamethasone reduced mortality among hospitalized patients receiving respiratory support (RECOVERY Collaborative Group, 2021). Bayesian adaptive methods (Berry et al., 2010) adjust allocation probabilities or stopping rules as the posterior evolves.
Open question: how should type I error, time trends in the control arm and the sharing of controls between arms be handled when a platform trial runs for years?
Key takeaways — chapter 9
- Several estimands of the ICH E9(R1) framework, such as principal strata, are identified only under untestable assumptions.
- Flexible survival models must beat the Cox model on calibrated predictions, evaluated with the IPCW measures of section 8.9.
- Heterogeneous treatment effects can be estimated with causal forests, meta-learners or double machine learning, but are hard to validate.
- Target trial emulation and transportability extend trial evidence to real-world data, under exchangeability assumptions.
- Deployed prediction models need monitoring for dataset shift and for calibration in every patient group; platform trials raise new questions of error control.
Exercises
The exercises are sorted by level: ★ applies the course, ★★ combines results or proves a short statement, ★★★ is open-ended. The Practice column of the session plan says when to attempt each one.
★ Effect measures from a trial. A trial records 12 deaths among 150 treated patients and 24 among 150 controls. Compute the risk difference, the risk ratio and the odds ratio with their 95 % confidence intervals, and the number needed to treat. Which measure would you report to a patient?
Solution: \hat p_1 = 0.08, \hat p_0 = 0.16. The risk difference is -0.08, 95 % CI [-0.153, -0.007], so the NNT is 12.5: about 13 patients treated to avoid one death.
By Proposition 0.4, the risk ratio is 0.50, CI [0.26, 0.96], and the odds ratio is 0.457, CI [0.219, 0.951]. For a patient, the absolute measure (8 fewer deaths per 100 treated) is the most informative.
★ What a case-control study can estimate. A case-control study includes 200 cases of a rare cancer and 400 controls; 80 cases and 80 controls were exposed to a solvent. (a) Estimate the odds ratio with its 95 % CI. (b) Why can the risk of cancer among the exposed not be estimated? (c) What does the odds ratio approximate, and why?
Solution: (a) \mathrm{OR} = (80 \times 320)/(120 \times 80) = 2.67; the variance of its log is 1/80 + 1/120 + 1/80 + 1/320, which gives the CI [1.83, 3.88].
- The proportion of cases in the sample, 1/3, was fixed by the investigators. (c) By Theorem 1.4 the sample odds ratio equals the population odds ratio, which approximates the risk ratio because the cancer is rare.
★ Sample size for a continuous endpoint. A trial must detect a reduction of 0.4 percentage points of HbA1c, with a standard deviation of 1.1 in each arm, two-sided \alpha = 0.05 and power 0.80. (a) How many patients per arm? (b) With 15 % dropout? (c) And for a reduction of 0.3 points?
Solution: (a) Theorem 2.7: n = 2.802^2 \times 2 \times 1.21 / 0.16 = 118.7, so 119 per arm. (b) 118.7/0.85 gives 140 per arm. (c) The factor (0.4/0.3)^2 = 1.78 gives 212 per arm.
★ Simpson’s paradox in an observational study. Among patients with a mild disease, 20/200 treated and 60/400 untreated died; among patients with a severe disease, 120/400 treated and 50/100 untreated died. (a) Compute the crude odds ratio of death, treated versus untreated. (b) Compute the stratum-specific odds ratios and the Mantel–Haenszel odds ratio. (c) Explain the difference.
Solution: (a) Crude: 140/600 against 110/500, odds ratio 1.08, so the treatment looks slightly harmful.
Mild: \frac{20 \times 340}{180 \times 60} = 0.63; severe: \frac{120 \times 50}{280 \times 50} = 0.43. Mantel–Haenszel: \frac{11.33 + 12}{18 + 28} = 0.51.
Severe patients are treated more often (80 % against 33 %) and die more: severity confounds the crude comparison (confounding by indication, section 3.3).
★ Kaplan–Meier and log-rank by hand. Group A has times 2, 4+, 6, 8, 10+ and group B has times 1, 3, 3, 5+, 7 (months, + for censored). (a) Compute the two Kaplan–Meier curves and medians. (b) Compute O_B, E_B, V and the log-rank statistic.
Solution: (a) A: \hat S = 0.8 at 2, 0.533 at 6, 0.267 at 8; median 8 months. B: 0.8 at 1, 0.4 at 3, 0 at 7; median 3 months.
- The event times 1, 2, 3, 6, 7, 8 give E_B = 0.5 + 0.444 + 1.0 + 0.25 + 0.333 + 0 = 2.53 against O_B = 4, and V = 1.335. The statistic is 1.472^2/1.335 = 1.62, with p = 0.20: no evidence of a difference with ten patients.
★ Reading a Cox model. A Cox model of death gives a treatment coefficient -0.35 (standard error 0.12) and an age coefficient 0.40 per 10 years (standard error 0.08), with age centred at 60. The Breslow baseline cumulative hazard at 5 years is 0.30. (a) Give the treatment hazard ratio and its 95 % CI. (b) What is the hazard ratio of a 70-year-old against a 50-year-old with the same treatment? (c) Predict the 5-year survival of a treated 70-year-old and of an untreated 60-year-old. (d) Which assumption would you check first?
Solution: (a) e^{-0.35} = 0.70, CI [0.56, 0.89]. (b) e^{2 \times 0.40} = 2.23.
- Definition 5.4: \exp(-0.30\, e^{-0.35 + 0.40}) = 0.730 for the treated 70-year-old, and e^{-0.30} = 0.741 for the untreated 60-year-old. (d) Proportional hazards, with Schoenfeld residuals (section 5.3).
★ Discrimination, calibration and net benefit by hand. Eight patients have predicted risks 0.9, 0.8, 0.7, 0.6, 0.4, 0.3, 0.2, 0.1 and outcomes 1, 1, 0, 1, 0, 0, 1, 0. Compute the AUC, the calibration-in-the-large, the Brier and scaled Brier scores, and the net benefit at t = 0.5.
Solution: Of the 16 case–control pairs, the case ranks higher in 4 + 4 + 3 + 1 = 12: \mathrm{AUC} = 0.75 (Theorem 6.3). The mean prediction and the observed proportion are both 0.5.
The Brier score is 1.6/8 = 0.20; predicting 0.5 for everyone scores 0.25, so the scaled Brier score is 0.20. At t = 0.5 four patients are treated, 3 true and 1 false positives: \mathrm{NB} = 3/8 - 1/8 = 0.25, against 0 for treating all or none.
★ Standardization equals weighting on a table. On the kidney-stone data of Example 3.6, (a) compute the propensity of surgery A in each stratum, (b) compute the IPW estimate of the success rate under A for everyone, and (c) explain why it equals the standardized rate of Example 7.3.
Solution: (a) e = 87/357 = 0.244 for small stones and 263/343 = 0.767 for large ones. (b) (81/0.244 + 192/0.767)/700 = 0.833.
- With a saturated propensity model, \sum_{i \in k,\, A_i = 1} Y_i / \hat e_k = n_k\, \hat p_{A,k} in each stratum k, so the IPW estimate is \sum_k (n_k/n)\, \hat p_{A,k}, the standardized rate.
★★ Misclassification and regression to the mean. (a) True one-year risks are 0.10 and 0.20, and the outcome is recorded with \mathrm{Se} = 0.85, \mathrm{Sp} = 0.95 in both arms. Compute the observed risk difference and risk ratio. (b) Prove that non-differential outcome misclassification with \mathrm{Se} + \mathrm{Sp} > 1 moves the risk ratio towards 1. (c) Cholesterol has mean 5.5 mmol/L, standard deviation 1.0 and test–retest correlation 0.8. Patients are enrolled if their value is at least 7.5. What drop is expected at the next visit without treatment?
Solution: (a) The observed risks are 0.13 and 0.21: \mathrm{RD}^\ast = -0.08 = 0.8 \times (-0.10) and \mathrm{RR}^\ast = 0.62 instead of 0.5.
\mathrm{RR}^\ast = (a p_1 + c)/(a p_0 + c) with a = \mathrm{Se} + \mathrm{Sp} - 1 > 0 and c = 1 - \mathrm{Sp} \ge 0. This is a mediant of p_1/p_0 and c/c = 1, so it lies between them.
For a standard normal, E[Z \mid Z \ge 2] = \varphi(2)/(1 - \Phi(2)) = 2.37. The enrolled mean is 7.87 and the expected retest mean 5.5 + 0.8 \times 2.37 = 7.40 (Proposition 3.4): a drop of 0.47 mmol/L.
★★ The exponential model with censoring. (a) From Proposition 4.6, derive the maximum likelihood estimator of a constant hazard and its observed information. (b) For the ten patients of Example 4.9, give a 95 % CI for \lambda and for the median survival. (c) Prove that \hat\lambda is consistent under independent censoring when the hazard is truly constant.
Solution: (a) \ell(\lambda) = D \log\lambda - \lambda \sum_i x_i gives \hat\lambda = D/\sum_i x_i and I(\hat\lambda) = D/\hat\lambda^2, so \mathrm{se}(\log\hat\lambda) = 1/\sqrt D.
\hat\lambda = 0.064; the interval \hat\lambda\, e^{\pm 1.96/\sqrt 5} is [0.027, 0.154] per month, and the median \log 2/\lambda lies in [4.5, 26.0] months: five events say little.
By the law of large numbers, \hat\lambda \to E[\delta]/E[X]. With E[X] = \int_0^\infty S_T S_C\, dt and E[\delta] = \int_0^\infty \lambda S_T S_C\, dt, the ratio is \lambda.
★★ Immortal time with administrative censoring (computational). Modify Codes 3.12 and 5.7: deaths at rate \lambda = 0.1 per year, treatment start at rate \mu = 0.3, follow-up stopped at 5 years. Compute (a) the naive “ever versus never” rate ratio, (b) the person-time rate ratio, and (c) a landmark rate ratio at 1 year. Explain each result.
Hints and expected result: with 2 \times 10^5 simulated subjects, the naive ratio is about 0.30, and the person-time and landmark ratios are both 1.00 up to Monte Carlo error (about ±0.02). The landmark analysis is unbiased here because the treatment has no effect; with a real effect it would misclassify patients who start after the landmark, which dilutes the effect.
★★ Optimism with variable selection (computational). In Code 6.14, add a selection step: keep the predictors whose Wald statistic exceeds 1.96 in the full model, then refit. Compare the optimism-corrected AUC when the bootstrap repeats the selection and when it only refits the selected model, with the AUC on 20 000 new patients.
Hints and expected result: with the seed of Code 6.14, seven predictors are selected; the apparent AUC is 0.841, the corrected AUC 0.788 when the selection is repeated and 0.817 when it is not, and the external AUC 0.735. Omitting the selection from the bootstrap hides part of the optimism (Algorithm 6.10, step 2).
★★ Horvitz–Thompson, Hájek and stabilized weights. (a) Show that E[A/e(L)] = 1 under positivity. (b) Deduce that the Hájek estimator, the weighted mean of Y among the treated with weights 1/\hat e(L), is consistent for E[Y(1)] under the assumptions of Theorem 7.2. (c) Show that the stabilized weights P(A = 1)/e(L) for the treated have mean 1 among the treated, and explain why they are preferred for marginal structural models.
Solution: (a) E[A/e(L)] = E\big[E[A \mid L]/e(L)\big] = 1. (b) The Hájek estimator is the ratio of \frac1n\sum A_iY_i/\hat e(L_i), which tends to E[Y(1)] by Theorem 7.4, to \frac1n \sum A_i/\hat e(L_i), which tends to 1 by (a).
- E[P(A=1)/e(L) \mid A = 1] = E[A/e(L)] = 1. Stabilized weights keep the size of the pseudo-population equal to the sample size and vary less, which typically narrows the confidence intervals of a marginal structural model that is not saturated (Hernán and Robins, 2020, chapter 12).
★★ Non-compliance and clustering in a trial design. (a) In the trial of Example 2.8, only 60 % of the patients assigned to the treatment take it, and controls have no access. What ITT effect should the design assume, and how many patients per arm are needed (power 0.90)? (b) A cluster trial randomizes 30 general practices per arm, with 25 patients each, and the intracluster correlation is 0.02. What is the design effect, and the effective number of patients per arm?
Solution: (a) By Proposition 8.3 the ITT difference is 0.6 \times (-0.10) = -0.06, from 0.30 to 0.24. Theorem 2.7 gives 10.51 \times (0.21 + 0.1824)/0.0036 = 1146 per arm, three times more than 389.
- 1 + 24 \times 0.02 = 1.48 (Proposition 8.7), so the 750 patients per arm are worth 507 independent patients.
★★ The Aalen–Johansen estimates add up. (a) Prove that the Aalen–Johansen estimates of all causes sum to one minus the all-cause Kaplan–Meier estimate: \sum_j \hat F_j(t) = 1 - \hat S(t). (b) With constant hazards 0.05 and 0.10, compute the sum of the two “one minus Kaplan–Meier” quantities at t = 20, and comment.
Solution: (a) At each event time t_i, with d_i = \sum_j d_{j,i} events of all causes, \hat S(t_i^-) - \hat S(t_i) = \hat S(t_i^-)\,\frac{d_i}{n_i} = \sum_j \hat S(t_i^-)\,\frac{d_{j,i}}{n_i} . Summing over t_i \le t telescopes to 1 - \hat S(t) on the left and gives \sum_j \hat F_j(t) on the right.
- (1 - e^{-1}) + (1 - e^{-2}) = 1.50: the naive “probabilities” of the two causes add up to more than 1, which shows that they are not real-world risks (Proposition 8.14).
★★★ Non-collapsibility of the odds ratio. In a randomized trial, a prognostic factor L with P(L = 1) = 0.5 is independent of treatment. The control risk is 0.2 if L = 0 and 0.6 if L = 1, and the treatment multiplies the odds by 3 in both strata. (a) Compute the marginal risks and the marginal odds ratio. (b) Do the same for the risk difference. (c) Discuss which effect a trial should report, and what happens to a hazard ratio when a prognostic covariate is omitted from a Cox model.
Hints and expected result: (a) The treated risks are 0.429 and 0.818, so the marginal risks are 0.623 and 0.400 and the marginal odds ratio is 2.48, below the common conditional value 3, without any confounding. (b) The marginal risk difference, 0.223, is the average of the conditional ones (0.229 and 0.218): it is collapsible.
- Conditional and marginal odds ratios answer different questions; adjusting for prognostic factors in a logistic model increases power, although the standard error of the log odds ratio grows (Robinson and Jewell, 1991), and it changes the estimand. The same attenuation affects hazard ratios when a prognostic covariate is omitted (Gail, Wieand and Piantadosi, 1984). The choice links to the estimand of section 8.1 and to the open questions of ch. 9.
★★★ A group-sequential survival trial (computational). The trial of Example 8.12 (HR 0.75, power 0.80) adds an interim analysis after 190 of the 380 events, with O’Brien–Fleming boundaries 2.797 and 1.977. (a) Simulate the log-rank statistics at both looks, using Theorem 8.11 and the correlation of Proposition 8.4, and estimate the type I error, the power, the probability of stopping early and the expected number of events. (b) Then simulate full trials with exponential survival and uniform accrual and compare.
Hints and expected result: in the normal approximation, the type I error is 0.050, the power 0.797 (0.801 for the fixed design), the probability of stopping at the interim 0.21 under the alternative, and the expected number of events 340 instead of 380. Full simulations should agree within Monte Carlo error.
★★★ Doubly robust estimation with machine learning. Replace the parametric models of Code 7.13 by random forests or gradient boosting from scikit-learn, (a) fitted and evaluated on the same data, and (b) with two-fold cross-fitting, as in double machine learning. Over 100 replications with n = 2000, compare the bias, the standard deviation and the coverage of the Wald interval based on the influence function.
Hints and expected result: the variance is estimated by the empirical variance of the terms in the sum of Proposition 7.7, divided by n. Without cross-fitting, overfitted outcome models leave residuals too small and the coverage falls below 95 %; with cross-fitting it should be close to 95 % (Chernozhukov et al., 2018). Clip the estimated propensity scores, for instance to [0.01, 0.99].
Projects and assessment
The official assessment (master-mva.com, “Mode de validation”) combines a final exam (60%) and a home project with its presentation (40%); the home projects are carried out in groups and presented in the final 3-hour session. The group subjects below are proposals sized for that home project, the solo subjects suit individual practice or a smaller variant, and the written exam is a proposal in the spirit of the final exam. All use public or simulated data and run on a laptop.
Solo projects
- [Solo · ≈ 20 h] Immortal time bias, reproduced. Paper study of Suissa (2008), “Immortal time bias in pharmaco-epidemiology”. Simulate cohorts in which a drug without effect is started during follow-up, and compare the analyses described in the paper: time-fixed “ever users”, exclusion of the immortal time, landmark, and time-dependent Cox model.
- Success criterion: the naive rate ratios match Proposition 3.10 within Monte Carlo error, and the 95 % interval of the time-dependent hazard ratio covers 1 in 93–97 % of 500 replications.
- Deliverables: code, a 4–6 page report, a 10-minute talk. Chapters: ch. 3, 5. Evaluation: the rubric below.
- [Solo · ≈ 20 h] Internal validation strategies compared. Paper study of Steyerberg et al. (2001). On the Wisconsin diagnostic breast cancer data (569 patients, bundled with scikit-learn as
load_breast_cancer), draw development samples of 100 patients, fit a penalized logistic model, and estimate its AUC and calibration slope by split-sample, 10-fold cross-validation and bootstrap optimism correction.- Success criterion: using the remaining patients as a test set, report the bias and root mean squared error of each method over 200 draws, and check whether the bootstrap has the smallest error, as the paper concludes.
- Deliverables: code, a 4–6 page report with a decision curve, a 10-minute talk. Chapters: ch. 0, 6. Evaluation: the rubric below.
- [Solo · ≈ 20 h] Competing risks in primary biliary cholangitis. Use the Mayo Clinic PBC trial data (Fleming and Harrington, 1991, appendix D; distributed as
pbcwith the R packagesurvival, from which it exports to a CSV file), with death and liver transplantation as competing events.- Work: implement the Aalen–Johansen estimator and the cause-specific Cox model from Codes 5.7 and 8.15, with tied times handled, compare with one minus Kaplan–Meier, and interpret the effect of bilirubin on each cause.
- Success criterion: your curves match an established implementation (
survfitof the R packagesurvival, orAalenJohansenFitteroflifelines, which breaks ties by a small jitter) to three decimals, and the overestimation of Proposition 8.14 is quantified. - Deliverables: code, a 4–6 page report, a 10-minute talk. Chapters: ch. 4, 5, 8. Evaluation: the rubric below.
Group projects
- [Group of 2–3 · ≈ 30 h each] Emulating a target trial: smoking cessation and weight gain. Use the NHEFS data distributed with the book of Hernán and Robins (2020), which follow smokers of the NHANES I Epidemiologic Follow-up Study from 1971–1975 to 1982.
- Work: write the target-trial protocol, then estimate the effect of quitting smoking on weight gain by standardization, inverse probability weighting, AIPW and propensity-score matching; check balance; compute an E-value.
- Success criterion: reproduce the IP-weighted and standardized estimates reported in chapters 12 and 13 of the book to within 0.1 kg, then explain the differences between the four estimators.
- Split: protocol and data preparation; outcome and propensity models; sensitivity analyses and report. Deliverables: code, a 6–8 page report, a 15-minute group presentation. Chapters: ch. 3, 7.
- Evaluation: the rubric below, with the presentation given in the final 3-hour session.
- [Group of 2–3 · ≈ 30 h each] Designing a survival trial when hazards are not proportional. Paper study of Royston and Parmar (2013). Design a two-arm trial with Schoenfeld’s formula, then simulate it under proportional hazards and under a delayed treatment effect, as seen with some immunotherapies.
- Work: compare the log-rank test, a weighted log-rank test emphasizing late differences, and the difference in restricted mean survival time, with and without an O’Brien–Fleming interim analysis.
- Success criterion: type I errors within 0.045–0.055 over 10 000 simulated trials; power curves and expected numbers of events for each method and scenario.
- Split: simulation engine and accrual model; tests and interim analysis; summary of operating characteristics. Deliverables: code, a 6–8 page report, a 15-minute presentation. Chapters: ch. 2, 4, 5, 8.
- Evaluation: the rubric below, with the presentation given in the final 3-hour session.
- [Group of 2–3 · ≈ 30 h each] Developing and externally validating a prognostic model in breast cancer. Paper study of Royston and Altman (2013), who developed a Cox model on the Rotterdam breast cancer data and validated it on the German Breast Cancer Study Group trial (Schumacher et al., 1994); both data sets are distributed with the R packages
survivalandTH.data.- Work: develop a Cox model for recurrence-free survival, then validate it externally at 5 years: Harrell’s and Uno’s C, calibration plot, IPCW Brier score, and recalibration of the baseline hazard.
- Success criterion: the full validation table of the paper’s kind for your model, with bootstrap intervals, and a comparison with a random survival forest.
- Split: development and internal validation; external validation measures; recalibration, comparison and report. Deliverables: code, a 6–8 page report, a 15-minute presentation. Chapters: ch. 5, 6, 8.
- Evaluation: the rubric below, with the presentation given in the final 3-hour session.
Written exam (proposal)
Format: 2 hours, one handwritten A4 sheet and a calculator allowed, four exercises.
Question (4 points). Define confounding and immortal-time bias. For each, give a clinical example, say in which direction it biases the estimate, and name one design and one analysis that remove it.
Expected: Definition 3.5 with confounding by indication as example, either direction; Definition 3.9 with the “ever treated” example, bias in favour of treatment (Proposition 3.10). Remedies: randomization or stratification, regression, standardization, IPW for confounding; time-dependent covariates, landmark or target trial emulation with an aligned time zero for immortal time.
Question (6 points). Group A has survival times 3, 5, 7+, 9, 11+ and group B has 1, 2, 4, 6+, 8 (months). (a) Compute the Kaplan–Meier curves and the median survival in each group. (b) Compute the log-rank statistic and conclude at the 5 % level. (c) Give one reason why a hazard ratio from a Cox model could be misleading here.
Expected: (a) A: 0.8, 0.6, 0.3 at 3, 5, 9, median 9; B: 0.8, 0.6, 0.4, 0 at 1, 2, 4, 8, median 4. (b) O_B = 4, E_B = 2.41, V = 1.42, statistic 1.77, p = 0.18: not significant. (c) Ten patients, few events, and nothing to check proportional hazards with.
Question (5 points). A trial compares two strategies on mortality at one year, expected to be 30 % with the standard and 20 % with the new strategy. (a) Compute the number of patients per arm for \alpha = 0.05 and power 0.90. (b) The trial is finally randomized by hospital, with 40 patients per hospital and an intracluster correlation of 0.01: correct the sample size. (c) Explain why an interim analysis at half the patients cannot use the threshold 1.96.
Expected: (a) 389 per arm (Example 2.8). (b) Design effect 1 + 39 \times 0.01 = 1.39, so 541 per arm, about 14 hospitals. (c) Two looks at 1.96 give a type I error of about 0.083 (Proposition 8.4); use, for example, O’Brien–Fleming boundaries.
Question (5 points). Under consistency, conditional exchangeability given L and positivity, prove that E[Y(1)] = E[AY/e(L)] with e(L) = P(A = 1 \mid L). Then prove that A \perp L \mid e(L).
Expected: the three-line proof of Theorem 7.4 with each assumption named where it is used; the balancing property of Theorem 7.6 through the tower property.
Grading rubric (proposal)
| Criterion | Weight | What earns the marks |
|---|---|---|
| Statistical correctness | 30 % | Methods suited to the question and the data; assumptions stated and checked; derivations correct |
| Design and estimand | 15 % | A precise question, a stated estimand and time zero, biases anticipated |
| Analysis and reproducibility | 20 % | Clean code with fixed seeds, comparison with an established implementation or a published result, uncertainty reported |
| Interpretation | 15 % | Effects reported with intervals and absolute measures; limitations and clinical meaning discussed |
| Report | 10 % | Clear structure and figures, reporting guideline followed (CONSORT, STROBE or TRIPOD), within the page limit |
| Presentation | 10 % | One key message in the allotted time, precise answers to questions, balanced contribution of the group members |
References
Official sources (2026–2027):
- Course page “Biostatistics” on master-mva.com: https://www.master-mva.com/cours/biostatistics/ — objectives, organisation of the sessions, assessment and themes. The official pages list no bibliography; the references below are standard works chosen for these notes.
- Université Paris-Saclay, M2 Mathématiques, Vision, Apprentissage, programme table and course detail “Biostatistics” (volume, ECTS, nature of the assessment).
Textbooks:
- S. J. Pocock, Clinical Trials: A Practical Approach, Wiley, 1983.
- L. M. Friedman, C. D. Furberg, D. L. DeMets, D. M. Reboussin, C. B. Granger, Fundamentals of Clinical Trials, 5th ed., Springer, 2015.
- S. Senn, Statistical Issues in Drug Development, 2nd ed., Wiley, 2007.
- C. Jennison, B. W. Turnbull, Group Sequential Methods with Applications to Clinical Trials, Chapman & Hall/CRC, 2000.
- K. J. Rothman, S. Greenland, T. L. Lash, Modern Epidemiology, 3rd ed., Lippincott Williams & Wilkins, 2008.
- J. D. Kalbfleisch, R. L. Prentice, The Statistical Analysis of Failure Time Data, 2nd ed., Wiley, 2002.
- J. P. Klein, M. L. Moeschberger, Survival Analysis: Techniques for Censored and Truncated Data, 2nd ed., Springer, 2003.
- T. R. Fleming, D. P. Harrington, Counting Processes and Survival Analysis, Wiley, 1991.
- P. K. Andersen, Ø. Borgan, R. D. Gill, N. Keiding, Statistical Models Based on Counting Processes, Springer, 1993.
- T. M. Therneau, P. M. Grambsch, Modeling Survival Data: Extending the Cox Model, Springer, 2000.
- E. W. Steyerberg, Clinical Prediction Models: A Practical Approach to Development, Validation, and Updating, 2nd ed., Springer, 2019.
- F. E. Harrell Jr., Regression Modeling Strategies, 2nd ed., Springer, 2015.
- M. A. Hernán, J. M. Robins, Causal Inference: What If, Chapman & Hall/CRC, 2020.
- G. W. Imbens, D. B. Rubin, Causal Inference for Statistics, Social, and Biomedical Sciences, Cambridge University Press, 2015.
- J. Pearl, Causality: Models, Reasoning, and Inference, 2nd ed., Cambridge University Press, 2009.
- A. W. van der Vaart, Asymptotic Statistics, Cambridge University Press, 1998.
- S. M. Berry, B. P. Carlin, J. J. Lee, P. Müller, Bayesian Adaptive Methods for Clinical Trials, Chapman & Hall/CRC, 2010.
Chapters 0–2 (inference, designs, trials):
- B. Woolf, “On estimating the relation between blood group and disease”, Annals of Human Genetics 19(3), 1955.
- D. G. Altman, J. M. Bland, “Absence of evidence is not evidence of absence”, BMJ 311, 1995.
- J. Cornfield, “A method of estimating comparative rates from clinical data. Applications to cancer of the lung, breast, and cervix”, Journal of the National Cancer Institute 11(6), 1951.
- K. F. Schulz, D. G. Altman, D. Moher, for the CONSORT Group, “CONSORT 2010 Statement: updated guidelines for reporting parallel group randomised trials”, BMJ 340, c332, 2010.
- E. von Elm et al., “The Strengthening the Reporting of Observational Studies in Epidemiology (STROBE) statement: guidelines for reporting observational studies”, The Lancet 370(9596), 2007.
- J. Neyman, “On the application of probability theory to agricultural experiments. Essay on principles. Section 9” (1923), translated by D. M. Dabrowska and T. P. Speed, Statistical Science 5(4), 1990.
- D. B. Rubin, “Estimating causal effects of treatments in randomized and nonrandomized studies”, Journal of Educational Psychology 66(5), 1974.
- D. R. Taves, “Minimization: a new method of assigning patients to treatment and control groups”, Clinical Pharmacology & Therapeutics 15(5), 1974.
- S. J. Pocock, R. Simon, “Sequential treatment assignment with balancing for prognostic factors in the controlled clinical trial”, Biometrics 31(1), 1975.
- The Cardiac Arrhythmia Suppression Trial (CAST) Investigators, “Preliminary report: effect of encainide and flecainide on mortality in a randomized trial of arrhythmia suppression after myocardial infarction”, New England Journal of Medicine 321(6), 1989.
- G. Piaggio, D. R. Elbourne, S. J. Pocock, S. J. W. Evans, D. G. Altman, for the CONSORT Group, “Reporting of noninferiority and equivalence randomized trials: extension of the CONSORT 2010 statement”, JAMA 308(24), 2012.
- S. Holm, “A simple sequentially rejective multiple test procedure”, Scandinavian Journal of Statistics 6(2), 1979.
- The Coronary Drug Project Research Group, “Influence of adherence to treatment and response of cholesterol on mortality in the Coronary Drug Project”, New England Journal of Medicine 303(18), 1980.
Chapter 3 (therapeutic evaluation and biases):
- D. Schwartz, J. Lellouch, “Explanatory and pragmatic attitudes in therapeutical trials”, Journal of Chronic Diseases 20(8), 1967.
- C. R. Charig, D. R. Webb, S. R. Payne, J. E. A. Wickham, “Comparison of treatment of renal calculi by open surgery, percutaneous nephrolithotomy, and extracorporeal shockwave lithotripsy”, British Medical Journal 292(6524), 1986.
- E. H. Simpson, “The interpretation of interaction in contingency tables”, Journal of the Royal Statistical Society, Series B 13(2), 1951.
- N. Mantel, W. Haenszel, “Statistical aspects of the analysis of data from retrospective studies of disease”, Journal of the National Cancer Institute 22(4), 1959.
- N. E. Breslow, “Odds ratio estimators when the data are sparse”, Biometrika 68(1), 1981.
- S. Suissa, “Immortal time bias in pharmaco-epidemiology”, American Journal of Epidemiology 167(4), 2008.
- L. E. Lévesque, J. A. Hanley, A. Kezouh, S. Suissa, “Problem of immortal time bias in cohort studies: example using statins for preventing progression of diabetes”, BMJ 340, b5087, 2010.
- N. Mantel, D. P. Byar, “Evaluation of response-time data involving transient states: an illustration using heart-transplant data”, Journal of the American Statistical Association 69(345), 1974.
- J. R. Anderson, K. C. Cain, R. D. Gelber, “Analysis of survival by tumor response”, Journal of Clinical Oncology 1(11), 1983.
Chapters 4–5 (censored data):
- E. L. Kaplan, P. Meier, “Nonparametric estimation from incomplete observations”, Journal of the American Statistical Association 53(282), 1958.
- M. Greenwood, “The natural duration of cancer”, Reports on Public Health and Medical Subjects 33, HMSO, 1926.
- O. Aalen, “Nonparametric inference for a family of counting processes”, Annals of Statistics 6(4), 1978.
- N. Mantel, “Evaluation of survival data and two new rank order statistics arising in its consideration”, Cancer Chemotherapy Reports 50(3), 1966.
- R. Peto, J. Peto, “Asymptotically efficient rank invariant test procedures”, Journal of the Royal Statistical Society, Series A 135(2), 1972.
- D. R. Cox, “Regression models and life-tables”, Journal of the Royal Statistical Society, Series B 34(2), 1972.
- D. R. Cox, “Partial likelihood”, Biometrika 62(2), 1975.
- N. E. Breslow, “Covariance analysis of censored survival data”, Biometrics 30(1), 1974.
- P. K. Andersen, R. D. Gill, “Cox’s regression model for counting processes: a large sample study”, Annals of Statistics 10(4), 1982.
- P. M. Grambsch, T. M. Therneau, “Proportional hazards tests and diagnostics based on weighted residuals”, Biometrika 81(3), 1994.
- M. A. Hernán, “The hazards of hazard ratios”, Epidemiology 21(1), 2010.
Chapter 6 (validation of prediction models):
- G. S. Collins, J. B. Reitsma, D. G. Altman, K. G. M. Moons, “Transparent reporting of a multivariable prediction model for individual prognosis or diagnosis (TRIPOD): the TRIPOD statement”, BMJ 350, g7594, 2015.
- G. S. Collins et al., “TRIPOD+AI statement: updated guidance for reporting clinical prediction models that use regression or machine learning methods”, BMJ 385, e078378, 2024.
- E. W. Steyerberg, A. J. Vickers, N. R. Cook, T. Gerds, M. Gonen, N. Obuchowski, M. J. Pencina, M. W. Kattan, “Assessing the performance of prediction models: a framework for traditional and novel measures”, Epidemiology 21(1), 2010.
- J. A. Hanley, B. J. McNeil, “The meaning and use of the area under a receiver operating characteristic (ROC) curve”, Radiology 143(1), 1982.
- F. E. Harrell, R. M. Califf, D. B. Pryor, K. L. Lee, R. A. Rosati, “Evaluating the yield of medical tests”, JAMA 247(18), 1982.
- H. Uno, T. Cai, M. J. Pencina, R. B. D’Agostino, L. J. Wei, “On the C-statistics for evaluating overall adequacy of risk prediction procedures with censored survival data”, Statistics in Medicine 30(10), 2011.
- B. Van Calster, D. J. McLernon, M. van Smeden, L. Wynants, E. W. Steyerberg, “Calibration: the Achilles heel of predictive analytics”, BMC Medicine 17, 230, 2019.
- G. W. Brier, “Verification of forecasts expressed in terms of probability”, Monthly Weather Review 78(1), 1950.
- B. Efron, “Estimating the error rate of a prediction rule: improvement on cross-validation”, Journal of the American Statistical Association 78(382), 1983.
- F. E. Harrell, K. L. Lee, D. B. Mark, “Multivariable prognostic models: issues in developing models, evaluating assumptions and adequacy, and measuring and reducing errors”, Statistics in Medicine 15(4), 1996.
- E. W. Steyerberg, F. E. Harrell, G. J. J. M. Borsboom, M. J. C. Eijkemans, Y. Vergouwe, J. D. F. Habbema, “Internal validation of predictive models: efficiency of some procedures for logistic regression analysis”, Journal of Clinical Epidemiology 54(8), 2001.
- P. Peduzzi, J. Concato, E. Kemper, T. R. Holford, A. R. Feinstein, “A simulation study of the number of events per variable in logistic regression analysis”, Journal of Clinical Epidemiology 49(12), 1996.
- R. D. Riley et al., “Calculating the sample size required for developing a clinical prediction model”, BMJ 368, m441, 2020.
- J. C. van Houwelingen, S. le Cessie, “Predictive value of statistical models”, Statistics in Medicine 9(11), 1990.
- A. J. Vickers, E. B. Elkin, “Decision curve analysis: a novel method for evaluating prediction models”, Medical Decision Making 26(6), 2006.
Chapter 7 (causal inference):
- J. M. Robins, “A new approach to causal inference in mortality studies with a sustained exposure period — application to control of the healthy worker survivor effect”, Mathematical Modelling 7(9–12), 1986.
- D. G. Horvitz, D. J. Thompson, “A generalization of sampling without replacement from a finite universe”, Journal of the American Statistical Association 47(260), 1952.
- P. R. Rosenbaum, D. B. Rubin, “The central role of the propensity score in observational studies for causal effects”, Biometrika 70(1), 1983.
- P. C. Austin, “An introduction to propensity score methods for reducing the effects of confounding in observational studies”, Multivariate Behavioral Research 46(3), 2011.
- J. M. Robins, A. Rotnitzky, L. P. Zhao, “Estimation of regression coefficients when some regressors are not always observed”, Journal of the American Statistical Association 89(427), 1994.
- J. Pearl, “Causal diagrams for empirical research”, Biometrika 82(4), 1995.
- M. A. Hernán, S. Hernández-Díaz, J. M. Robins, “A structural approach to selection bias”, Epidemiology 15(5), 2004.
- M. A. Hernán, J. M. Robins, “Using big data to emulate a target trial when a randomized trial is not available”, American Journal of Epidemiology 183(8), 2016.
- M. A. Hernán, B. C. Sauer, S. Hernández-Díaz, R. Platt, I. Shrier, “Specifying a target trial prevents immortal time bias and other self-inflicted injuries in observational analyses”, Journal of Clinical Epidemiology 79, 2016.
- T. J. VanderWeele, P. Ding, “Sensitivity analysis in observational research: introducing the E-value”, Annals of Internal Medicine 167(4), 2017.
Chapter 8 (complements):
- International Council for Harmonisation, ICH E9(R1) Addendum on Estimands and Sensitivity Analysis in Clinical Trials to the Guideline on Statistical Principles for Clinical Trials, 2019.
- J. D. Angrist, G. W. Imbens, D. B. Rubin, “Identification of causal effects using instrumental variables”, Journal of the American Statistical Association 91(434), 1996.
- S. J. Pocock, “Group sequential methods in the design and analysis of clinical trials”, Biometrika 64(2), 1977.
- P. C. O’Brien, T. R. Fleming, “A multiple testing procedure for clinical trials”, Biometrics 35(3), 1979.
- K. K. G. Lan, D. L. DeMets, “Discrete sequential boundaries for clinical trials”, Biometrika 70(3), 1983.
- ISIS-2 (Second International Study of Infarct Survival) Collaborative Group, “Randomised trial of intravenous streptokinase, oral aspirin, both, or neither among 17,187 cases of suspected acute myocardial infarction: ISIS-2”, The Lancet 332(8607), 1988.
- P. Royston, M. K. B. Parmar, “Restricted mean survival time: an alternative to the hazard ratio for the design and analysis of randomized trials with a time-to-event outcome”, BMC Medical Research Methodology 13, 152, 2013.
- D. A. Schoenfeld, “Sample-size formula for the proportional-hazards regression model”, Biometrics 39(2), 1983.
- O. O. Aalen, S. Johansen, “An empirical transition matrix for non-homogeneous Markov chains based on censored observations”, Scandinavian Journal of Statistics 5(3), 1978.
- J. P. Fine, R. J. Gray, “A proportional hazards model for the subdistribution of a competing risk”, Journal of the American Statistical Association 94(446), 1999.
- H. Putter, M. Fiocco, R. B. Geskus, “Tutorial in biostatistics: competing risks and multi-state models”, Statistics in Medicine 26(11), 2007.
- P. C. Austin, D. S. Lee, J. P. Fine, “Introduction to the analysis of survival data in the presence of competing risks”, Circulation 133(6), 2016.
- P. J. Heagerty, T. Lumley, M. S. Pepe, “Time-dependent ROC curves for censored survival data and a diagnostic marker”, Biometrics 56(2), 2000.
- P. Blanche, J.-F. Dartigues, H. Jacqmin-Gadda, “Estimating and comparing time-dependent areas under receiver operating characteristic curves for censored event times with competing risks”, Statistics in Medicine 32(30), 2013.
- E. Graf, C. Schmoor, W. Sauerbrei, M. Schumacher, “Assessment and comparison of prognostic classification schemes for survival data”, Statistics in Medicine 18(17–18), 1999.
- P. Royston, D. G. Altman, “External validation of a Cox prognostic model: principles and methods”, BMC Medical Research Methodology 13, 33, 2013.
Chapter 9 (research directions):
- C. E. Frangakis, D. B. Rubin, “Principal stratification in causal inference”, Biometrics 58(1), 2002.
- H. Ishwaran, U. B. Kogalur, E. H. Blackstone, M. S. Lauer, “Random survival forests”, Annals of Applied Statistics 2(3), 2008.
- J. L. Katzman, U. Shaham, A. Cloninger, J. Bates, T. Jiang, Y. Kluger, “DeepSurv: personalized treatment recommender system using a Cox proportional hazards deep neural network”, BMC Medical Research Methodology 18, 24, 2018.
- E. Christodoulou, J. Ma, G. S. Collins, E. W. Steyerberg, J. Y. Verbakel, B. Van Calster, “A systematic review shows no performance benefit of machine learning over logistic regression for clinical prediction models”, Journal of Clinical Epidemiology 110, 2019.
- E. J. Candès, L. Lei, Z. Ren, “Conformalized survival analysis”, Journal of the Royal Statistical Society, Series B 85(1), 2023.
- S. Wager, S. Athey, “Estimation and inference of heterogeneous treatment effects using random forests”, Journal of the American Statistical Association 113(523), 2018.
- S. R. Künzel, J. S. Sekhon, P. J. Bickel, B. Yu, “Metalearners for estimating heterogeneous treatment effects using machine learning”, Proceedings of the National Academy of Sciences 116(10), 2019.
- V. Chernozhukov, D. Chetverikov, M. Demirer, E. Duflo, C. Hansen, W. Newey, J. Robins, “Double/debiased machine learning for treatment and structural parameters”, The Econometrics Journal 21(1), 2018.
- D. M. Kent et al., “The Predictive Approaches to Treatment effect Heterogeneity (PATH) statement”, Annals of Internal Medicine 172(1), 2020.
- J. M. Franklin et al., “Emulating randomized clinical trials with nonrandomized real-world evidence studies: first results from the RCT DUPLICATE initiative”, Circulation 143(10), 2021.
- I. J. Dahabreh, S. E. Robertson, J. A. Steingrimsson, E. A. Stuart, M. A. Hernán, “Extending inferences from a randomized trial to a new target population”, Statistics in Medicine 39(14), 2020.
- L. Wynants et al., “Prediction models for diagnosis and prognosis of covid-19: systematic review and critical appraisal”, BMJ 369, m1328, 2020.
- Z. Obermeyer, B. Powers, C. Vogeli, S. Mullainathan, “Dissecting racial bias in an algorithm used to manage the health of populations”, Science 366(6464), 2019.
- J. Woodcock, L. M. LaVange, “Master protocols to study multiple therapies, multiple diseases, or both”, New England Journal of Medicine 377(1), 2017.
- The RECOVERY Collaborative Group, “Dexamethasone in hospitalized patients with Covid-19”, New England Journal of Medicine 384(8), 2021.
Projects and exercises:
- M. H. Gail, S. Wieand, S. Piantadosi, “Biased estimates of treatment effect in randomized experiments with nonlinear regressions and omitted covariates”, Biometrika 71(3), 1984.
- L. D. Robinson, N. P. Jewell, “Some surprising results about covariate adjustment in logistic regression models”, International Statistical Review 59(2), 1991.
- W. N. Street, W. H. Wolberg, O. L. Mangasarian, “Nuclear feature extraction for breast tumor diagnosis”, IS&T/SPIE International Symposium on Electronic Imaging: Science and Technology, volume 1905, 1993.
- M. Schumacher et al., “Randomized 2 × 2 trial evaluating hormonal treatment and the duration of chemotherapy in node-positive breast cancer patients”, Journal of Clinical Oncology 12(10), 1994.