All lab tutorials

Causal inference

Matching and weighting for the ATT

Can two designs balance severity while giving different people different influence?

Population and data

Ask what the treated people would have experienced under control. Their treated mean is observed. The missing piece is their mean untreated outcome. Both designs build a comparison group that represents their baseline severity mix.

Four treated outcomes are 12, 26, 26, 26. Only the first person has mild disease. Four control outcomes are 10, 10, 10, 20. Only the last control has severe disease. Target the average treatment effect among the treated (ATT).

Working data
ControlSeverity (0 mild, 1 severe)OutcomeMatch countATT weight
C10101⅓
C20100⅓
C30100⅓
C412033

Notation

Ai,Li,YiA_i,L_i,Y_i
Treatment, baseline severity, and observed response for person i.
Y1,Y0Y^1,Y^0
Potential responses under treatment and control.
el=P(A=1∣L=l)e_l=P(A=1\mid L=l)
Population treatment probability in severity stratum l.
kj,wjk_j,w_j
Control j’s match count and its odds weight, respectively.

Derivation

e^l=n1ln1l+n0l,e^l1−e^l=n1ln0l\hat e_l=\frac{n_{1l}}{n_{1l}+n_{0l}},\qquad \frac{\hat e_l}{1-\hat e_l}=\frac{n_{1l}}{n_{0l}}

The counts refer to treated and control people within stratum l. The hat labels an estimate of the propensity score. For the ATT, identifying the missing untreated mean needs consistency, comparability of mean untreated potential outcomes given severity, and available controls wherever treated people occur. Exact severity balance follows here from estimating separate odds in each stratum. [1][2]

For each severity stratum, divide its treated count by its control count. Multiplying this value by the number of controls gives exactly the treated count. That identity explains why the weighted controls reproduce the treated severity distribution in this example.

ATT=E[Y1−Y0∣A=1],n0ln1ln0l=n1l(n0l>0)\mathrm{ATT}=E[Y^1-Y^0\mid A=1],\qquad n_{0l}\frac{n_{1l}}{n_{0l}}=n_{1l}\quad(n_{0l}>0)

Exact matching places all of the low-severity contribution on C1 under the stated tie rule. Odds weighting spreads it across three controls. Both give C4 three units of weight because C4 is the sole severe control. These allocations determine how strongly an individual outcome can move the estimate. [1][2]

Match exactly on severity, with replacement and ties resolved by ID. The control weights count uses. For ATT weighting, use empirical treatment odds within each severity stratum.

k=(1,0,0,3),wl=n1ln0l,w=(1/3,1/3,1/3,3)k=(1,0,0,3),\quad w_l=\frac{n_{1l}}{n_{0l}},\quad w=(1/3,1/3,1/3,3)

Keep treated weights equal to one. Subtract the weighted control mean from the observed treated mean.

ATT^=Yˉ1−∑i:Ai=0wiYi∑i:Ai=0wi=22.5−17.5=5\widehat{\mathrm{ATT}}=\bar Y_1-\frac{\sum_{i:A_i=0}w_iY_i}{\sum_{i:A_i=0}w_i}=22.5-17.5=5

R analysis

Download the complete R script
treated <- c(12, 26, 26, 26)
control <- c(10, 10, 10, 20)
contrast <- function(w) mean(treated) - weighted.mean(control, w)
c(matched = contrast(c(1, 0, 0, 3)),
  weighted = contrast(c(1/3, 1/3, 1/3, 3)))

R output

 matched weighted 
       5        5 

Both estimates coincide because the mild controls have identical outcomes. Balance on severity alone does not force the estimates to coincide. A causal interpretation requires consistency, exchangeability given baseline severity for the target contrast, and adequate treatment overlap. The data alone cannot establish these assumptions.

Does exact balance imply the same effective sample size?

Audit both designs using the severe share, Kish effective sample size of the controls, and the ATT contrast after changing only C2’s outcome. Before running the code, predict how much a one-unit change in C4’s outcome would move the adjusted control mean.

audit <- function(w) {
  severe <- c(0, 0, 0, 1)
  altered <- c(10, 16, 10, 20)
  c(severe_share = weighted.mean(severe, w),
    effective_n = sum(w)^2 / sum(w^2),
    altered_ATT = mean(treated) - weighted.mean(altered, w))
}
round(rbind(match = audit(c(1, 0, 0, 3)),
            odds = audit(c(1/3, 1/3, 1/3, 3))), 3)

R output

      severe_share effective_n altered_ATT
match         0.75       1.600         5.0
odds          0.75       1.714         4.5

Both weighted control groups are 75% severe. The effective sizes are about 1.60 and 1.71, despite total control weight four in each design. For C2, the normalized weight changes from zero to 1/12, so a six-unit increase moves the ATT estimate down by one half under odds weighting. [2][3]

How much precision remains after adjustment?

Why look at the two groups separately?

To estimate the effect among the treated (ATT), we compare two means. The first is the mean outcome of the four treated people. Each keeps a weight of 1 and contributes one quarter of that mean. The second uses controls to estimate what those treated people would have experienced without treatment. That is why the weights change on the control side in this example.

