Tutorials › Marginal Structural Models › Standardized Differences After Weighting

Diagnostics and Sensitivity to Misspecification · Tutorial 263 of 501

Standardized Differences After Weighting

Calculate and interpret weighted standardized mean differences using a clearly defined reference scale for baseline and time-varying covariates.

Advanced 12 min read

What You'll Learn

  • Calculate normalized weighted means within each treatment group.
  • Choose a fixed reference standard deviation for a weighted standardized difference.
  • Compute standardized differences for continuous and binary covariates.
  • Compare baseline and time-specific covariate balance between treatment groups.
  • Recognize why weight rescaling does not change the statistic and why a small value is not proof of overall balance.

Why Standardize a Weighted Difference?

A weighted mean difference reports a covariate imbalance in its original units: years, kilograms, or percentage points. That is useful, but it makes comparisons across covariates difficult. A difference of 2 years may be large for one covariate and small for another. A standardized mean difference expresses the difference in units of a reference standard deviation, making its magnitude easier to compare across variables and analyses.

For a weighted analysis, the comparison is between covariate means calculated separately in the treatment groups using the analysis weights. The standardization scale should be specified as well: changing the denominator can change the reported magnitude even when the weighted means are unchanged. The convention used here is a fixed, pre-weighting reference standard deviation from the analysis sample or time-specific risk set. Keeping that scale fixed makes comparisons across weighting specifications interpretable.

Definition: Let \(A_i\) indicate treatment group for individual \(i\), with \(A_i=1\) or \(A_i=0\), and let \(W_i\) be a nonnegative analysis weight. For group \(a\), the normalized weighted mean of covariate \(X\) is $$ \bar X_{w,a}=\frac{\sum_{i:A_i=a}W_iX_i}{\sum_{i:A_i=a}W_i}. $$ Given a positive reference standard deviation \(S_{\mathrm{ref}}\), the signed weighted standardized mean difference is $$ \operatorname{SMD}_w(X)=\frac{\bar X_{w,1}-\bar X_{w,0}}{S_{\mathrm{ref}}}. $$ Its absolute value, \(\lvert\operatorname{SMD}_w(X)\rvert\), reports magnitude without direction. A positive signed value means the weighted mean is higher in group 1.

Choosing the Reference Scale

For a continuous covariate measured before treatment, one common fixed reference is its ordinary pooled standard deviation in the original analysis sample. If \(n_1\) and \(n_0\) are the unweighted group sizes, and \(s_1^2\) and \(s_0^2\) are the corresponding sample variances, define $$ S_{\mathrm{ref}}= \sqrt{\frac{(n_1-1)s_1^2+(n_0-1)s_0^2}{n_1+n_0-2}}. $$

The denominator is calculated before applying the analysis weights; the numerator uses the weighted means. This separates the change in covariate balance due to weighting from a change in the scale used to measure that balance. Another convention is to divide by a pooled standard deviation calculated after weighting. That convention is not interchangeable with the fixed-reference version: the weighted variance itself can change when the weights change. Always identify which denominator is being used, especially when comparing reported SMDs.

For a binary covariate, use the reference standard deviation of a Bernoulli variable. If its unweighted prevalence in the reference sample is \(p_{\mathrm{ref}}\), then \(S_{\mathrm{ref}}=\sqrt{p_{\mathrm{ref}}(1-p_{\mathrm{ref}})}\). For a time-varying covariate, define the reference sample as the eligible risk set at the relevant time, and calculate its scale there before weighting.

Worked Example: A Baseline Continuous Covariate

Suppose a baseline covariate \(X\) has values 2 and 4 in treatment group 1, with weights 1 and 3, and values 1 and 3 in group 0, with weights 2 and 2. Calculate the weighted SMD using the ordinary pooled standard deviation in the original four-person sample.

