Tutorials › Propensity Score Matching and Instrumental Variables › End-to-End AIPW and TMLE Analysis of a Study Dataset

Doubly Robust Estimation · Tutorial 329 of 699

End-to-End AIPW and TMLE Analysis of a Study Dataset

Work through a complete AIPW and TMLE analysis, from defining the estimand and fitting nuisance models to reporting uncertainty and diagnosing weak overlap.

Advanced 13 min read

What You'll Learn

  • Define the average treatment effect and the assumptions needed for its identification.
  • Specify propensity-score and outcome-regression nuisance models for an analysis.
  • Calculate an AIPW estimate and a TMLE update from hypothetical study data.
  • Estimate uncertainty using the empirical efficient influence function.
  • Diagnose positivity problems, unstable weights, and targeting failures.
  • Distinguish estimator diagnostics from assumptions that data cannot verify.

From a Study Question to an Estimand

An analysis is not complete when software returns an estimate. The target effect, identification assumptions, nuisance fits, estimator, uncertainty calculation, and diagnostics must form a coherent chain. AIPW and TMLE both combine a propensity-score model with an outcome-regression model, but their estimates and uncertainty statements are meaningful only relative to a clearly defined target and defensible assumptions.

Let \(A\) be a binary treatment, with \(A=1\) denoting treatment and \(A=0\) control; let \(X\) be pretreatment covariates; and let \(Y\) be the observed outcome. Write \(Y(1)\) and \(Y(0)\) for the potential outcomes under treatment and control. The target in this tutorial is the average treatment effect (ATE) in the study population.

Definition: The ATE is \(\psi=E[Y(1)-Y(0)]\). Define the propensity score \(e_0(X)=P(A=1\mid X)\) and the outcome regression \(Q_0(a,X)=E[Y\mid A=a,X]\). Under consistency, conditional exchangeability, and positivity, \(\psi=E[Q_0(1,X)-Q_0(0,X)]\).

The identification statement relies on three assumptions. Consistency means the observed outcome equals the potential outcome under the treatment actually received: \(Y=AY(1)+(1-A)Y(0)\). Conditional exchangeability means \((Y(1),Y(0))\) is independent of \(A\) given \(X\); in practical terms, the measured pretreatment covariates suffice to remove confounding. Positivity requires \(0<e_0(X)<1\) for covariate values occurring in the target population. Also assume no interference between participants and a sampling process suitable for the stated population target.

These assumptions are not interchangeable. Model fitting can reveal some practical problems with overlap or data quality, but it cannot establish that all confounders were measured or that consistency is appropriate. In an observational study, exchangeability is a substantive assumption, not an output of the estimation procedure.

Estimators and Their Connection

For each participant, estimate the propensity score by \(\hat e(X)\) and the outcome regression by \(\hat Q(a,X)\). The AIPW estimate averages an outcome-regression contrast and weighted residual corrections:

$$ \hat\psi_{\mathrm{AIPW}}= \frac{1}{n}\sum_{i=1}^n\left[ \hat Q(1,X_i)-\hat Q(0,X_i) +\frac{A_i}{\hat e(X_i)}\{Y_i-\hat Q(1,X_i)\} -\frac{1-A_i}{1-\hat e(X_i)}\{Y_i-\hat Q(0,X_i)\} \right]. $$

The propensity weights correct residuals among treated and control participants, while the outcome model supplies predictions for both treatment conditions. Under the identification assumptions and suitable regularity conditions, the estimator is consistent if either the propensity model or the outcome model is consistently estimated, even if the other nuisance model is misspecified. This is the double-robust property; it does not protect against both models being wrong, unmeasured confounding, or lack of positivity.

A short expectation calculation explains the property. Let \(e_0(X)\) and \(Q_0(a,X)\) be the true nuisance functions, and let \(m_a(X)=E[Y\mid A=a,X]\). For fixed fitted functions, the conditional expectation of the AIPW summand given \(X\) is

$$ \hat Q(1,X)-\hat Q(0,X) +\frac{e_0(X)}{\hat e(X)}\{m_1(X)-\hat Q(1,X)\} -\frac{1-e_0(X)}{1-\hat e(X)}\{m_0(X)-\hat Q(0,X)\}. $$

If \(\hat e=e_0\), the expression reduces to \(m_1(X)-m_0(X)\). If instead \(\hat Q(a,X)=m_a(X)\) for both arms, the residual terms vanish and the expression again equals the true conditional contrast. Averaging over \(X\) gives the ATE.

TMLE uses the same nuisance fits but updates the outcome predictions along a targeted fluctuation so that the fitted predictions satisfy an estimating equation. For a binary outcome, one common logistic fluctuation is

$$ \operatorname{logit}\{\hat Q^*(A_i,X_i)\} = \operatorname{logit}\{\hat Q(A_i,X_i)\} +\epsilon\left\{\frac{A_i}{\hat e(X_i)} -\frac{1-A_i}{1-\hat e(X_i)}\right\}. $$