GroupPeopleIndividual weightsESS
Treated41, 1, 1, 14
Controls after matching41, 0, 0, 31.60
Same controls under ATT weighting4⅓, ⅓, ⅓, 31.71

The last two rows show alternative analyses of the same four people. In a study of 1,000 people with 400 treated and 600 controls, compare the treated ESS with 400 and the control ESS with 600. If both groups receive unequal weights, as can happen when targeting the average effect in the whole population, both effective sizes can fall.

Imagine four independent controls with equal weights. Raise one person’s outcome by 1 and the mean rises by 0.25. Here, after either adjustment, C4 supplies three quarters of the control mean. Raise C4’s outcome by 1 and the mean rises by 0.75; the estimated ATT falls by 0.75. The entire 75% severe share on the control side comes from one person.

Kish’s effective sample size (ESS) expresses this dependence in units of precision. Hold the weights fixed and suppose independent control outcomes have a common variance σ². If control j carries a fraction aⱼ of the total weight, its contribution to the variance of the mean is aⱼ²σ². Add those contributions and ask how many equally weighted controls would give the same variance. [3]

aj=wj∑kwk,Var⁡ ⁣(∑jajYj)=σ2∑jaj2=σ2neffa_j=\frac{w_j}{\sum_k w_k},\qquad \operatorname{Var}\!\left(\sum_j a_jY_j\right)=\sigma^2\sum_j a_j^2=\frac{\sigma^2}{n_{\rm eff}}

After matching, the shares are ¼, 0, 0 and ¾. Their squares sum to 10/16, giving an ESS of 16/10 = 1.60. Under this benchmark, the variance of the control mean is 4/1.60 = 2.5 times that of four equally weighted controls. Odds weighting spreads the first quarter across three people, bringing ESS to 1.71, while C4 still carries ¾.

To judge the adjustment, check comparability and available information separately. Compare baseline covariate distributions after adjustment, then compare ESS with the original headcount in each arm. Here severity balances exactly, yet the severe stratum contains three treated people and just one control. A low ESS prompts you to locate such strata and check how sensitive the result is to influential observations. High ESS can coexist with poor balance: before adjustment the four equal-weight controls have ESS 4, yet only 25% are severe versus 75% of treated people. [1][2]

Explore effective sample size with 40 simulated weights

Interpreting ESS / N in practice

Use the original headcount of the arm being assessed as N. These landmarks for 1,000 controls illustrate a continuous trade-off. No cutoff certifies adequate adjustment.

ESSESS / NVariance multiplierIncrease in standard error
1000100%1.000%
85785.7%1.178%
70070%1.4320%
30030%3.3383%
10010%10.00216%

For a ratio r, the variance multiplier is 1/r and the standard-error multiplier is 1/√r under the benchmark above. At ESS 857, if important imbalances have been resolved and the effect interval is precise enough for the study question, the ratio alone gives little reason to change the weights. At ESS 300, investigate who supports the comparison before interpreting the estimate.

What to check when ESS falls

  1. Locate the loss. Report headcount, ESS, maximum weight and the share of total weight held by the top 1% within each arm. Inspect propensity-score distributions and the covariate profiles of highly weighted people. A sparse subgroup can explain the result. Low ESS alone cannot establish a positivity violation.
  2. Check what the weights achieved. Compare standardized differences and covariate distributions before and after weighting. Verify influential records and assess sensitivity of the contrast. Calculate a design-appropriate interval: ESS alone determines neither the effect’s uncertainty nor the study’s power.
  3. If the target must stay fixed, check coding, nonlinearities and interactions in the treatment model. Retain substantive confounders. A weak observed outcome association does not identify an instrument. Multiplying every weight in an arm by a constant, as in ordinary marginal stabilization for a single baseline treatment, leaves that arm’s ESS unchanged.
  4. Evaluate alternatives explicitly. Capping weights can worsen balance and introduce bias. Excluding people changes the population represented. Overlap weighting targets people for whom either treatment was plausible. The ATT targets treated people and can still rely heavily on a few controls. For each sensitivity analysis report the target, balance, arm-specific ESS, effect estimate and interval.

Desai & Franklin (2019), BMJ

Try a variation

Suppose the tie rule selects C2 instead of C1, and C2 has outcome 16. How does the matched estimate change?

Reveal the explanation

The matched control mean becomes (16 + 3 × 20) / 4 = 19. The matched contrast falls from 5 to 3.5 even though severity balance is identical. The odds-weighted contrast stays at 4.5 because it does not depend on the tie rule.

Explore the matching and weighting animation

References

The datasets and calculations are teaching examples created for this tutorial. The sources below explain the methods used.

  1. Stuart EA. Matching methods for causal inference: a review and a look forward. Statistical Science. 2010;25:1–21.

    Matching with replacement, the target population and balance diagnostics.

  2. Austin PC, Stuart EA. Moving towards best practice when using inverse probability of treatment weighting (IPTW) using the propensity score to estimate causal treatment effects in observational studies. Statistics in Medicine. 2015;34:3661–3679.

    ATT odds weights and the evaluation of weighted covariate balance.

  3. Kish L. Survey Sampling. Wiley, 1965. §11.7.

    The unequal-weight design effect underlying the control weight-concentration diagnostic.