For group 1, the total weight is \(1+3=4\), so $$ \bar X_{w,1}=\frac{1(2)+3(4)}{4}=\frac{14}{4}=3.5. $$ For group 0, the total weight is \(2+2=4\), so $$ \bar X_{w,0}=\frac{2(1)+2(3)}{4}=\frac{8}{4}=2. $$ The unweighted group means are 3 and 2, and each group has sample variance 2. Thus the ordinary pooled variance is $$ \frac{(2-1)2+(2-1)2}{2+2-2}=2, $$ and \(S_{\mathrm{ref}}=\sqrt{2}\). Therefore $$ \operatorname{SMD}_w(X)=\frac{3.5-2}{\sqrt{2}}=\frac{1.5}{1.4142}\approx 1.061. $$ The weighted mean in group 1 is about 1.06 reference standard deviations higher than in group 0. This describes a substantial difference in this small example; the number alone does not establish why the difference arose.

Binary and Time-Varying Covariates

The same weighted-mean formula applies to a binary covariate coded 0 and 1: its weighted mean is its weighted proportion of 1s. The denominator must be based on a defined reference prevalence, not silently substituted with a weighted prevalence from one treatment group. For longitudinal data, the calculation is repeated at each time using the appropriate covariate measured before the treatment decision at that time and the analysis weights intended for that comparison.

Worked Example: A Baseline Binary Covariate

In group 1, a binary covariate has values 1, 1, and 0 with weights 1, 2, and 1. In group 0, it has values 1, 0, and 0 with weights 1, 1, and 2. Use the unweighted prevalence in all six people as the reference prevalence.

The weighted prevalence in group 1 is $$ \bar X_{w,1}=\frac{1(1)+2(1)+1(0)}{1+2+1}=\frac{3}{4}=0.75. $$ In group 0, it is $$ \bar X_{w,0}=\frac{1(1)+1(0)+2(0)}{1+1+2}=\frac{1}{4}=0.25. $$ There are three 1s among six people, so \(p_{\mathrm{ref}}=3/6=0.5\), and the reference standard deviation is $$ S_{\mathrm{ref}}=\sqrt{0.5(1-0.5)}=\sqrt{0.25}=0.5. $$ The signed SMD is \((0.75-0.25)/0.5=1\). Thus the weighted prevalence differs by one reference standard deviation, with the higher prevalence in group 1.

At time \(t\), let \(L_t\) denote a covariate measured before the treatment \(A_t\), and consider the eligible individuals in the risk set for that decision. Comparing the weighted means of \(L_t\) between \(A_t=1\) and \(A_t=0\) gives a time-specific mean-balance diagnostic. Use the weight appropriate to the longitudinal treatment contrast and state whether it includes the weight contribution for treatment at time \(t\). Mixing weights from different time points can produce a comparison that does not correspond to the intended diagnostic.

Worked Example: A Time-Varying Covariate

At a particular treatment decision, a continuous covariate \(L_t\) has values 0 and 2 among those with \(A_t=1\), with weights 1 and 3. Among those with \(A_t=0\), it has values 1 and 3, with weights 2 and 2. Suppose these four people form the eligible risk set and use its unweighted pooled standard deviation as the fixed reference.

The weighted means are $$ \bar L_{t,w,1}=\frac{1(0)+3(2)}{1+3}=1.5,\qquad \bar L_{t,w,0}=\frac{2(1)+2(3)}{2+2}=2. $$ In the unweighted reference sample, each treatment group has two observations and sample variance 2. Hence $$ S_{\mathrm{ref}}= \sqrt{\frac{(2-1)2+(2-1)2}{2+2-2}}=\sqrt{2}. $$ The time-specific SMD is $$ \frac{1.5-2}{\sqrt{2}}\approx -0.354. $$ The negative sign indicates a lower weighted mean of \(L_t\) in the \(A_t=1\) group. The magnitude is about 0.35 reference standard deviations. Its interpretation is restricted to this time, risk set, covariate, and weighting scheme.

Two Properties of the Statistic

These properties explain why normalization choices and covariate units matter.

Result 1: Rescaling weights within groups leaves the weighted SMD unchanged. Suppose every weight in group \(a\) is multiplied by the same constant \(c_a>0\). Then the weighted mean for each group, and therefore the SMD with a fixed reference scale, is unchanged.

