Tutorials › Multiple Imputation by Chained Equations (MICE) › Preserving Cross-Level Effects Over Time

Nested and Multilevel Data · Tutorial 379 of 497

Preserving Cross-Level Effects Over Time

Build longitudinal imputation models that retain how cluster-level predictors modify change over time, and see how a common-slope model can distort imputed trajectories.

Advanced 12 min read

What You'll Learn

  • Specify a longitudinal imputation model with a time-by-cluster-level predictor interaction.
  • Interpret the fixed and random components of cluster-specific trajectories.
  • Calculate how a pooled common slope relates to observed within-cluster slopes.
  • Compare interaction, stratified, and common-slope imputation approaches.
  • Identify conditions and diagnostics relevant to preserving cross-level effects.

Why the Interaction Matters

In longitudinal data, the association between time and an outcome may differ across clusters, and a cluster-level characteristic may explain some of that difference. For example, the rate of change in a clinical outcome might depend on a treatment assigned to a clinic. If an imputation model represents only a common time slope, it can smooth over that pattern: values imputed for clusters with different characteristics are pulled toward a shared trajectory.

The key modeling term is the interaction between time and the cluster-level predictor. In chained equations, including that term in the conditional model for a repeatedly measured variable allows its imputed values to reflect different expected trajectories. It does not, by itself, ensure that every aspect of the multilevel data structure or missingness process is modeled correctly.

Definition: Let \(Y_{ijt}\) be a repeatedly measured outcome for person \(i\) in cluster \(j\) at time \(t\), and let \(W_j\) be a cluster-level predictor. A cross-level interaction over time is a term such as \(tW_j\) in a model for \(Y_{ijt}\). It allows the association of time with the outcome to vary with the cluster-level predictor.

Modeling Cluster-Specific Trajectories

For a continuous outcome, one useful linear specification is

$$ Y_{ijt} = \beta_0+\beta_1 t+\beta_2 W_j+\beta_3(tW_j) +b_{0j}+b_{1j}t+\varepsilon_{ijt}. $$

Here \(\beta_1\) is the fixed time slope when \(W_j=0\), and \(\beta_3\) is the change in that slope for a one-unit increase in \(W_j\). The cluster-specific slope is \(\beta_1+\beta_3W_j+b_{1j}\), where \(b_{1j}\) represents cluster-specific deviation from the fixed slope. The random intercept \(b_{0j}\) allows clusters to differ in their starting levels. A model may also include person-level random effects or additional predictors where the design and analysis require them.

A conventional model-based interpretation assumes the conditional mean is adequately represented by the specified terms, the random effects and residual structure are appropriately modeled, and the observed data provide information across the relevant combinations of time and \(W_j\). For example, a random-effects model often assumes normally distributed random effects with a specified covariance matrix. Repeated outcomes may also require a residual structure that accounts for serial dependence. The appropriate assumptions depend on the imputation model and data; adding \(tW_j\) does not replace them.

For chained equations, the conditional imputation model for a missing \(Y_{ijt}\) should contain time, \(W_j\), and their product when the analysis model or substantive knowledge indicates that the time trend differs by \(W_j\). Other relevant observed outcomes, covariates, and cluster structure should also be represented as appropriate. To reflect imputation uncertainty, the procedure should draw model parameters and residual or random-effect contributions rather than imputing only fitted conditional means.

When the outcome is binary or otherwise noncontinuous, the same design principle applies, but the conditional model uses a suitable link and outcome distribution. The interaction then modifies the time association on the model’s link scale; it is not automatically an interaction of the same size on the outcome-probability scale.

Worked Example: Two Different Trajectories

Consider hypothetical data from two clusters, with \(W_j=0\) for the first and \(W_j=1\) for the second. Suppose their observed outcomes follow the noiseless linear trajectories \(Y=10+2t\) and \(Y=10+5t\), respectively. Each cluster has one observed value at time 0 and one at time 1.

The interaction model has a time slope of 2 when \(W_j=0\), so \(\beta_1=2\). The slope when \(W_j=1\) is 5, giving \(\beta_1+\beta_3=5\), or \(\beta_3=3\). The common intercept is 10, so the fitted mean is \(10+2t+3tW_j\).