The coefficient \(\epsilon\) is estimated by fitting the fluctuation with the initial prediction as an offset. Then the TMLE is the average of the updated predicted outcomes under treatment minus the average under control:

$$ \hat\psi_{\mathrm{TMLE}} = \frac{1}{n}\sum_{i=1}^n \{\hat Q^*(1,X_i)-\hat Q^*(0,X_i)\}. $$

The targeting score equation is the sample average of the clever covariate times \(Y_i-\hat Q^*(A_i,X_i)\), set to zero. This links the plug-in estimate to the residual correction in AIPW. For a bounded binary outcome, the logistic update also keeps predicted risks between zero and one.

Worked Example: AIPW and TMLE for a Hypothetical Study

Suppose a hypothetical study has 80 participants and a binary outcome measured at follow-up. For this deliberately simple illustration, there are no varying measured baseline covariates: \(X\) is constant. The table summarizes the outcomes. The propensity model is intercept-only, and the initial outcome model is deliberately restricted to an intercept only, so it predicts the same risk in both treatment groups. This simplification makes the arithmetic transparent; it is not a recommended default when treatment effects or confounders vary with covariates.

GroupParticipantsOutcome equals 1Outcome equals 0
Treated, \(A=1\)403010
Control, \(A=0\)401030

The fitted propensity is \(\hat e=40/80=0.5\). There are 40 outcomes equal to 1 overall, so the intercept-only outcome fit is \(\hat Q(1)=\hat Q(0)=40/80=0.5\). Applying AIPW, the outcome-regression contrast is zero. The treated residual sum is \(30-40(0.5)=10\); the control residual sum is \(10-40(0.5)=-10\). Thus

$$ \hat\psi_{\mathrm{AIPW}} =0+\frac{2(10)}{80}-\frac{2(-10)}{80} =\frac{40}{80}=0.500. $$

The estimated ATE is a 0.500 difference in outcome risk, or 50.0 percentage points, in this hypothetical dataset. For TMLE, the clever covariate is \(2\) for treated participants and \(-2\) for controls. By symmetry, the updated risks are \(p_1\) and \(p_0=1-p_1\). The targeting equation is

$$ 2(30-40p_1)-2(10-40p_0)=0, \qquad p_0=1-p_1, \qquad p_1=0.75,\quad p_0=0.25. $$

Since the initial risk is 0.5 in both groups, the logistic fluctuation coefficient satisfies \(2\epsilon=\operatorname{logit}(0.75)\), so \(\epsilon=\log(3)/2=0.5493\). The plug-in estimate is \(0.75-0.25=0.500\), matching AIPW here. This agreement follows from the symmetry of this constructed example; it is not a guarantee that the two estimates will be identical in other samples.

The numerical computation does not verify causal identification. For this example to represent a causal ATE, the assumptions must be appropriate for the study. In particular, with no varying \(X\), exchangeability says treatment assignment is independent of both potential outcomes. That is a strong assumption for an observational study and cannot be checked from the table.

Uncertainty and What to Report

For the ATE, the efficient influence function evaluated at fitted nuisance functions has the form

$$ \hat D_i= \hat Q(1,X_i)-\hat Q(0,X_i) +\frac{A_i}{\hat e(X_i)}\{Y_i-\hat Q(1,X_i)\} -\frac{1-A_i}{1-\hat e(X_i)}\{Y_i-\hat Q(0,X_i)\} -\hat\psi. $$

For TMLE, use the targeted outcome predictions in this expression and center by \(\hat\psi_{\mathrm{TMLE}}\). An influence-function standard error is the sample standard deviation of these values divided by \(\sqrt n\). A Wald interval is the estimate plus or minus \(1.96\) standard errors for an approximate 95% confidence interval. This approximation requires adequate regularity and an estimator whose nuisance fitting does not invalidate the influence-function approximation; cross-fitting is often used with flexible, data-adaptive nuisance fits.

Worked Example: Influence-Function Standard Error

For the hypothetical study above, the influence-function values are \(0.5\) for each participant with outcome 1 in the treated group, \(-1.5\) for each treated participant with outcome 0, \(-1.5\) for each control participant with outcome 1, and \(0.5\) for each control participant with outcome 0. There are 60 values of \(0.5\) and 20 values of \(-1.5\), which sum to zero. Their sum of squares is

$$ 60(0.5)^2+20(-1.5)^2=60. $$

The sample variance is \(60/79=0.7595\), and the standard error is

$$ SE=\sqrt{\frac{60/79}{80}}=0.09744. $$

The approximate 95% confidence interval is \(0.500\pm1.96(0.09744)=(0.309,0.691)\). In context, this interval estimates a risk difference from 30.9 to 69.1 percentage points under the assumptions and approximation used. It does not mean there is a 95% probability that the fixed ATE is inside this particular interval.

