Tutorials › Regression Analysis (Undergraduate) › Standardize Regression Predictions to Estimate Effects

Regression in Observational Studies · Tutorial 926 of 991

Standardize Regression Predictions to Estimate Effects

Use the same sampled covariate profiles under both exposure scenarios to turn regression predictions into a standardized mean or risk difference.

Advanced 10 min read

What You'll Learn

  • Define standardized mean and risk estimates using predictions under each exposure level.
  • Calculate a standardized difference by averaging predictions over the same sampled units.
  • Work with continuous outcomes and probabilities from a logistic regression model.
  • Explain when a standardized contrast has a causal interpretation.
  • Recognize why a regression coefficient may differ from a standardized effect.
  • Avoid averaging only the predictions for units who actually received each exposure.

From Regression Predictions to an Average Effect

A regression model can estimate an outcome for a particular covariate profile under a specified exposure level. To estimate an average contrast for a group of sampled units, use the model to predict each unit’s outcome twice: once under one exposure level and once under the other. Then average each set of predictions over the same units and compare the averages.

This procedure is called standardization (also known as the parametric g-formula). It answers a population-average question for a stated target group: what would the average predicted outcome be if everyone in that group had exposure level 1, compared with the average if everyone had exposure level 0? The procedure uses observed covariates to keep the target group’s covariate distribution the same in both scenarios.

Definition: Let \(A\) be a binary exposure, with levels 0 and 1, and let \(L_i\) denote the measured covariates for sampled unit \(i\). Let \(\hat m(a,L_i)\) be the fitted regression model’s predicted outcome for that unit if the exposure were set to \(a\). For a sample of \(n\) target units, the standardized estimate under exposure level \(a\) is $$ \hat\psi_a=\frac{1}{n}\sum_{i=1}^{n}\hat m(a,L_i). $$ The standardized difference, comparing level 1 with level 0, is $$ \hat\Delta_{\mathrm{std}}=\hat\psi_1-\hat\psi_0. $$ For a continuous outcome, \(\hat\psi_a\) is an estimated mean. For a binary outcome, if \(\hat m(a,L_i)\) is a predicted event probability, \(\hat\psi_a\) is an estimated risk.

The counterfactual wording describes the two prediction scenarios, not two outcomes actually observed for each unit. Each sampled unit contributes its covariates to both scenarios, while its exposure is set to 0 for one prediction and 1 for the other. The fitted model supplies the predictions; the observed sample covariates determine how those predictions are averaged.

Conditions for Interpreting a Standardized Contrast

The calculation itself is arithmetic. Interpreting its result as a causal effect requires additional conditions. In an observational study, a standard set of identification assumptions is:

  • Consistency: a unit’s observed outcome equals its potential outcome under the exposure level that unit actually received. The exposure levels and outcomes must be defined clearly enough for this comparison to make sense.
  • Conditional exchangeability: within levels of the measured covariates \(L\), exposure assignment is independent of the potential outcomes. In notation, \(Y(a)\perp A\mid L\) for \(a=0,1\). This says that the adjustment variables suffice to control confounding; it cannot be verified from the fitted regression alone.
  • Positivity: for every covariate profile in the target population, there is a positive probability of receiving either exposure level: \(0<P(A=a\mid L)<1\) for \(a=0,1\). Predictions for profiles with no support under one exposure rely on extrapolation.
  • Adequate outcome-model specification: the fitted model must estimate the conditional mean or risk \(E(Y\mid A=a,L)\) well enough over the target covariate profiles and both exposure levels. Important nonlinearities or exposure-by-covariate relationships cannot be ignored if they affect these predictions.

The target group also matters. Averaging over the observed covariates of a study sample estimates a contrast standardized to that sample’s covariate distribution. Interpreting it as an effect for a wider population requires that the sample and target population be appropriately connected. Standardization does not by itself repair unmeasured confounding, poor overlap, or a model that predicts badly.

Why the Averaging Formula Works

The justification is the law of total expectation. For a target population with covariates \(L\), its average potential outcome under exposure level \(a\) can be written as an average of the potential outcome conditional on covariates:

$$ E\{Y(a)\}=\int E\{Y(a)\mid L=l\}\,dF_L(l). $$

Under conditional exchangeability, the conditional mean of \(Y(a)\) at covariates \(l\) equals the observed conditional mean among units with exposure \(a\) and those covariates. Consistency then identifies that observed mean with \(E(Y\mid A=a,L=l)\). Thus,

$$ E\{Y(a)\}=\int E(Y\mid A=a,L=l)\,dF_L(l). $$

