Tutorials › Propensity Score Matching and Instrumental Variables › Covariate-Adjusted Two-Stage Least Squares In A Cohort

Worked Examples · Tutorial 693 of 699

Covariate-Adjusted Two-Stage Least Squares In A Cohort

Work through adjusted 2SLS estimation and reporting, then evaluate what its coefficient means under conditional instrumental-variable assumptions.

Intermediate 12 min read

What You'll Learn

  • Specify the first and second stages with the same pre-treatment covariates.
  • Calculate a covariate-adjusted IV estimate from stratum-specific first-stage and reduced-form contrasts.
  • Report a 2SLS estimate with heteroskedasticity-robust uncertainty and first-stage evidence.
  • Distinguish instrument relevance from conditional independence, exclusion, and monotonicity.
  • Recognize diagnostics and violations that covariate adjustment cannot repair.

Why Adjust for Covariates in an IV Analysis?

In an observational cohort, an instrument may be plausibly unrelated to potential treatment and outcome only after conditioning on measured baseline characteristics. For example, a prescribing preference might be more common in some hospitals or among patients with particular baseline severity. Covariate-adjusted two-stage least squares (2SLS) includes those characteristics in both stages, while using the instrument—not the covariates alone—to isolate variation in treatment for the IV estimate.

Adjustment is not a substitute for a credible instrument. It can make a conditional IV assumption more plausible when the covariates capture relevant differences, but it cannot establish that assumption or remove bias from an invalid instrument. The interpretation depends on the instrument being relevant and valid given the included covariates.

Definition: Let \(Y\) be an outcome, \(D\) a treatment, \(Z\) an instrument, and \(X\) a vector of measured pre-treatment covariates. Covariate-adjusted 2SLS estimates the coefficient of \(D\) in a linear outcome model by instrumenting \(D\) with \(Z\), while including the same \(X\) terms in both stages. With one instrument and one endogenous treatment, the first stage regresses \(D\) on \(Z\) and \(X\); the second stage regresses \(Y\) on the first-stage fitted treatment and \(X\).

Specification and Conditional IV Assumptions

For a single instrument and treatment, a basic specification is

$$ D_i=\pi_0+\pi_Z Z_i+X_i^\top\pi_X+v_i,\qquad Y_i=\beta_0+\beta_D D_i+X_i^\top\beta_X+\epsilon_i. $$

The first stage produces \(\hat D_i\), the fitted value from regressing \(D_i\) on \(Z_i\) and \(X_i\). In the second stage, estimate \(Y_i\) on \(\hat D_i\) and the same \(X_i\). In actual 2SLS computation, the instrument set is \(Z\) together with the included exogenous regressors \(X\) (and the intercept); it is not correct to use the fitted treatment as the sole predictor in the second stage.

The conditions for a causal interpretation are substantive as well as statistical. Let \(D_i(z)\) denote the treatment that would be received under instrument value \(z\), and \(Y_i(d,z)\) the outcome under treatment \(d\) and instrument value \(z\). In a binary-instrument, binary-treatment setting, common conditional assumptions are:

  • Relevance: treatment receipt varies with the instrument after conditioning on \(X\). Formally, \(P(D=1\mid Z=1,X)\) differs from \(P(D=1\mid Z=0,X)\) for at least some covariate values in the target population.
  • Conditional independence: given \(X\), the instrument is independent of the potential treatments and potential outcomes. This is the “as-if random” condition for the instrument after adjustment.
  • Exclusion: \(Y_i(d,1)=Y_i(d,0)\): changing the instrument has no effect on the outcome except through its effect on treatment.
  • Monotonicity: \(D_i(1)\ge D_i(0)\) for every individual, ruling out individuals who would take treatment under \(Z=0\) but not under \(Z=1\).
  • Consistency and no interference: observed treatment and outcome agree with the potential values under the conditions actually experienced, and one person’s instrument or treatment does not alter another person’s outcome.

The covariates should be measured before the instrument and treatment, and the conditional assumptions must hold within levels of those covariates. Adjusting for a mediator or a collider can introduce bias rather than reduce it. There must also be adequate overlap in instrument values across relevant covariate patterns; without it, conditional contrasts depend heavily on extrapolation.

If the treatment effect is constant in the specified linear model, \(\beta_D\) can be interpreted as that common causal effect under valid IV assumptions. With a binary instrument and treatment and heterogeneous effects, a valid IV generally identifies an effect for compliers—people whose treatment is changed by the instrument—not the average treatment effect for everyone. Covariate-adjusted 2SLS need not equal a simple unweighted average of stratum-specific complier effects.

