Math for Causal Inference

Day 12. The Delta Method

Standard errors for functions of estimates (logs, ratios, odds, percentage effects) via a first-order Taylor expansion.

Video coming soon
Learning outcomes
  • ●Apply the univariate delta method to logs, square roots, inverses and odds.
  • ●Derive it from a Taylor expansion plus the CLT, and know when it fails.
  • ●Use the multivariate delta method for ratios (cost-effectiveness, relative effects, Wald IV estimates).
  • ●Convert log-point regression coefficients into percentage effects with correct standard errors.
2-HOUR SESSION PLAN
Theory 25′Warm-up (1–5) 20′Proofs (6–10) 35′Applied (11–15) 25′Python & Lab 15′
Colab notebook (.ipynb) Jump to the simulator

Theory

The idea

You have an estimate θ^\hat\theta with n(θ^−θ)→dN(0,σ2)\sqrt n(\hat\theta - \theta) \xrightarrow{d} N(0, \sigma^2), but you care about g(θ)g(\theta): a percentage effect, an elasticity, a ratio. A first-order Taylor expansion around θ\theta gives

g(θ^)≈g(θ)+g′(θ)(θ^−θ),g(\hat\theta) \approx g(\theta) + g'(\theta)(\hat\theta - \theta),

so g(θ^)g(\hat\theta) is approximately a linear function of an approximately normal variable:

n(g(θ^)−g(θ))→dN(0,  g′(θ)2σ2),SE⁡(g(θ^))≈∣g′(θ^)∣ SE⁡(θ^).\sqrt n\big(g(\hat\theta) - g(\theta)\big) \xrightarrow{d} N\big(0,\; g'(\theta)^2\sigma^2\big), \qquad \operatorname{SE}\big(g(\hat\theta)\big) \approx |g'(\hat\theta)|\,\operatorname{SE}(\hat\theta).

Several estimates at once

For a vector θ^\hat\theta with covariance matrix Σ\Sigma and a scalar function gg with gradient ∇g\nabla g:

Var⁡(g(θ^))≈∇g(θ)⊤ Σ ∇g(θ).\operatorname{Var}\big(g(\hat\theta)\big) \approx \nabla g(\theta)^{\top}\,\Sigma\,\nabla g(\theta).

For a ratio R=A/BR = A/B:

Var⁡(R^)≈Var⁡(A^)B2+A2Var⁡(B^)B4−2ACov⁡(A^,B^)B3.\operatorname{Var}(\hat R) \approx \frac{\operatorname{Var}(\hat A)}{B^2} + \frac{A^2\operatorname{Var}(\hat B)}{B^4} - \frac{2A\operatorname{Cov}(\hat A, \hat B)}{B^3}.

Limits

  • It is a local linear approximation: poor when gg is very curved relative to the SE, or when θ^\hat\theta is near a point where gg blows up (a ratio with denominator near zero, e.g. a weak first stage).
  • If g′(θ)=0g'(\theta) = 0 the first-order term vanishes and a second-order expansion is needed.
  • The bootstrap (Day 9) is the usual cross-check.

Part 1 · Warm-up

Exercise 1 · Derivative of the log

What is g′(x)g'(x) for g(x)=ln⁡xg(x) = \ln x, and what does it imply for SE⁡(ln⁡θ^)\operatorname{SE}(\ln\hat\theta)?

Show solution

g′(x)=1/xg'(x) = 1/x, so SE⁡(ln⁡θ^)≈SE⁡(θ^)/θ^\operatorname{SE}(\ln\hat\theta) \approx \operatorname{SE}(\hat\theta)/\hat\theta: the coefficient of variation.

Exercise 2 · Log of a mean

Xˉ=50\bar X = 50 with SE 2. Find the SE of ln⁡Xˉ\ln\bar X.

Show solution

2/50=0.042/50 = 0.04.

Exercise 3 · Square root

θ^=16\hat\theta = 16 with SE 0.8. Find the SE of θ^\sqrt{\hat\theta}.

Show solution

g′(x)=1/(2x)=1/8g'(x) = 1/(2\sqrt x) = 1/8, so SE ≈0.8/8=0.1\approx 0.8/8 = 0.1.

Exercise 4 · Inverse

θ^=4\hat\theta = 4 with SE 0.2. Find the SE of 1/θ^1/\hat\theta.

Show solution

∣g′(x)∣=1/x2=1/16|g'(x)| = 1/x^2 = 1/16, so SE ≈0.2/16=0.0125\approx 0.2/16 = 0.0125.

Exercise 5 · Odds

p^=0.6\hat p = 0.6 with SE 0.0894 (Day 11). Find the SE of the odds p^/(1−p^)\hat p/(1 - \hat p).

Show solution

g′(p)=1/(1−p)2=1/0.16=6.25g'(p) = 1/(1 - p)^2 = 1/0.16 = 6.25, so SE ≈6.25×0.0894≈0.559\approx 6.25 \times 0.0894 \approx 0.559 around the odds estimate 1.5.

Part 2 · Proofs

Exercise 6 · Deriving the delta method

Using a Taylor expansion with remainder and the CLT, derive the univariate delta method.

Show solution

Step 1 (mean value theorem). For some θ~\tilde\theta between θ^\hat\theta and θ\theta:

g(θ^)=g(θ)+g′(θ~)(θ^−θ).g(\hat\theta) = g(\theta) + g'(\tilde\theta)(\hat\theta - \theta).

Step 2. Rearrange and multiply by n\sqrt n:

n(g(θ^)−g(θ))=g′(θ~)⋅n(θ^−θ).\sqrt n\big(g(\hat\theta) - g(\theta)\big) = g'(\tilde\theta)\cdot\sqrt n(\hat\theta - \theta).

Step 3. θ^→pθ\hat\theta \xrightarrow{p} \theta and θ~\tilde\theta is squeezed between them, so θ~→pθ\tilde\theta \xrightarrow{p} \theta. With g′g' continuous, g′(θ~)→pg′(θ)g'(\tilde\theta) \xrightarrow{p} g'(\theta).

Step 4. By assumption (the CLT), n(θ^−θ)→dN(0,σ2)\sqrt n(\hat\theta - \theta) \xrightarrow{d} N(0, \sigma^2).

Step 5. Slutsky's theorem (a term converging to a constant times a term converging in distribution):

n(g(θ^)−g(θ))→dg′(θ) N(0,σ2)=N(0,  g′(θ)2σ2).■\sqrt n\big(g(\hat\theta) - g(\theta)\big) \xrightarrow{d} g'(\theta)\,N(0, \sigma^2) = N\big(0,\; g'(\theta)^2\sigma^2\big). \qquad\blacksquare