A fitted outcome regression estimates the conditional mean inside this integral. For a finite target sample, the empirical covariate distribution assigns weight \(1/n\) to each sampled unit. Replacing the conditional mean with the fitted prediction and the population covariate distribution with that empirical distribution gives

$$ \hat\psi_a=\frac{1}{n}\sum_{i=1}^{n}\hat m(a,L_i). $$

Subtracting the two standardized means estimates the average contrast for exposure level 1 versus level 0. If \(Y\) is binary and \(\hat m\) predicts probabilities, this is a risk difference. The derivation explains why the same target covariate distribution must be used for both exposure scenarios.

Worked Example: Standardizing a Continuous Outcome

Suppose a hypothetical observational sample includes three adults. The exposure is participation in a health program (\(A=1\)) rather than no participation (\(A=0\)); the outcome is systolic blood pressure in mmHg. Let \(X\) be a measured baseline covariate, recorded here as 0, 1, or 2. A fitted linear regression gives the following model, with predictions in mmHg:

$$ \hat m(A,X)=120-4A-2X-AX. $$

The model includes an exposure-by-\(X\) interaction, so the predicted exposure contrast can vary across the sampled profiles. The sample has \(X=0,1,2\). Predict each unit’s outcome under both exposure levels:

Unit\(X\)Prediction if \(A=0\) (mmHg)Prediction if \(A=1\) (mmHg)Difference, \(A=1\) minus \(A=0\) (mmHg)
10\(120-2(0)=120\)\(120-4-2(0)-0(0)=116\)\(116-120=-4\)
21\(120-2(1)=118\)\(120-4-2(1)-1(1)=113\)\(113-118=-5\)
32\(120-2(2)=116\)\(120-4-2(2)-1(2)=110\)\(110-116=-6\)

Average the predictions under each scenario:

$$ \hat\psi_0=\frac{120+118+116}{3}=\frac{354}{3}=118\text{ mmHg}, \qquad \hat\psi_1=\frac{116+113+110}{3}=\frac{339}{3}=113\text{ mmHg}. $$

Therefore, the standardized difference is \(113-118=-5\) mmHg. Under this fitted model, standardizing to these three sampled covariate values gives a predicted mean blood pressure 5 mmHg lower under program participation than under no participation. This is a model-based contrast, not proof that the program caused the reduction. A causal interpretation would additionally require the identification and model assumptions stated above.

As a check, the unit-specific differences average to \((-4-5-6)/3=-5\) mmHg, which matches the difference between the two averages. In general, averaging individual prediction differences equals subtracting the two averages because both use the same units and weights.

Standardizing a Binary Outcome

For a binary outcome, such as whether an event occurred within a defined follow-up period, the regression should provide predicted probabilities. A logistic regression is one common choice. If its fitted linear predictor is \(\hat\eta(a,L_i)\), the predicted probability is

$$ \hat m(a,L_i)=\frac{\exp\{\hat\eta(a,L_i)\}}{1+\exp\{\hat\eta(a,L_i)\}}. $$

Average these probabilities separately under \(A=0\) and \(A=1\). The resulting standardized estimates are risks, and their difference is a risk difference in probability units. Multiplying by 100 expresses it in percentage points. Do not average the linear predictors and then treat the result as the average risk: converting a mean logit to a probability is generally not the same as averaging the probabilities.

Worked Example: Standardizing Risks From a Logistic Model

Consider a hypothetical sample of four people and a binary outcome indicating an event. Let \(X\) be a baseline risk factor coded 0 or 1, with two sampled people at each value. A fitted logistic model has linear predictor

$$ \hat\eta(A,X)=-2+0.8A+X. $$

For each of the four people, calculate a risk prediction under both exposure levels. The logistic transformation is \(\exp(\hat\eta)/\{1+\exp(\hat\eta)\}\). For \(X=0\), the predictions are \(\operatorname{expit}(-2)=0.1192\) under \(A=0\) and \(\operatorname{expit}(-1.2)=0.2315\) under \(A=1\). For \(X=1\), they are \(\operatorname{expit}(-1)=0.2689\) and \(\operatorname{expit}(-0.2)=0.4502\), respectively. Here \(\operatorname{expit}(z)=\exp(z)/\{1+\exp(z)\}\).

Sampled people\(X\)Predicted risk if \(A=0\)Predicted risk if \(A=1\)
1 and 200.1192 each0.2315 each
3 and 410.2689 each0.4502 each

The standardized risks are

$$ \hat\psi_0=\frac{2(0.1192)+2(0.2689)}{4} =\frac{0.7762}{4}=0.1941, $$
$$ \hat\psi_1=\frac{2(0.2315)+2(0.4502)}{4} =\frac{1.3634}{4}=0.3409. $$

