Tutorials › Generalized Linear Models › Marginal Contrasts and Standardized Effects

Marginal Mean Models · Tutorial 826 of 981

Marginal Contrasts and Standardized Effects

Calculate response-scale contrasts by predicting under each exposure or treatment value and averaging over one explicitly defined target population.

Advanced 12 min read

What You'll Learn

  • Define a marginal contrast on the response scale for a specified target population
  • Calculate standardized means from fitted predictions and target-population weights
  • Distinguish a difference of standardized means from an average of profile-specific differences
  • Compute a standardized risk difference from logistic-model predictions
  • Explain when a mean difference is invariant to the target covariate distribution
  • Identify why changing the target population can change a standardized effect

From a Fitted Mean Model to a Marginal Contrast

A fitted marginal mean model describes the mean response at specified covariate values. Often the scientific question is not about one particular covariate profile, but about the difference between two exposure or treatment conditions for a defined population. To answer it, predict the mean response under each condition for each member, or covariate profile, in that target population, then combine those predictions using the population’s weights. The resulting contrast is standardized to that target.

The target population is part of the estimand, not a cosmetic detail. A contrast standardized to the covariate distribution of one study population need not equal the contrast standardized to another. The method below uses a finite set of target profiles, which covers an observed sample as well as a population summarized by a finite set of strata.

Definition: Let \(a\) denote an exposure or treatment value, and let \(z_1,\ldots,z_K\) be covariate profiles in a specified target population. Assign profile \(k\) a weight \(w_k\), where \(w_k\geq 0\) and \(\sum_{k=1}^K w_k=1\). Let \(\mu(a,z_k)\) be the fitted marginal mean response at exposure value \(a\) and profile \(z_k\). The standardized mean under \(a\) is \(\bar\mu(a)=\sum_{k=1}^K w_k\mu(a,z_k)\). For two values \(a_1\) and \(a_0\), the standardized mean difference is \(\bar\mu(a_1)-\bar\mu(a_0)\). If the means are positive, their standardized mean ratio is \(\bar\mu(a_1)/\bar\mu(a_0)\).

In a fitted generalized linear mean model, one obtains a prediction by evaluating its linear predictor at the chosen exposure and covariate values, then applying the inverse link. In symbols, if the fitted predictor is \(\hat\eta(a,z)\) and the link is \(g\), then \(\hat\mu(a,z)=g^{-1}\{\hat\eta(a,z)\}\). The standardization step averages these response-scale predictions, not their linear predictors, unless the scientific estimand is explicitly defined on the link scale.

What Is Being Compared?

For a finite target population, the standardized mean difference can also be written as a weighted average of profile-specific differences. This identity is useful for calculation and interpretation: every profile is compared under both exposure values, and then those within-profile comparisons are combined using the same target weights.

Result: For the same target profiles and weights under both exposure values, \(\bar\mu(a_1)-\bar\mu(a_0)=\sum_{k=1}^K w_k\{\mu(a_1,z_k)-\mu(a_0,z_k)\}\).

Proof. By the definition of the standardized means and distributivity of finite sums,

$$ \bar\mu(a_1)-\bar\mu(a_0) =\sum_{k=1}^K w_k\mu(a_1,z_k)-\sum_{k=1}^K w_k\mu(a_0,z_k) =\sum_{k=1}^K w_k\{\mu(a_1,z_k)-\mu(a_0,z_k)\}. $$

The shared weights matter. If one averages predictions under \(a_1\) over one covariate distribution and predictions under \(a_0\) over another, their difference is not the standardized contrast defined here; it combines an exposure comparison with a change in population composition. The same-profile comparison avoids that ambiguity.

A standardized ratio is defined differently: it is the ratio of the two standardized means. In general it is not the weighted average of the profile-specific ratios. That distinction follows directly from the definitions: \(\sum_k w_k\mu(a_1,z_k)/\sum_k w_k\mu(a_0,z_k)\) need not equal \(\sum_k w_k\{\mu(a_1,z_k)/\mu(a_0,z_k)\}\). Therefore, state whether a reported ratio is a ratio of standardized means or an average of profile-specific ratios.

