Tutorials › Marginal Structural Models › Marginal Risk Differences and Risk Ratios

The Parametric g-Formula · Tutorial 310 of 501

Marginal Risk Differences and Risk Ratios

Derive absolute and relative risk contrasts from regime-specific simulated risks, then interpret and quantify their uncertainty in a longitudinal example.

Advanced 11 min read

What You'll Learn

  • Define marginal risk differences and risk ratios at a fixed follow-up time
  • Derive contrasts from regime-specific risks by averaging over longitudinal histories
  • Interpret absolute and relative effects without confusing their scales
  • Calculate uncertainty while accounting for covariance between risk estimates
  • Recognize when the log-risk-ratio delta method is not applicable

From Regime-Specific Risks to Contrasts

A simulated risk under a treatment regime is an absolute quantity: it describes the probability of the outcome by a specified follow-up time if the population followed that regime. Comparing two such risks produces familiar measures of effect. The risk difference expresses an absolute change in probability; the risk ratio expresses a multiplicative change. Both are marginal contrasts because each risk averages over the target population’s baseline characteristics and the covariate histories that arise under the regime.

Let \(Y_K\) indicate whether the event has occurred by fixed follow-up time \(K\), and let \(g_1\) and \(g_0\) denote two specified treatment regimes. Write \(\psi_j=P(Y_K^{g_j}=1)\) for the regime-specific risk under \(g_j\), for \(j=0,1\). In practice, the parametric g-formula estimates these risks by fitting models for covariate evolution and the outcome, then averaging predicted outcomes over simulated histories and the target baseline distribution.

Definition: The marginal risk difference comparing \(g_1\) with \(g_0\) at time \(K\) is \(\Delta=\psi_1-\psi_0\). The marginal risk ratio is \(R=\psi_1/\psi_0\), defined when \(\psi_0>0\). A positive \(\Delta\) means higher risk under \(g_1\); a ratio above 1 means risk is higher under \(g_1\). Both contrasts depend on the stated follow-up time, target population, outcome, and ordering of the regimes.

These are contrasts of risks, not contrasts of conditional outcome-model coefficients. In particular, a coefficient in a logistic model is generally a conditional log odds ratio; it is not the marginal risk difference or risk ratio. The g-formula obtains the marginal risks first, then forms the contrast.

Deriving the Risks from Longitudinal Histories

Suppose \(L_0\) is baseline covariate information and \(L_1\) is a covariate measured later in follow-up. Under a regime \(g\), the law of total probability gives the endpoint risk by averaging the outcome probability over the baseline and the covariate distribution generated under that regime:

$$ \psi_g = \sum_{l_0}\sum_{l_1} P(Y_K=1\mid L_0=l_0,L_1=l_1,\text{ regime }g) P(L_1=l_1\mid L_0=l_0,\text{ regime }g) P(L_0=l_0). $$

For continuous covariates, the corresponding sums are integrals. This expression makes the marginal nature of the estimand explicit: the distribution of \(L_1\) can differ between regimes, and the outcome risk is averaged over each regime’s own covariate histories. The regime-specific risk estimates \(\hat\psi_1\) and \(\hat\psi_0\) then give the plug-in contrasts \(\hat\Delta=\hat\psi_1-\hat\psi_0\) and \(\hat R=\hat\psi_1/\hat\psi_0\), when the denominator is positive.

Identification conditions: A causal interpretation requires consistency between observed outcomes and outcomes under the received regime; sequential exchangeability, meaning no unmeasured confounding of each treatment decision given the measured past; and positivity for the treatment choices required by the regimes among histories that occur. The parametric g-formula also relies on adequate specification of the covariate-transition and outcome models, and on appropriate averaging over the target baseline population. These conditions support interpretation of \(\psi_g\) as a counterfactual risk; they do not guarantee that fitted models estimate it accurately.

Worked Example: A Risk Difference and Risk Ratio

Suppose the estimated risks by 2 years are \(\hat\psi_1=0.24\) under a sustained treatment regime and \(\hat\psi_0=0.16\) under a comparator regime. The estimated risk difference is

$$ \hat\Delta=0.24-0.16=0.08. $$

This is an estimated increase of 0.08 in risk, or 8 percentage points, under \(g_1\) compared with \(g_0\). The estimated risk ratio is

$$ \hat R=\frac{0.24}{0.16}=1.5. $$

Thus the estimated risk under \(g_1\) is 1.5 times the risk under \(g_0\), or 50% higher on the relative scale. The two statements describe the same pair of estimated risks using different scales. Neither says that every individual’s risk rises by 8 percentage points or by 50%.

Worked Longitudinal Example

Consider a target population in which \(P(L_0=1)=0.4\) and \(P(L_0=0)=0.6\). A parametric g-computation analysis simulates \(L_1\) under two static treatment regimes, \(g_1\) and \(g_0\), and predicts the probability of the event by time \(K\) for each history. The following probabilities are stipulated outputs of the fitted transition and outcome models:

Baseline \(L_0\)\(P(L_1=1\mid L_0,g_1)\)Event risk at \(L_1=0\), \(g_1\)Event risk at \(L_1=1\), \(g_1\)\(P(L_1=1\mid L_0,g_0)\)Event risk at \(L_1=0\), \(g_0\)Event risk at \(L_1=1\), \(g_0\)
00.300.080.200.200.040.12
10.700.180.350.600.100.25

For \(g_1\), when \(L_0=0\), the probability of \(L_1=0\) is \(1-0.30=0.70\). The conditional event risk averaged over \(L_1\) is therefore \(0.70(0.08)+0.30(0.20)=0.056+0.060=0.116\). When \(L_0=1\), that risk is \(0.30(0.18)+0.70(0.35)=0.054+0.245=0.299\). Averaging over baseline \(L_0\) gives

$$ \hat\psi_1=0.60(0.116)+0.40(0.299)=0.0696+0.1196=0.1892. $$

For \(g_0\), when \(L_0=0\), the average is \(0.80(0.04)+0.20(0.12)=0.032+0.024=0.056\). When \(L_0=1\), it is \(0.40(0.10)+0.60(0.25)=0.040+0.150=0.190\). Thus

$$ \hat\psi_0=0.60(0.056)+0.40(0.190)=0.0336+0.0760=0.1096. $$

The resulting contrasts are

$$ \hat\Delta=0.1892-0.1096=0.0796, \qquad \hat R=\frac{0.1892}{0.1096}\approx1.7263. $$

By time \(K\), the estimated risk is 7.96 percentage points higher under \(g_1\), and approximately 1.73 times the risk under \(g_0\). The calculations explicitly average over the regime-specific distribution of \(L_1\); using one common distribution for \(L_1\) would generally estimate different quantities.

Uncertainty for the Contrasts

The two risk estimates are usually dependent: they may be computed from the same fitted models and the same observed sample. If their estimated variances and covariance are available, the variance of their difference follows directly from the variance of a linear combination.

Result: If \(\hat\psi_1\) and \(\hat\psi_0\) have finite variances, then \[ \operatorname{Var}(\hat\Delta) = \operatorname{Var}(\hat\psi_1)+\operatorname{Var}(\hat\psi_0) -2\operatorname{Cov}(\hat\psi_1,\hat\psi_0). \] For estimated standard errors, replace the variances and covariance by consistent estimates.

To verify the result, write \(U=\hat\psi_1\) and \(V=\hat\psi_0\). Since \(E[U-V]=E[U]-E[V]\),

$$ \begin{aligned} \operatorname{Var}(U-V) &=E\left[\{(U-E[U])-(V-E[V])\}^2\right]\\ &=\operatorname{Var}(U)+\operatorname{Var}(V) -2E[(U-E[U])(V-E[V])]\\ &=\operatorname{Var}(U)+\operatorname{Var}(V)-2\operatorname{Cov}(U,V). \end{aligned} $$

The covariance term is not optional. Omitting it treats the risk estimates as independent, which they often are not and can either overstate or understate uncertainty.

For a risk ratio, inference is often carried out on the log scale. Suppose the vector of risk estimates is jointly asymptotically normal, with covariance matrix consistently estimated, and the true risks satisfy \(\psi_1>0\) and \(\psi_0>0\). The function \(h(x,y)=\log(x/y)\) is differentiable in a neighbourhood of \((\psi_1,\psi_0)\), with gradient \((1/\psi_1,-1/\psi_0)\). The multivariate delta method therefore gives the following approximate variance:

Result: Under joint asymptotic normality and strictly positive true risks \(\psi_1,\psi_0\), \[ \widehat{\operatorname{Var}}\{\log(\hat R)\} \approx \frac{\widehat{\operatorname{Var}}(\hat\psi_1)}{\hat\psi_1^2} + \frac{\widehat{\operatorname{Var}}(\hat\psi_0)}{\hat\psi_0^2} - \frac{2\widehat{\operatorname{Cov}}(\hat\psi_1,\hat\psi_0)} {\hat\psi_1\hat\psi_0}, \] provided both estimated risks are positive. A log-scale interval can be exponentiated to obtain an interval for \(R\).

For justification, the delta method approximates the variance of \(h(\hat\psi_1,\hat\psi_0)\) by the gradient at the true risks multiplied on both sides of the covariance matrix. Expanding that quadratic form yields the two variance terms and the covariance term displayed above. Replacing the unknown risks and covariance matrix with consistent estimates gives the plug-in formula. Strict positivity of both true risks is necessary for differentiability of the log-ratio function at the parameter value, and positivity of both estimated risks is necessary for the displayed plug-in expression to be defined. \(\square\)

For the longitudinal example, suppose the estimated sampling variances are \(0.000400\) and \(0.000225\), and the estimated covariance is \(0.000120\). These are supplied here as sampling-uncertainty quantities; they are not Monte Carlo simulation variances. For the difference,