A complete report should name the target population and outcome, state the effect scale and units, describe the covariates and nuisance-fitting approach, give the estimate and uncertainty interval, and summarize relevant diagnostics. If the outcome is binary, a risk difference is not an odds ratio; label the reported scale explicitly.

Diagnostics, Alternatives, and Limitations

Inspect estimated propensity-score distributions by treatment group and look for observations near zero or one. Extreme inverse weights signal weak practical overlap: a few participants can dominate the residual correction, making estimates and standard errors unstable. Also inspect covariate balance after weighting as a diagnostic of the propensity fit, and check outcome predictions for implausible values, convergence warnings, and coding errors. For TMLE, confirm that the fluctuation converged and that the targeting score is close to zero. For AIPW, inspect the empirical estimating-equation contributions and the influence values for unusual leverage.

Worked Example: Recognizing a Positivity Warning

Suppose a separate hypothetical dataset has a participant with \(\hat e(X)=0.02\) who received treatment. That participant's treated residual contribution in AIPW is multiplied by \(1/0.02=50\). A control participant with \(\hat e(X)=0.98\) has a control residual multiplied by \(1/(1-0.98)=50\). Even modest residuals can therefore have large influence. This is a warning that the observed data provide little information about one treatment condition for those covariate profiles.

The response is not to assume that double robustness has solved the problem. Check model specification and overlap, report the issue, and reconsider whether the target population is supported by the data. Truncating weights or changing the target can alter bias or the estimand; such changes require explicit justification and should be reported rather than treated as invisible repairs.

AIPW and TMLE differ in construction: AIPW adds weighted residual corrections to the initial outcome contrast, whereas TMLE updates the outcome predictions and uses a plug-in contrast. Under suitable conditions they can share the same first-order behavior, but finite-sample estimates can differ. Outcome regression alone avoids inverse weights but depends directly on the outcome model. Inverse-probability weighting alone depends directly on the propensity model and can be unstable with extreme scores. Matching is another design and estimation approach, with its own choices and target interpretation; it is not a substitute for checking identification assumptions.

The double-robust guarantee concerns nuisance-model consistency under the identification assumptions; it is not a finite-sample guarantee, nor does it ensure valid standard errors for arbitrary machine-learning fits. Flexible fitting can overfit, and poor overlap can defeat stable estimation even with well-fitting models. Cross-fitting helps address certain overfitting effects in inference, but it does not cure confounding, poor positivity, or misspecified target definitions. A diagnostic plot or a successful convergence message is evidence about computation, not proof that a causal interpretation is warranted.

  • Common mistake: “AIPW is doubly robust, so the estimate is causal even if the covariates omit a confounder.” The correction is that double robustness addresses estimation of nuisance functions; causal identification still requires conditional exchangeability given the covariates used.
  • Common mistake: “The propensity scores are not exactly zero or one, so positivity is fine.” The correction is to assess practical overlap and the influence of extreme weights, not only whether fitted values are mathematically inside the interval.
  • Common mistake: “AIPW and TMLE agree, so the assumptions are confirmed.” Agreement is not an assumption check; both procedures can share the same confounding and data limitations.
1
Define the question.
Specify treatment, outcome, target population, follow-up, and effect scale before fitting models.
2
State identification assumptions.
Assess whether consistency, exchangeability, positivity, and the sampling assumptions are plausible in context.
3
Fit and inspect nuisance functions.
Estimate propensity scores and outcome regressions using pretreatment covariates, and check overlap, fit, and data-adaptive fitting choices.
4
Estimate and quantify uncertainty.
Compute AIPW or TMLE, verify the estimating equation where applicable, and use an appropriate influence-function or other justified variance procedure.
5
Report limits alongside results.
Present the estimate, units, interval, diagnostics, and assumptions that cannot be established by the observed data.

Check Your Understanding

Answer each question, then check the brief solutions below.

  1. Which three assumptions identify the ATE from the observed data in this setup?
  2. In the hypothetical 80-person example, what was the fitted propensity score and what was the AIPW risk difference?
  3. What does the double-robust property guarantee, and what does it not guarantee?
  4. Why is a fitted propensity score of 0.02 a practical concern for a treated participant?

Solutions. (1) Consistency, conditional exchangeability given \(X\), and positivity. (2) The propensity score was \(0.5\), and the AIPW estimate was \(0.500\), or 50.0 percentage points. (3) Under the identification assumptions and suitable regularity conditions, consistency can hold if either nuisance model is consistently estimated; this does not address unmeasured confounding, failure of positivity, or both nuisance models being wrong. (4) The treated residual is multiplied by \(1/0.02=50\), so that participant can have disproportionate influence and signal weak overlap.

Clinical Biostats