Worked Calculations

Worked Example: A Difference with an Interaction

Suppose a continuous response has the fitted identity-link marginal mean \(\hat\mu(A,Z)=10+2A+4Z-3AZ\), where \(A\) is treatment (0 or 1) and \(Z\) is a binary covariate. The target population has weight 0.70 at \(Z=0\) and 0.30 at \(Z=1\). Calculate the standardized treatment mean difference.

For \(A=0\), the predicted means are \(\hat\mu(0,0)=10\) and \(\hat\mu(0,1)=10+4=14\). Thus \(\hat{\bar\mu}(0)=0.70(10)+0.30(14)=7+4.2=11.2\).

For \(A=1\), the predictions are \(\hat\mu(1,0)=10+2=12\) and \(\hat\mu(1,1)=10+2+4-3=13\). Thus \(\hat{\bar\mu}(1)=0.70(12)+0.30(13)=8.4+3.9=12.3\). The standardized difference is \(12.3-11.2=1.1\) response units.

Checking by profile-specific differences gives \(12-10=2\) at \(Z=0\) and \(13-14=-1\) at \(Z=1\). Their weighted average is \(0.70(2)+0.30(-1)=1.4-0.3=1.1\), as required. The interaction makes the profile-specific differences unequal, so reporting only one of them would not describe this target-standardized contrast.

Worked Example: Standardized Risk Difference

Consider a fitted logistic marginal mean model \(\operatorname{logit}\{\hat p(A,Z)\}=-2+0.8Z+1.2A-0.4AZ\), where \(A=1\) is treatment, \(A=0\) is control, and \(Z\) is binary. Define the target population to have weights 0.60 at \(Z=0\) and 0.40 at \(Z=1\). Calculate the standardized risks and their difference.

At \(A=0\), the linear predictors are \(-2\) for \(Z=0\) and \(-1.2\) for \(Z=1\). Applying the inverse logit, \(p=1/(1+\exp(-\eta))\), gives \(\hat p(0,0)=1/(1+\exp(2))\approx0.119202922\) and \(\hat p(0,1)=1/(1+\exp(1.2))\approx0.231475217\).

At \(A=1\), the predictors are \(-2+1.2=-0.8\) for \(Z=0\) and \(-2+0.8+1.2-0.4=-0.4\) for \(Z=1\). Therefore, \(\hat p(1,0)=1/(1+\exp(0.8))\approx0.310025519\) and \(\hat p(1,1)=1/(1+\exp(0.4))\approx0.401312340\).

Use the unrounded probabilities in the weighted averages: \(\hat{\bar p}(0)=0.60(0.119202922)+0.40(0.231475217)\approx0.164111840\), which rounds to 0.16411. Similarly, \(\hat{\bar p}(1)=0.60(0.310025519)+0.40(0.401312340)\approx0.346540247\), which rounds to 0.34654. The standardized risk difference is \(0.346540247-0.164111840\approx0.182428407\), or approximately 0.18243 (18.24 percentage points).

This is a risk difference for the stated target weights. It is not the difference between the fitted probabilities at just one value of \(Z\), nor is it obtained by taking a difference between the two linear predictors.

Worked Example: A Standardized Mean Ratio

Suppose a fitted log-link marginal mean model is \(\log\{\hat\mu(A,Z)\}=\log(2)+\log(1.5)A+\log(2)Z\). Here \(A=0\) or 1 and \(Z=0\) or 1. The target weights are 0.25 at \(Z=0\) and 0.75 at \(Z=1\). Find the standardized means and their ratio.

Exponentiating the predictor gives \(\hat\mu(A,Z)=2(1.5)^A2^Z\). Under \(A=0\), the profile means are 2 at \(Z=0\) and 4 at \(Z=1\), so \(\hat{\bar\mu}(0)=0.25(2)+0.75(4)=0.5+3=3.5\).