At time 2, the interaction model predicts \(10+2(2)+3(2)(0)=14\) for the first cluster and \(10+2(2)+3(2)(1)=20\) for the second. If the product term is omitted and a common intercept and time slope are fitted, the two observed within-cluster slopes receive equal weight here: each cluster has \(S_{tt}=0.5\). The common slope is therefore \((0.5(2)+0.5(5))/(0.5+0.5)=3.5\), giving a time-2 prediction of 17 for both clusters. The common-slope model fails to retain the difference in trajectory.

This calculation uses noiseless linear trajectories, so the group slopes equal their underlying slopes. With residual variation, observed group slopes need not equal the underlying slopes, and the pooled fitted slope is not generally a weighted average of the underlying slopes.

Why the Pooled Slope Can Differ

The distinction between observed slopes and underlying model slopes matters. In a regression of observed outcomes on time with a common slope, the fitted slope is determined by the observed within-group covariances, not by a formula involving only the true slopes. When groups have the same time schedule, the pooled slope is a weighted average of their observed within-group slopes, with weights given by their within-group time sums of squares.

To see this, let \(S_{tt,g}=\sum_k(t_{kg}-\bar t_g)^2\) and let \(\widehat{s}_g\) be the observed least-squares slope in group \(g\). If the groups have the same mean time, then the between-group contribution to the pooled time-outcome covariance is zero. The pooled slope is

$$ \widehat{s}_{\mathrm{pooled}} = \frac{\sum_g S_{tt,g}\widehat{s}_g}{\sum_g S_{tt,g}}. $$

This follows because the within-group time-outcome cross-product is \(S_{ty,g}=S_{tt,g}\widehat{s}_g\), and, with common group mean time, the pooled cross-product is \(\sum_g S_{ty,g}\). Dividing by the pooled time sum of squares \(\sum_g S_{tt,g}\) gives the expression. If group mean times differ, between-group terms also enter both pooled cross-products, so this weighted-average result need not hold.

Worked Example: Residual Variation Changes the Observed Slope

Suppose two hypothetical groups are each observed at times 0 and 1. Their recorded outcomes are \((0,2)\) and \((0,-2)\). The first observed group slope is \((2-0)/(1-0)=2\); the second is \((-2-0)/(1-0)=-2\). Each group has \(S_{tt,g}=(0-0.5)^2+(1-0.5)^2=0.5\).

The common fitted slope is therefore

$$ \widehat{s}_{\mathrm{pooled}} = \frac{0.5(2)+0.5(-2)}{0.5+0.5} = 0. $$

The observed common slope is 0, even if the data-generating model had a different underlying slope pattern and these outcomes arose through residual variation. Thus, one must not substitute underlying slopes into the weighted-average formula for observed fitted slopes unless conditions justify that substitution. A zero-mean residual assumption can support an expectation statement under a correctly specified model; it does not make the formula an identity for a particular observed dataset.

Including the Interaction in Chained Equations

In MICE, the conditional model for each incomplete variable is specified in turn, using current values of the other variables. When the target variable is the repeated outcome, form or include the time-by-\(W_j\) product in its imputation model. If time is centered, use the centered time in the product as well. The product may be generated deterministically from time and \(W_j\); its inclusion does not mean it is an independent observed variable.

A practical sequence is to state the trajectory structure implied by the scientific analysis, choose a conditional model that can represent it, and then check whether there is adequate observed information for its terms. The following outline emphasizes the modeling decisions rather than prescribing a particular software implementation.

1
Specify the target trajectory.
Decide whether time trends are expected to vary with \(W_j\), and whether cluster-specific random slopes or other dependence terms are needed.
2
Construct the predictor terms.
Include time, \(W_j\), and \(tW_j\) in the conditional model when the cross-level effect is part of the intended trajectory structure. Include suitable additional predictors and history where justified.
3
Generate imputations with uncertainty.
Draw from the fitted conditional model, including parameter and residual uncertainty, rather than replacing missing outcomes with conditional means alone.
4
Review the resulting trajectories.
Compare observed and imputed values across time and levels of \(W_j\), and check whether the fitted structure has support in the observed data.

Worked Example: Calculating an Imputed Conditional Value

For illustration, suppose a hypothetical continuous-outcome conditional model has fixed part \(12+1.2t+2W_j+0.8tW_j\), cluster random intercept \(u_j=-1\), and residual standard deviation 2. Consider a missing value at time \(t=3\) in a cluster with \(W_j=1\).

The conditional mean, given the stated coefficients and random intercept, is