$$ \widehat{\operatorname{Var}}(\hat\Delta) =0.000400+0.000225-2(0.000120)=0.000385, \qquad \widehat{\operatorname{SE}}(\hat\Delta)=\sqrt{0.000385}\approx0.01962. $$

A normal-approximation 95% interval for the risk difference is \(0.0796\pm1.96(0.01962)\), or approximately \((0.0411,0.1181)\). For the log risk ratio, the three terms are approximately \(0.000400/(0.1892)^2=0.01117\), \(0.000225/(0.1096)^2=0.01873\), and \(2(0.000120)/(0.1892\cdot0.1096)=0.01157\). Hence the estimated log-ratio variance is \(0.01117+0.01873-0.01157=0.01833\), with standard error \(\sqrt{0.01833}\approx0.1354\). Since \(\log(1.7263)\approx0.546\), the log-scale 95% interval is \(0.546\pm1.96(0.1354)=(0.281,0.811)\). Exponentiating its endpoints gives an approximate risk-ratio interval of \((1.32,2.25)\).

These calculations concern sampling uncertainty in estimated risks. A finite number of simulated histories can add Monte Carlo error; increasing the simulation size reduces that component but does not remove sampling uncertainty or model misspecification. The uncertainty calculation must match the source of uncertainty being reported.

Scale, Diagnostics, and Limitations

The risk difference is often useful for communicating absolute impact and planning services; the risk ratio summarizes relative change. Their numerical values need not suggest the same practical importance. A 50% relative increase from a risk of 2% is an increase of 1 percentage point, while the same relative increase from 40% is 20 percentage points. Report the risks as well as the contrast, identify the comparator and follow-up time, and state the target population.

A common error is to calculate uncertainty for the ratio while assuming the two risk estimates are independent. The correction is to use their joint covariance, as in the delta-method formula. Another important boundary case occurs when \(\psi_1=0\) and \(\psi_0>0\): the risk ratio itself is defined as zero, but its logarithm is not, and the log-ratio function is not differentiable at that parameter value. The log-scale delta-method interval is not justified there. If \(\psi_0=0\), the ratio is undefined. Very small positive risks can also make ratio estimates unstable and normal approximations poor.

Useful checks include verifying that each estimated risk lies between 0 and 1, confirming the contrast’s direction matches the stated regime ordering, and checking that the covariance matrix is plausible (in particular, its implied variances cannot be negative). Compare each risk with the simulated history distributions and inspect whether a small number of histories or baseline strata dominate the estimate. These checks can reveal coding or numerical problems, but they cannot establish correct model specification or the causal identification assumptions.

The main alternative is to report each regime-specific risk without reducing them to a single contrast. This preserves absolute levels but makes direct comparison less concise. Odds ratios are another familiar measure, but they are not risk ratios and can differ substantially from them when risks are not small. No scale is universally best: the choice should follow the scientific question, and reporting both a difference and a ratio can clarify absolute and relative impact. Neither choice repairs violations of exchangeability, positivity, consistency, or model adequacy.

Worked Example: A Boundary Case for Log-Ratio Inference

Suppose an analysis estimates \(\hat\psi_1=0\) and \(\hat\psi_0=0.10\). The plug-in risk ratio is \(0/0.10=0\), but \(\log(\hat R)=\log(0)\) is undefined. Moreover, if the true value is \(\psi_1=0\), the function \(\log(\psi_1/\psi_0)\) has no finite derivative there. Therefore the log-scale delta-method variance formula cannot be used for this case, even though the comparator risk is positive.

The risk difference remains defined: \(\hat\Delta=0-0.10=-0.10\). This does not mean its own uncertainty is automatically well approximated by a normal distribution; risk estimates at a boundary can have non-normal sampling behaviour. The correct response is to avoid reporting a log-ratio interval as if its regularity conditions held and to choose an inference method appropriate to the boundary problem.

Check Your Understanding

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

  1. Regime risks are 0.12 under \(g_1\) and 0.20 under \(g_0\). Calculate and interpret the risk difference and risk ratio.
  2. Why is the covariance between two risk estimates included when calculating the variance of their difference?
  3. In what boundary case is the risk ratio defined but the log-risk-ratio delta method not justified?
  4. If both regime risks are multiplied by the same positive constant and remain valid risks, what happens to their risk ratio? What happens to their risk difference?

Solutions. (1) \(\Delta=0.12-0.20=-0.08\), an 8-percentage-point lower risk under \(g_1\); \(R=0.12/0.20=0.60\), or 40% lower risk relative to \(g_0\). (2) The estimates can be dependent, and expanding \(\operatorname{Var}(\hat\psi_1-\hat\psi_0)\) gives the term \(-2\operatorname{Cov}(\hat\psi_1,\hat\psi_0)\); omitting it is generally incorrect. (3) If \(\psi_1=0\) while \(\psi_0>0\), the ratio is zero but its logarithm is undefined and the log-ratio function is not differentiable there. (4) The ratio is unchanged because the common multiplier cancels; the difference is multiplied by that constant. This illustrates why absolute and relative measures answer distinct questions.

Clinical Biostats