What the 2SLS Calculation Does

The central calculation can be seen by removing the linear contribution of the included covariates from \(D\), \(Y\), and \(Z\). Write \(\tilde D\), \(\tilde Y\), and \(\tilde Z\) for the residuals after each variable is regressed on the intercept and \(X\). With one excluded instrument, the adjusted IV coefficient is

$$ \hat\beta_D^{\,2SLS} = \frac{\sum_i \tilde Z_i\tilde Y_i} {\sum_i \tilde Z_i\tilde D_i}. $$

The numerator is the covariate-adjusted instrument–outcome relationship, and the denominator is the covariate-adjusted instrument–treatment relationship. Their ratio is the treatment effect implied by those two relationships. This expression is also a justification for including the same covariates consistently: it compares the instrument’s relationship with outcome and treatment after both have been adjusted for \(X\).

More generally, let \(A\) contain the endogenous regressor \(D\) and the included covariates, and let \(Q\) contain the excluded instrument \(Z\), the included covariates, and the intercept. The 2SLS estimator is

$$ \hat\theta=(A^\top P_Q A)^{-1}A^\top P_QY, \qquad P_Q=Q(Q^\top Q)^{-1}Q^\top. $$

The coefficient of \(D\) in \(\hat\theta\) is the adjusted IV estimate. Heteroskedasticity-robust standard errors use a sandwich covariance estimator based on the 2SLS residuals and the instrument vector \(Q\). In practice, request a robust 2SLS covariance estimate from statistical software; the ordinary least-squares standard error from a regression of \(Y\) on \(\hat D\) and \(X\) is not the correct substitute.

Worked Example: Adjusting for a Binary Baseline Covariate

Consider a hypothetical cohort in which \(Z\) indicates assignment to a higher-prescribing hospital, \(D\) indicates receipt of a treatment, \(Y\) is a continuous recovery score, and \(X\) indicates high baseline severity. There are 100 patients in each \(Z,X\) cell. The cell means are:

Baseline severity \(X\)Instrument \(Z\)Mean treatment \(D\)Mean outcome \(Y\)
000.205.00
010.355.09
100.306.00
110.456.09

Within each severity group, the instrument raises the treatment rate by \(0.15\). The adjusted first-stage relationship therefore has slope \(0.15\) for \(Z\); the treatment rates also differ by \(0.10\) between severity groups. The adjusted reduced-form outcome difference is \(0.09\) score points in each severity group. Because each cell has equal size, the covariate-adjusted ratio is

$$ \hat\beta_D^{\,2SLS} =\frac{0.09}{0.15} =0.60\text{ score points per treatment}. $$

This is the numerical 2SLS estimate for the displayed cell means: the instrument is associated with a \(0.09\)-point adjusted outcome difference and a \(0.15\) adjusted treatment-probability difference. The computation establishes neither conditional independence nor exclusion. Those remain design assumptions to defend, and cell means alone do not provide the individual-level information needed to calculate a robust standard error.

Worked Reporting: Estimate, Uncertainty, and First Stage

A useful report presents the treatment coefficient with an uncertainty interval and units, as well as evidence about the first stage. The first-stage coefficient describes how strongly the instrument predicts treatment conditional on the listed covariates. It does not establish instrument validity.

Worked Example: Reporting a Robust 2SLS Result

Suppose a hypothetical cohort analysis includes 1,200 patients, baseline age, baseline severity, and hospital indicators in both stages. The instrument is binary and the treatment is an indicator. A heteroskedasticity-robust first-stage fit gives an instrument coefficient of \(0.126\) with robust \(SE=0.021\). The 2SLS fit gives an outcome coefficient of \(0.84\) recovery-score points per treatment, with robust \(SE=0.29\).

For a single excluded instrument, the robust first-stage Wald statistic is the squared coefficient-to-standard-error ratio:

$$ F=\left(\frac{0.126}{0.021}\right)^2=6^2=36.0. $$

Thus, conditional on the covariates, the estimated instrument-associated increase in treatment probability is \(0.126\), or 12.6 percentage points. The first-stage statistic is evidence of relevance in this sample. It does not show that the instrument is independent of potential outcomes or satisfies exclusion.

Using a normal critical value of 1.96 for a large-sample 95% robust interval, the interval for the 2SLS coefficient is