Under \(A=1\), the profile means are 3 and 6, so \(\hat{\bar\mu}(1)=0.25(3)+0.75(6)=0.75+4.5=5.25\). The standardized mean ratio is \(5.25/3.5=1.5\), and the standardized mean difference is \(5.25-3.5=1.75\).

In this model, each profile-specific mean ratio is also 1.5. The standardized ratio agrees because treatment multiplies both profile means by the same factor. Without that property, the ratio of standardized means must be calculated from the two weighted means rather than assumed to equal a common profile-specific ratio.

When the Target Distribution Does Not Affect a Difference

A useful special case occurs with an identity-link model whose treatment effect is additive and has no interaction with the covariates. In that case, the standardized mean difference equals the treatment coefficient for every target population represented by the model. This invariance does not hold in general when treatment effects vary across profiles.

Result: Suppose \(\mu(A,z)=\beta_0+\beta_A A+h(z)\), where \(h(z)\) does not depend on \(A\). For any target profiles and weights summing to one, the standardized difference comparing \(A=1\) with \(A=0\) is \(\beta_A\).

Proof. At every profile \(z_k\), \(\mu(1,z_k)-\mu(0,z_k)=\{\beta_0+\beta_A+h(z_k)\}-\{\beta_0+h(z_k)\}=\beta_A\). By the weighted-difference identity, the standardized difference is \(\sum_{k=1}^K w_k\beta_A=\beta_A\sum_{k=1}^K w_k=\beta_A\). The conclusion follows because the weights sum to one. \(\square\)

The example with an interaction shows why the assumption matters: profile-specific differences of 2 and \(-1\) do not stay constant across profiles, so their weighted average depends on the target weights. A coefficient from the linear predictor should therefore not automatically be described as a response-scale standardized effect.

Practical Interpretation and a Common Pitfall

A clear report identifies the outcome scale, the two exposure values, the target population, and the contrast. For example: “The model-predicted risk difference comparing treatment with control, standardized to the specified target covariate distribution, was 0.18243.” The weights must correspond to the intended population: equal weights for two strata define a different target from weights based on their observed proportions.

Common mistake: averaging the wrong quantities. One tempting but incorrect approach is to average link-scale predictions and then apply the inverse link, or to read a treatment coefficient as the standardized response-scale difference. In nonlinear-link models, the inverse link of an average predictor is not generally the average of the inverse-linked predictions. For a binary outcome, for instance, the risk difference in the worked example came from averaging predicted probabilities separately under treatment and control. It was not the difference between linear predictors, and it was not calculated by applying the inverse logit to an averaged predictor.

To avoid this error, first state the estimand in response-scale terms. Then calculate a prediction at every target profile under each exposure value, apply the target weights to each set of predictions, and only then take the desired difference or ratio. This order keeps the contrast aligned with its stated target population.

1
Define the comparison.
Specify the two exposure values and whether the target contrast is a mean difference, mean ratio, or risk difference.
2
Fix the target population.
List its covariate profiles and weights, and check that the weights are nonnegative and sum to one.
3
Predict and standardize.
Use the fitted model to obtain response-scale predictions at every profile under both exposure values; calculate both weighted means before taking their contrast.

Standardization makes a model-based comparison interpretable for a named population, but its value is conditional on both the fitted mean model and the target distribution. Report those choices alongside the numerical estimate so that the contrast can be understood and reproduced.

Check Your Understanding

Use the definitions and calculations above to check your understanding.

  1. For two target profiles with weights 0.25 and 0.75, what two standardized means must be calculated before forming a mean ratio?
  2. A model gives treatment differences of 4 and 1 in two profiles. Calculate the standardized difference when the target weights are 0.60 and 0.40.
  3. Explain why the standardized risk difference in a logistic mean model is not obtained by subtracting its treatment coefficients.
  4. In what special identity-link model does the standardized treatment difference equal the treatment coefficient for every target distribution?
  5. Why can changing the target-population weights change a standardized difference when the model includes a treatment-by-covariate interaction?
Clinical Biostats