$$ 12+1.2(3)+2(1)+0.8(3)(1)-1 = 12+3.6+2+2.4-1 = 19. $$

For a simple illustrative residual draw of \(-0.5\) standard deviations, the imputed value is \(19+(-0.5)(2)=18\). An actual MICE implementation would also account for parameter uncertainty through appropriate draws; this single calculation illustrates how the interaction contributes to the conditional mean. If the interaction were omitted, the corresponding conditional mean would be \(12+3.6+2-1=16.6\), a difference of 2.4 outcome units at this time and predictor value.

Centering, Alternatives, and Limitations

Centering time changes coefficient interpretation but does not remove the need for an interaction. For example, let \(t_c=t-2\). Then \(t=t_c+2\), and

$$ \beta_1t+\beta_2W_j+\beta_3tW_j = \beta_1t_c+2\beta_1 +(\beta_2+2\beta_3)W_j +\beta_3t_cW_j. $$

The interaction coefficient remains \(\beta_3\), while the coefficient for \(W_j\) now describes its association at time 2 rather than time 0. Centering can make that reference point more useful, but it does not create information where the data have little overlap in time or \(W_j\).

There are alternatives to a pooled interaction model. Separate imputation models within levels of a categorical \(W_j\) can allow different trajectories, but may be unstable when some groups have few observed values and cannot directly express a continuous \(W_j\) effect. A pooled common-slope model is simpler, but imposes no time modification by \(W_j\). A model with an explicit interaction shares information across levels while allowing the slope to vary systematically. The choice should reflect the analysis model, the data structure, and the available information.

Including an interaction is not a remedy for every imputation problem. The conditional model can still be misspecified, random-effects or serial dependence can be inadequately handled, and sparse data can make the interaction poorly estimated. Under a missing-at-random framework, the imputation model must condition on variables needed to make that assumption plausible and represent the relevant outcome relationships. The interaction does not establish that missingness is at random, and it does not resolve missing-not-at-random mechanisms. Chained conditional models can also be incompatible with a single joint distribution; retaining important terms is necessary for the intended relationships but does not guarantee full compatibility.

Diagnostics and Common Pitfalls

Check whether observed data contain enough time variation within clusters and enough clusters across levels of \(W_j\) to estimate the interaction. Inspect fitted or imputed trajectories by time and \(W_j\), and compare distributions of observed and imputed outcomes over those groups. Implausibly flat trajectories, abrupt jumps, or imputed values concentrated in a narrow range can indicate that the model or its uncertainty representation is inadequate. A convergence trace alone cannot establish that the interaction is preserved or that the imputation model is scientifically appropriate.

  • Omitting the product term: A model with time and \(W_j\) main effects but no \(tW_j\) term allows different levels but forces a common time slope.
  • Using only fitted means: Deterministic mean substitution omits residual and parameter uncertainty and can make completed data too regular.
  • Confusing fitted and true slopes: The pooled-slope identity concerns observed within-group fitted slopes under its stated conditions, not generally the underlying trajectory slopes.
  • Extrapolating beyond support: A fitted interaction can produce predictions for combinations of time and \(W_j\) scarcely represented in observed data; those predictions warrant caution.
Key takeaway: When the time trend is intended to vary with a cluster-level predictor, represent that relationship with a time-by-predictor term in the longitudinal imputation model. Then check the data support and cluster structure, and distinguish the model’s intended trajectories from noisy observed slopes.

Check Your Understanding

Answer each question, then compare with the solutions.

  1. In the model with fixed terms \(\beta_1t+\beta_3tW_j\), what is the fixed time slope when \(W_j=2\)?
  2. Two groups have equal \(S_{tt}\) and observed within-group slopes 1 and 5. What is the pooled common slope if their mean times are equal?
  3. Why does centering time not eliminate the need for a time-by-\(W_j\) interaction?
  4. Name one limitation that remains even when the interaction is included in the imputation model.

Solutions. (1) The fixed slope is \(\beta_1+2\beta_3\). (2) The pooled slope is \((1+5)/2=3\), because equal \(S_{tt}\) gives equal weights and the group mean times are equal. (3) Centering changes the reference time and the main-effect interpretations, but the slope can still vary with \(W_j\); the centered-time product retains that variation. (4) For example, sparse observations across time and \(W_j\) can make the interaction poorly estimated, or the model can still fail to represent serial dependence or the missingness process adequately.

Clinical Biostats