Exercise 7 · The ratio formula

Derive the variance of A^/B^\hat A/\hat B from the multivariate delta method.

Show solution

g(A,B)=A/Bg(A, B) = A/B has gradient ∇g=(1/B,  −A/B2)\nabla g = (1/B,\; -A/B^2). Then

∇g⊤Σ∇g=Var⁡(A^)B2+A2B4Var⁡(B^)−2AB3Cov⁡(A^,B^).\nabla g^{\top}\Sigma\nabla g = \frac{\operatorname{Var}(\hat A)}{B^2} + \frac{A^2}{B^4}\operatorname{Var}(\hat B) - \frac{2A}{B^3}\operatorname{Cov}(\hat A, \hat B).

Exercise 8 · Second-order bias

Using a second-order expansion, show E[g(Xˉ)]≈g(μ)+12g′′(μ)σ2/nE[g(\bar X)] \approx g(\mu) + \tfrac12 g''(\mu)\sigma^2/n, and apply it to ln⁡Xˉ\ln\bar X.

Show solution

Step 1. g(Xˉ)≈g(μ)+g′(μ)(Xˉ−μ)+12g′′(μ)(Xˉ−μ)2g(\bar X) \approx g(\mu) + g'(\mu)(\bar X - \mu) + \tfrac12 g''(\mu)(\bar X - \mu)^2.

Step 2. Take expectations: the linear term has mean zero and E[(Xˉ−μ)2]=σ2/nE[(\bar X - \mu)^2] = \sigma^2/n.

Step 3. For ln⁡\ln: g′′=−1/μ2g'' = -1/\mu^2, so E[ln⁡Xˉ]≈ln⁡μ−σ2/(2nμ2)E[\ln\bar X] \approx \ln\mu - \sigma^2/(2n\mu^2).

Step 4. The log of a mean is biased downward, as Jensen's inequality predicts, but the bias vanishes at rate 1/n1/n.

Exercise 9 · When the first derivative is zero

Let Xˉ\bar X be a mean with μ=0\mu = 0 and variance σ2/n\sigma^2/n, and g(x)=x2g(x) = x^2. Why does the delta method fail, and what is the limit of nXˉ2/σ2n\bar X^2/\sigma^2?

Show solution

Step 1. g′(0)=0g'(0) = 0, so the first-order approximation predicts zero variance, which is wrong.