The standardized risk difference is \(0.3409-0.1941=0.1468\), or 14.68 percentage points. In context, the model estimates a 34.09% event risk under exposure level 1 and a 19.41% risk under level 0 for this sample’s covariate distribution, a difference of 14.68 percentage points. These are standardized model estimates; the causal interpretation still depends on the assumptions, not just the calculation.

What Determines the Standardized Result?

A standardized estimate depends on both the fitted regression and the distribution of covariates used for averaging. The same fitted model can yield different estimates when standardized to different target groups. For example, a group with more high-risk covariate profiles may have a larger predicted risk under both exposure levels than a group with more low-risk profiles. Its standardized risk difference may also differ if the model’s exposure contrast changes across profiles.

With an interaction, the model explicitly allows predicted contrasts to vary across covariate values, as in the continuous-outcome example. Even without an interaction, a coefficient does not always equal a population-average contrast. In a logistic model, the exposure coefficient describes a conditional change in log odds under the specified model; standardization instead averages predicted probabilities and compares risks. These are different scales and summaries.

Standardization also makes the target distribution visible. To target a larger population rather than the sample, predictions can be averaged over covariates representing that target population, provided the model and assumptions support the extrapolation. The choice of target should be stated, rather than allowing the set of rows used in the calculation to define it without explanation.

Worked Example: Weighting Covariate Profiles in the Target Sample

Suppose a hypothetical target sample contains five adults with three measured risk profiles. A fitted logistic model returns the predicted event risks shown below under each exposure scenario. Two sample members have profile P, two have profile Q, and one has profile R. The predictions are listed to three decimal places.

ProfileNumber of sampled adultsPredicted risk if \(A=0\)Predicted risk if \(A=1\)
P20.1200.180
Q20.2500.350
R10.4500.600

Use each sampled adult once in each scenario, so profiles represented by more adults receive more weight:

$$ \hat\psi_0=\frac{2(0.120)+2(0.250)+1(0.450)}{5} =\frac{1.190}{5}=0.238, $$
$$ \hat\psi_1=\frac{2(0.180)+2(0.350)+1(0.600)}{5} =\frac{1.660}{5}=0.332. $$

The standardized risk difference is \(0.332-0.238=0.094\), or 9.4 percentage points. The estimates are standardized to the target sample’s profile distribution: 40% profile P, 40% profile Q, and 20% profile R. Using the same profile weights under both exposure levels makes the contrast about changing exposure while holding the target distribution fixed.

Common Mistakes and Practical Checks

  • Averaging predictions only among those who actually received each exposure. This generally uses different covariate distributions for the two averages and does not implement the stated standardization. Predict both exposure levels for every target unit, then average over the same units.
  • Calling a standardized contrast causal automatically. Regression adjustment does not establish exchangeability or positivity. State the assumptions and consider whether the available covariates and exposure overlap make them plausible.
  • Reporting a logistic coefficient as a standardized risk difference. The coefficient is on the log-odds scale. Transform predictions to probabilities, average those probabilities, and then subtract the standardized risks to obtain a risk difference.
  • Ignoring the target group. The covariates used for averaging determine which population the estimate describes. Name the target distribution and explain whether the sample represents it.
  • Trusting predictions outside the observed covariate support. If a target profile has little or no support under one exposure level, the corresponding prediction may depend heavily on extrapolation. Check overlap before interpreting the estimate.

A useful reporting statement gives the target group, both standardized means or risks, their difference and units, and the assumptions needed for a causal reading. For instance, a report might say that the fitted model estimated risks of 34.09% and 19.41% under the two exposure scenarios for the sample’s covariate distribution, a standardized risk difference of 14.68 percentage points; a causal interpretation requires adequate confounding control, positivity, and outcome-model fit.

Check Your Understanding

Use the formulas and examples above to answer these questions.

  1. In the standardized estimate \(\hat\psi_1\), why are predictions under exposure level 1 calculated for units who actually received either exposure level?
  2. A binary-outcome model predicts risks of 0.10 and 0.30 for two target units under exposure level 0, and 0.20 and 0.50 under level 1. Calculate both standardized risks and the risk difference for these two equally weighted units.
  3. What additional assumptions are required before describing a standardized regression contrast as a causal effect in an observational study?
  4. Why is averaging logistic-model predicted probabilities different from transforming the average linear predictor into a probability?
  5. If the fitted model includes an exposure-by-covariate interaction, what feature of the unit-level predictions may vary across covariate profiles?