All lab tutorials

Causal inference

Standardize two risks to one population

What would the risk difference be if everyone followed treatment versus control?

Population and data

Consider the same eligible people at baseline under two hypothetical strategies. The target is their average one-period risk under treatment minus their average risk under control. Fixing that population before comparing strategies determines which severity distribution to use.

Among treated people, 2 of 20 mild cases and 24 of 80 severe cases have an event. Among controls, the counts are 16 of 80 and 8 of 20. The combined population is half mild and half severe.

Working data
SeverityTreated events / totalControl events / totalTarget share
L = 02 / 2016 / 800.50
L = 124 / 808 / 200.50

Notation

A,L,YA,L,Y
Binary treatment, baseline severity, and binary outcome at the specified horizon.
YaY^a
Potential outcome if assigned strategy a.
Ra,R^aR_a,\hat R_a
Population risk under a and its sample-based standardized estimate.
P(L=l)P(L=l)
Proportion in severity stratum l in the target population.

Derivation

Ra=E[Ya],Δ=R1−R0,R^a=∑lnlndalnalR_a=E[Y^a],\quad \Delta=R_1-R_0,\quad \hat R_a=\sum_l\frac{n_l}{n}\frac{d_{al}}{n_{al}}

Here n is the total sample size, nₗ the stratum size, nₐₗ the arm-by-stratum count, and dₐₗ its event count. This plug-in estimate uses the combined sample as the target distribution. Identification requires consistency, conditional mean exchangeability within each severity stratum, and positive probability of each treatment in every target stratum. [1]

First average potential outcomes within severity. Conditional exchangeability allows the mean potential outcome in each stratum to be learned from the people who actually followed the corresponding treatment. Consistency connects their observed outcomes to that strategy. Positivity makes each required comparison observable.

E[Ya]=∑lE[Ya∣L=l]P(L=l)=∑lE[Ya∣A=a,L=l]P(L=l)E[Y^a]=\sum_l E[Y^a\mid L=l]P(L=l)=\sum_l E[Y^a\mid A=a,L=l]P(L=l)

The last averaging weights come from all eligible people. The crude comparison instead uses 80% severe among treated people and 20% severe among controls. Severity raises risk in both arms, so this difference in composition can reverse the overall contrast. [1]

Average each treatment-specific risk over the same baseline severity distribution. Here L is severity, A treatment, and Y the event indicator.

E[Ya]=∑lE[Y∣A=a,L=l]P(L=l)E[Y^a]=\sum_l E[Y\mid A=a,L=l]P(L=l)

Insert the empirical risks. The target population supplies the two weights of one half.

R^1=(0.10+0.30)/2=0.20,R^0=(0.20+0.40)/2=0.30\hat R_1=(0.10+0.30)/2=0.20,\quad \hat R_0=(0.20+0.40)/2=0.30

R analysis

Download the complete R script
treated <- c(2/20, 24/80)
control <- c(16/80, 8/20)
target <- c(.5, .5)
c(crude = 26/100 - 24/100,
  standardized = sum(target * (treated - control)))

R output

       crude standardized 
        0.02        -0.10 

The crude comparison puts treated risk 2 points higher. With the same severity mix, treated risk is 10 points lower. A causal interpretation requires consistency, exchangeability given baseline severity for the target contrast, and adequate treatment overlap. The data alone cannot establish these assumptions.

When does changing the target population change the effect?

Keep the four sample sizes fixed. In a second hypothetical dataset reduce severe treated events from 24 to 8. Compare the two risk differences across three target populations.

severe_share <- c(.25, .50, .75)
standardize <- function(severe_treated_risk) {
  (1-severe_share) * (2/20 - 16/80) +
    severe_share * (severe_treated_risk - 8/20)
}
data.frame(severe_share, original = standardize(24/80),
           modified = standardize(8/80))

R output

  severe_share original modified
1         0.25     -0.1    -0.15
2         0.50     -0.1    -0.20
3         0.75     -0.1    -0.25

Originally, the within-stratum difference is −10 points in both strata, so reweighting has no effect on the difference. In the modified data the severe-stratum difference is −30 points. Raising the severe share from 25% to 75% moves the standardized difference from −15 to −25 points. [1][2]

Try a variation

Would a target with 75% severe cases change the risk difference?

Reveal the explanation

The risks become 25% and 35%. Their difference stays at −10 points because both strata have the same risk difference here.

References

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

  1. Hernán MA, Robins JM. Causal Inference: What If. Chapman & Hall/CRC, 2020. Chapters 2, 3 and 13.

    Standardization, identification conditions in observational studies, and averaging over a target population.

  2. Snowden JM, Rose S, Mortimer KM. Implementation of G-computation on a simulated data set: demonstration of a causal inference technique. American Journal of Epidemiology. 2011;173:731–738.

    A worked extension from averaging stratum-specific risks to model-based g-computation.