Step 2. Instead, nXˉ/σ→dN(0,1)\sqrt n\bar X/\sigma \xrightarrow{d} N(0, 1), so nXˉ2/σ2→dχ12n\bar X^2/\sigma^2 \xrightarrow{d} \chi^2_1.

Step 3. The estimator converges at rate nn, not n\sqrt n, and its distribution is not normal.

Exercise 10 · Log-odds

Derive the SE of the log-odds ln⁡(p^/(1−p^))\ln(\hat p/(1 - \hat p)) and evaluate it at p^=0.6\hat p = 0.6, n=30n = 30.

Show solution

g′(p)=1/p+1/(1−p)=1/(p(1−p))g'(p) = 1/p + 1/(1 - p) = 1/(p(1 - p)). With SE⁡(p^)=p(1−p)/n\operatorname{SE}(\hat p) = \sqrt{p(1 - p)/n}:

SE⁡=1n p(1−p)=130×0.24≈0.373.\operatorname{SE} = \frac{1}{\sqrt{n\,p(1 - p)}} = \frac{1}{\sqrt{30 \times 0.24}} \approx 0.373.

Part 3 · Applied

Exercise 11 · From log points to percent

In a log-wage regression, a training dummy has β^=0.08\hat\beta = 0.08 (SE 0.02). Report the exact percentage effect 100(eβ−1)100(e^{\beta} - 1) with its SE.

Show solution

Step 1. Exact percentage effect: g(β)=100(eβ−1)=100(e0.08−1)≈8.33%g(\beta) = 100(e^{\beta} - 1) = 100(e^{0.08} - 1) \approx 8.33\%.

Step 2. Derivative: g′(β)=100eβ=108.33g'(\beta) = 100e^{\beta} = 108.33.

Step 3. Delta method: SE⁡≈108.33×0.02≈2.17\operatorname{SE} \approx 108.33 \times 0.02 \approx 2.17 percentage points.

Answer: training raises wages by 8.3% (SE 2.2 points).

Exercise 12 · Cost-effectiveness ratio

A programme costs an extra ΔC=1,200\Delta C = 1{,}200 (SE 300) and adds ΔE=0.4\Delta E = 0.4 QALYs (SE 0.1), estimated independently. Find the ICER and its SE.

Show solution

Step 1. Point estimate: ICER=1200/0.4=3,000\text{ICER} = 1200/0.4 = 3{,}000 per QALY.

Step 2. Ratio formula with zero covariance, A=1200A = 1200, B=0.4B = 0.4:

Var⁡≈Var⁡(A^)B2+A2Var⁡(B^)B4.\operatorname{Var} \approx \frac{\operatorname{Var}(\hat A)}{B^2} + \frac{A^2\operatorname{Var}(\hat B)}{B^4}.

Step 3. First term: 3002/0.42=90,000/0.16=562,500300^2/0.4^2 = 90{,}000/0.16 = 562{,}500.

Step 4. Second term: 12002×0.12/0.44=1,440,000×0.01/0.0256=562,5001200^2 \times 0.1^2/0.4^4 = 1{,}440{,}000 \times 0.01/0.0256 = 562{,}500.

Step 5. Total 1,125,0001{,}125{,}000, so SE⁡≈1,061\operatorname{SE} \approx 1{,}061.

Answer: $3,000 per QALY (SE ≈ $1,061). The imprecise denominator contributes half the variance; a bootstrap interval would be visibly skewed.

Exercise 13 · A relative treatment effect

The effect is τ^=5\hat\tau = 5 (SE 1) and the control mean is μ^0=50\hat\mu_0 = 50 (SE 2), independent. Find the relative effect τ^/μ^0\hat\tau/\hat\mu_0 and its SE.

Show solution

Step 1. Point estimate: R=5/50=0.10R = 5/50 = 0.10.

Step 2. Ratio formula with A=5A = 5, B=50B = 50, independent estimates:

Var⁡≈12502+52×22504=0.0004+0.000016=0.000416.\operatorname{Var} \approx \frac{1^2}{50^2} + \frac{5^2 \times 2^2}{50^4} = 0.0004 + 0.000016 = 0.000416.

Step 3. SE⁡=0.000416≈0.0204\operatorname{SE} = \sqrt{0.000416} \approx 0.0204.

Answer: a 10% relative effect, ± about 2 points. Almost all the uncertainty comes from τ^\hat\tau.

Exercise 14 · The Wald (IV) estimator