Proof. The rescaled mean in group \(a\) is $$ \frac{\sum_{i:A_i=a}c_aW_iX_i}{\sum_{i:A_i=a}c_aW_i} = \frac{c_a\sum_{i:A_i=a}W_iX_i}{c_a\sum_{i:A_i=a}W_i} =\bar X_{w,a}. $$ The group means are unchanged, so their difference is unchanged. The reference standard deviation is fixed, hence the SMD is unchanged as well. This is why normalizing weights to sum to a common total within each treatment group does not alter this diagnostic. \(\square\)

Result 2: Changing covariate units does not change the SMD magnitude. If \(Y=bX+d\), where \(b\ne 0\), and the reference standard deviation is transformed using the same linear change of units, then \(\lvert\operatorname{SMD}_w(Y)\rvert=\lvert\operatorname{SMD}_w(X)\rvert\). For \(b>0\), the signed SMD is unchanged; for \(b<0\), its sign reverses.

Proof. By linearity of the weighted mean, \(\bar Y_{w,a}=b\bar X_{w,a}+d\). Thus the weighted mean difference is \(b(\bar X_{w,1}-\bar X_{w,0})\). A standard deviation transforms as \(S_{\mathrm{ref},Y}=\lvert b\rvert S_{\mathrm{ref},X}\), because adding \(d\) does not change a standard deviation and multiplication by \(b\) multiplies it by \(\lvert b\rvert\). Therefore $$ \operatorname{SMD}_w(Y) =\frac{b}{\lvert b\rvert}\operatorname{SMD}_w(X). $$ Taking absolute values proves the magnitude claim, and the sign claim follows from \(b/\lvert b\rvert\). \(\square\)

Reading and Comparing Results

An SMD is dimensionless. Its sign gives direction, while its absolute value gives separation relative to the chosen reference scale. A table should report the covariate, time point if relevant, signed or absolute SMD, reference-scale definition, and the weighting scheme. If several treatment-model specifications are being compared, keep the analysis sample and reference scales fixed; otherwise a change in SMD can reflect a changed denominator or sample as well as a changed weighted difference.

Rules such as treating an absolute SMD below 0.1 as reassuring are conventions, not universal significance tests or guarantees. No threshold proves that a causal effect is unbiased. A small SMD says that the two weighted means are close relative to the stated scale for that covariate. It does not establish equality of variances, tails, or the full covariate distributions, and it does not address unmeasured confounding.

QuantityWhat it reportsImportant qualification
Weighted mean differenceDifference in the covariate's original unitsHarder to compare across covariates with different scales
Weighted SMD with fixed reference SDMean difference in reference-SD unitsRequires a stated reference sample and scale
SMD with a post-weighting SDMean difference relative to a weighted scaleCan change because both means and the denominator change

Common Pitfalls and Diagnostics

Compared with an unstandardized weighted difference, the SMD improves scale comparability but adds a denominator convention that must be defended. Compared with a post-weighting standardization, a fixed pre-weighting reference makes comparisons across weighting choices more stable. Neither approach turns a mean comparison into a complete assessment of covariate distributions. Extreme or concentrated weights can also make weighted means depend heavily on a few observations, so interpret SMDs alongside the weight diagnostics and effective sample size rather than in isolation.

Check Your Understanding

Answer each question, then compare with the worked solutions below.

  1. If every weight in each treatment group is multiplied by 10, what happens to the weighted SMD? Why?
  2. A binary covariate has weighted prevalences 0.60 and 0.40, and reference prevalence 0.50. Calculate its SMD.
  3. At time \(t\), why should a covariate measured after treatment \(A_t\) not be substituted for the pre-treatment covariate in a time-specific balance comparison?
  4. Two analyses have the same weighted mean difference, but the second reports a larger absolute SMD. Give one possible explanation.

Solutions. (1) Nothing changes: the common multiplier cancels from each normalized weighted mean, and the reference scale is fixed. (2) The reference SD is \(\sqrt{0.5(0.5)}=0.5\), so the SMD is \((0.60-0.40)/0.5=0.40\). (3) The diagnostic is intended to compare a covariate available before the treatment decision; a post-treatment value is temporally different and may itself be affected by treatment. (4) The second analysis may use a smaller reference SD, perhaps because it changed the reference sample or denominator convention. The mean difference alone does not determine the SMD.

Back to Tutorials
Clinical Biostats