$$ 0.84\pm1.96(0.29) =0.84\pm0.5684 =[0.2716,\ 1.4084]. $$

Rounded suitably, the estimate is \(0.84\) score points per treatment, with a 95% robust confidence interval from \(0.272\) to \(1.41\) points. Under repeated sampling and the stated model and inference conditions, this procedure has approximately 95% coverage; the interval is not a 95% probability statement about the fixed parameter. A report should identify the covariates, state that robust 2SLS uncertainty was used, and qualify the causal interpretation by the IV assumptions.

Diagnostics, Failure Modes, and Alternatives

Diagnostics can reveal problems without proving that the assumptions hold. Check that both stages use the intended covariates and sample, that covariates are genuinely pre-treatment, and that there is overlap in instrument values across important covariate patterns. Inspect the first-stage coefficient and an appropriate partial or robust joint test of excluded instruments. A large first-stage statistic does not rule out confounding of the instrument or a direct effect of the instrument on the outcome; weak-instrument concerns also require care beyond a routine first-stage significance test.

Consider a hypothetical adjusted reduced-form difference of \(0.10\) outcome units and an adjusted first-stage difference of \(0.20\) in treatment probability. The IV ratio is \(0.10/0.20=0.50\). If the instrument also has a direct effect of \(0.04\) outcome units, the part of the reduced form attributable to treatment is only \(0.10-0.04=0.06\), giving \(0.06/0.20=0.30\). The invalid-instrument ratio is then \(0.20\) units too high in this illustration. Covariate adjustment does not remove that direct effect.

2SLS is not the only analysis that might be reported. An adjusted outcome regression estimates a treatment–outcome association under its own confounding and model assumptions; it does not become an IV estimate merely by including the same covariates. Propensity score matching targets a different comparison and relies on measured-confounder exchangeability and overlap rather than an exclusion restriction. These approaches answer different causal questions under different assumptions, so numerical disagreement is not, by itself, evidence that one result is wrong.

Common pitfall: Regressing \(Y\) on \(\hat D\) alone, or reporting the ordinary least-squares standard error from a manual second-stage regression, is not covariate-adjusted 2SLS. The correction is to include \(X\) in both stages, use \(Z\) and \(X\) as the instrument set for \(D\) and \(X\), and obtain the standard error from the 2SLS estimator with the chosen robust covariance method.

The method also has limits. It identifies effects driven by the instrument-induced treatment variation, not necessarily effects for all cohort members. Results can be imprecise when the instrument weakly predicts treatment, sensitive to violations of exclusion or conditional independence, and dependent on the population and covariate adjustment used. Robust standard errors address heteroskedasticity in the sampling variance; they do not correct a poor instrument, weak identification, model misspecification, or clustering that has been ignored.

1
Define the target and variables.
Specify the cohort, treatment, instrument, outcome, and pre-treatment covariates; state whether the intended interpretation is a common effect or an IV effect for instrument-responsive individuals.
2
Fit consistent stages.
Regress treatment on instrument and covariates, then estimate the outcome equation by 2SLS with the same covariates included.
3
Report both stages and assess assumptions.
Give the adjusted first-stage evidence, the 2SLS estimate with robust uncertainty and units, and a contextual argument for conditional independence, exclusion, overlap, and—when relevant—monotonicity.

Check Your Understanding

Answer each question, then compare your reasoning with the solutions below.

  1. Why should baseline covariates appear in both stages of covariate-adjusted 2SLS?
  2. A fitted first stage gives an instrument coefficient of \(0.08\) with robust \(SE=0.02\). What is the single-instrument robust Wald statistic, and what does it show?
  3. In a binary-instrument, binary-treatment setting, does a valid IV automatically identify the population average treatment effect? Explain.
  4. Give one example of an instrument violation that adding baseline covariates does not necessarily fix.

Solutions. (1) The same covariates define the conditional comparison in the first and second stages; omitting them from either stage does not implement the specified adjusted IV estimator. (2) \(F=(0.08/0.02)^2=4^2=16\). This is first-stage evidence that the instrument predicts treatment conditional on the included covariates, not evidence for exclusion or conditional independence. (3) No. Under the usual binary-instrument assumptions, the effect is generally for compliers, whose treatment is changed by the instrument; it need not equal the population average effect. (4) The instrument might directly change the outcome through a pathway other than treatment. Baseline adjustment cannot, by itself, eliminate such a direct effect.

Clinical Biostats