library(SuperLearner)
library(lmtp)
library(ggplot2)
# helper functions and data for this session
source("practical/R/utils.R")
source("practical/R/moderate.R")
source("practical/R/learners.R")
source("practical/R/sim_cpg.R")
source("practical/R/sim_vaccine_trial.R")
methy <- read.csv("practical/data/su2016_methylation.csv.gz")Causal biomarker discovery
Practical session · Causality in Biomedicine 2026 (EMBL-EBI)
Day 3 Practical Session
This page accompanies the practical session on causal biomarker discovery from expression data (Wednesday, 7 October 2026) in the EMBO course Causality in Biomedicine.
Earlier today, you heard two lectures: one on causal effects of modifying a continuous mediator, applied to immune correlates of protection in vaccine trials (slides here), and one on biomarker discovery with causal inference and machine learning (slides here). This session revisits the key ideas of both lectures, hands-on. We will build each method from its parts: you have all the pieces from earlier in the week (structural causal models, identification, model misspecification, targeted learning).
The two parts
-
Biomarker discovery as causal effect estimation. Which CpG sites in whole blood are affected by smoking? We will reconstruct the
biotmleprocedure: an efficient, machine-learning-based estimator of the average treatment effect (ATE) for each CpG, combined with the variance moderation that makeslimmauseful. Real data from Su et al. (2016), as analyzed in Hejazi et al. (2023). - Stochastic-interventional vaccine efficacy (SVE). How would vaccine efficacy change if a vaccine induced higher (or lower) antibody titers? We will estimate vaccine efficacy under a modified treatment policy (MTP) that shifts an immune marker, in a simulated vaccine efficacy trial.
A theme runs through both: each causal parameter we target reduces to a familiar coefficient of a linear model when that model is correct. The linear model is more accessible, but more brittle; the exercises ask you to see exactly where it breaks.
In Part 1, the biomarker is an outcome of the exposure. In Part 2, the biomarker lies on the causal pathway between vaccination and infection: it is a mediator.
Notation
We use the same notation in both parts, close to that of the lectures; each part also has a table of its own symbols.
Data, model, and parameters
- Data and variables. \(O\) is the data on on study unit (e.g., a patient in a clinical trial); we assume \(O \sim \P_0\), the true, unknown data-generating distribution, and that we observe \(n\) independent copies \(O_1, \ldots, O_n\), whose empirical distribution we denote \(\P_n\). In the simplest case, \(O = (L, A, Y)\), with baseline covariates \(L\), an exposure \(A \in \{0, 1\}\), and an outcome \(Y\).
- Statistical model. \(\mathcal{P}\) is a collection of candidate probability distributions among which \(\P_0\) falls. Throughout, we assume \(\mathcal{P}\) to be nonparametric, that is, we assume nothing about \(\P_0\) beyond what the study design guarantees.
- Causal parameters. A causal parameter is a contrast of counterfactual outcomes, \(Y(a)\), for example, the ATE, \(\E[Y(1) - Y(0)]\). Under assumptions, a causal parameter is identified by a statistical (or observed-data) parameter.
- Statistical parameter: A functional of the data-generating distribution \(\P_0\), a statistical parmaeter is a mapping \(\Psi\) from the statistical model, \(\mathcal{P}\), to an outcome space (e.g., \(\mathbb{R}\)), with true value \(\psi_0 = \Psi(\P_0)\). We use a naught subscript to denote a quantity with respect to \(\P_0\), e.g., \(\E_0\) and \(\V_0\) for the mean and variance under \(\P_0\).
Estimators, nuisance parameters, and variance estimation
- Nuisance parameters. \(\Psi\) depends on \(\P_0\) through simpler pieces that are not of interest in themselves but must be estimated (with GLMs or the Super Learner): the propensity score \(g_0(L) = \P_0(A = 1 \mid L)\) and the outcome regression \(\overline{Q}_0(A, L) = \E_0[Y \mid A, L]\).
- Estimators. A subscript \(n\) marks an estimate from the \(n\) observations (e.g., \(g_n\), \(\overline{Q}_n\), \(\psi_n\)). A plug-in estimate substitutes initial nuisance estimates into \(\Psi\); the one-step estimator \(\psi^+_n\) adds the empirical mean of the estimated efficient influence function to it; and the TMLE \(\psi^\star_n = \Psi(\P^\star_n)\) plugs in a targeted estimate, marked with a star (e.g., \(\overline{Q}^\star_n\)). We write \(\operatorname{expit}(x) = 1 / (1 + e^{-x})\), with inverse \(\operatorname{logit}\).
- Variance estimation. \(D(O; \P)\) is the efficient influence function (EIF) of \(\Psi\) at \(\P\). Its variance, \(\sigma^2_0 = \V_0[D(O; \P_0)]\), is the smallest asymptotic variance of a regular estimator; its empirical variance at the estimates, \(\sigma^2_n\), gives the standard error \(\sqrt{\sigma^2_n / n}\) of an efficient estimator.
How the session works
Exercises come in two kinds:
- ✏️ pen and paper: short derivations or explanations, and
- 💻 coding: fill in the blanks (
___) in the code provided, then run it.
Work in pairs if you like. Course trainers will circulate. Please ask questions! Exercises marked stretch are for those who finish early.
Setup
All code should run on the course VM. Open RStudio, start a new script, and run:
The data and helper scripts can also be downloaded directly: su2016_methylation.csv.gz, utils.R, moderate.R, learners.R, sim_cpg.R, sim_vaccine_trial.R.