An encouragement design has reduced form 0.6 (SE 0.2) and first stage 0.3 (SE 0.05), independent. Find the IV estimate and its SE.

Show solution

Step 1. Point estimate: β^=0.6/0.3=2\hat\beta = 0.6/0.3 = 2.

Step 2. Ratio formula with A=0.6A = 0.6 (reduced form), B=0.3B = 0.3 (first stage):

0.220.32=0.040.09≈0.444,0.62×0.0520.34=0.36×0.00250.0081≈0.111.\frac{0.2^2}{0.3^2} = \frac{0.04}{0.09} \approx 0.444, \qquad \frac{0.6^2 \times 0.05^2}{0.3^4} = \frac{0.36 \times 0.0025}{0.0081} \approx 0.111.

Step 3. Var⁡≈0.556\operatorname{Var} \approx 0.556, SE⁡≈0.745\operatorname{SE} \approx 0.745.

Answer: IV estimate 2 (SE ≈ 0.75). With a weak first stage (denominator near zero) this approximation breaks down: the weak-instruments problem of Phase 5.

Exercise 15 · Log of mean income: delta method versus simulation

A survey estimates mean household income (in $10,000) as Xˉ\bar X with SE 2. Analysts report ln⁡Xˉ\ln\bar X. Compare the delta-method SE of ln⁡Xˉ\ln\bar X with a simulation when the true mean is 50 (a rich region) and when it is 5 (a poor region). When does the delta method fail?

Show solution

Step 1. Delta method: SE⁡(ln⁡Xˉ)≈SE⁡/μ\operatorname{SE}(\ln\bar X) \approx \operatorname{SE}/\mu.

Step 2. Rich region: 2/50=0.042/50 = 0.04. Poor region: 2/5=0.402/5 = 0.40.

Step 3. Simulation (code below): about 0.040 in the rich region, but about 0.52 in the poor region.

Step 4. Reason: when SE⁡/μ\operatorname{SE}/\mu is large, Xˉ\bar X ranges over values where ln⁡\ln is strongly curved, so the linear approximation is poor and ln⁡Xˉ\ln\bar X is skewed.

Answer: the delta method is excellent when the coefficient of variation is small (0.04) and misleading when it is large (0.4); check with the bootstrap or simulation.

Verify in Python

import numpy as np

rng = np.random.default_rng(12)
for mu, se in ((50, 2), (5, 2)):
    xbar = rng.normal(mu, se, 1_000_000)
    xbar = xbar[xbar > 0]
    print(f"mu={mu}, SE={se}: delta SE of ln = {se/mu:.4f}, simulated = {np.log(xbar).std():.4f}")

# ICER (Exercise 12): delta method vs simulation
dC = rng.normal(1200, 300, 1_000_000); dE = rng.normal(0.4, 0.1, 1_000_000)
icer = dC / dE
q25, q50, q75 = np.percentile(icer, [25, 50, 75])
print("ICER delta SE ~ 1061; simulated robust SD (IQR/1.349):", round((q75 - q25) / 1.349),
      "; simulated 2.5/50/97.5 percentiles:", np.percentile(icer, [2.5, 50, 97.5]).round())
# (the plain SD is unstable: a few draws of dE near zero make the ratio explode)

print("percent effect:", round(100 * (np.exp(0.08) - 1), 2), "SE", round(100 * np.exp(0.08) * 0.02, 2))

Key takeaways

  • SE⁡(g(θ^))≈∣g′(θ^)∣SE⁡(θ^)\operatorname{SE}(g(\hat\theta)) \approx |g'(\hat\theta)|\operatorname{SE}(\hat\theta); for several estimates use the gradient and the covariance matrix.
  • Ratios with noisy denominators (ICERs, IV with a weak first stage) are where the approximation is weakest.
  • Check the delta method against the bootstrap when the transformation is strongly non-linear.

Simulation Lab: Delta Method vs Simulation

Open full screen →

Push a normal estimate through ln, √, 1/x or x² and compare the delta-method normal with the truth.

0120.811.21.41.61.82g(x̄)density
simulated g(x̄)delta-method approximation
Delta-method SE
0.2000
|g′(μ)| × SE
Simulated SD
0.2108
g(μ)
1.6094
Mean of g(x̄)
1.5912
gap = second-order bias

The estimate x̄ ~ N(μ, SE²) is pushed through g. Bars: the true distribution of g(x̄). Orange: the delta-method normal N(g(μ), (g′(μ)·SE)²). They agree when SE is small relative to the curvature of g.

Day 11Day 13