Tutorials › Multiple Imputation by Chained Equations (MICE) › Random Trajectories In Longitudinal Imputation

Nested and Multilevel Data · Tutorial 373 of 497

Random Trajectories In Longitudinal Imputation

Specify and interpret random-trajectory models, then use them to form uncertainty-aware imputations for missing visits.

Advanced 12 min read

What You'll Learn

  • Write a longitudinal random-intercept and random-time-slope model and state its assumptions.
  • Interpret population-average time trends and person-specific trajectories in context.
  • Derive the covariance between repeated outcomes induced by shared random effects.
  • Understand how centering time changes the random-effects interpretation but not the fitted trajectories.
  • Distinguish a predictive mean from a stochastic imputation for a missing visit.
  • Recognize diagnostics and limitations of random-trajectory imputations.

Why Model Person-Specific Trajectories?

Repeated measurements from the same person are related. A model that gives everyone the same time trend, apart from independent visit-level noise, may miss meaningful differences: some people start higher, and some change faster. In longitudinal imputation, that matters because a missing visit should be plausible given both the overall time pattern and the observed history of that person.

A random-trajectory model represents these features with a person-specific intercept and, when supported by the data, a person-specific time slope. Earlier material on Modeling Time In Longitudinal Imputation established how time can enter an imputation model; here the focus is on allowing trajectories to vary between people. This tutorial uses a continuous outcome as its main example. Other outcome types require an appropriate conditional outcome model, but the distinction between fixed and person-specific time effects remains useful.

Definition: For person \(i\) at visit \(j\), let \(Y_{ij}\) be the outcome and \(t_{ij}\) the numerical time of measurement, expressed in a stated unit. A random-intercept and random-time-slope model is $$ Y_{ij}=\beta_0+\beta_1t_{ij}+b_{0i}+b_{1i}t_{ij}+\epsilon_{ij}. $$ The fixed effects \(\beta_0\) and \(\beta_1\) describe the population-average intercept and time slope. The person-specific deviations \(b_{0i}\) and \(b_{1i}\) allow each person’s trajectory to depart from that average.

A standard version assumes that the random-effects vector has a bivariate normal distribution with mean zero and covariance matrix \(G\), and that the residuals have mean zero and variance \(\sigma^2\):

$$ \begin{pmatrix}b_{0i}\\b_{1i}\end{pmatrix} \sim N_2\left[ \begin{pmatrix}0\\0\end{pmatrix}, \begin{pmatrix}\tau_{00}&\tau_{01}\\\tau_{01}&\tau_{11}\end{pmatrix} \right], \qquad \epsilon_{ij}\sim N(0,\sigma^2). $$

For the basic model, random effects are independent across people; residuals are independent across visits and people conditional on the random effects; and residuals are independent of the random effects. The covariance matrix \(G\) must be positive semidefinite. These assumptions are modeling choices, not facts guaranteed by repeated measurement. In particular, the independent-residual assumption is a simplifying working model: additional residual serial dependence is a separate issue.

Interpreting the Trajectory and Its Covariance

For a particular person, the intercept is \(\beta_0+b_{0i}\), the expected outcome at time zero, and the time slope is \(\beta_1+b_{1i}\), the expected change in outcome per time unit. Thus \(b_{0i}\) is a deviation in outcome units, while \(b_{1i}\) is a deviation in outcome units per time unit. The random effects are deviations around the fixed-effects trajectory, not extra fixed covariates.

The random-effects covariance \(\tau_{01}\) describes how deviations in starting level and rate of change vary together. A negative value means that, in the modeled population, higher-than-average intercept deviations tend to accompany lower-than-average slope deviations. This is a distributional association, not evidence that starting level causes subsequent change.

The random effects also induce dependence among a person’s repeated outcomes. For two different visits \(j\) and \(k\), conditional independence of residuals gives the following marginal covariance:

$$ \begin{aligned} \operatorname{Cov}(Y_{ij},Y_{ik}) &=\operatorname{Cov}(b_{0i}+b_{1i}t_{ij},\,b_{0i}+b_{1i}t_{ik})\\ &=\tau_{00}+(t_{ij}+t_{ik})\tau_{01} +t_{ij}t_{ik}\tau_{11},\qquad j\ne k. \end{aligned} $$

This follows by expanding the covariance and using \(\operatorname{Var}(b_{0i})=\tau_{00}\), \(\operatorname{Cov}(b_{0i},b_{1i})=\tau_{01}\), and \(\operatorname{Var}(b_{1i})=\tau_{11}\). At a single visit, the marginal variance also includes residual variation:

$$ \operatorname{Var}(Y_{ij}) =\tau_{00}+2t_{ij}\tau_{01}+t_{ij}^{2}\tau_{11}+\sigma^2. $$

The covariance pattern therefore changes with time. A random intercept alone induces a constant shared component, whereas the random slope makes between-person variation depend on when the outcome is measured.

Worked Example: Computing Covariance From Random Trajectories

Suppose a hypothetical study measures a continuous score at baseline and two months. Time is measured in months, and the fitted random-effects covariance matrix is

$$ G=\begin{pmatrix}9&-1.2\\-1.2&0.64\end{pmatrix}, \qquad \sigma^2=4. $$

The intercept variance is \(9\) score-squared units, the intercept-slope covariance is \(-1.2\) score-squared per month, and the slope variance is \(0.64\) score-squared per month-squared. For baseline and month two, \(t_{ij}=0\) and \(t_{ik}=2\). Their covariance is

$$ \operatorname{Cov}(Y_{i0},Y_{i2}) =9+(0+2)(-1.2)+(0)(2)(0.64) =9-2.4=6.6\ \text{score}^2. $$

At baseline, the marginal variance is \(9+4=13\ \text{score}^2\). At month two, it is \(9+2(2)(-1.2)+(2^2)(0.64)+4=10.76\ \text{score}^2\). The negative intercept-slope covariance reduces the month-two variance here; the slope variance contributes \(2.56\ \text{score}^2\). These calculations describe the model’s implied variation, not separate empirical correlations at each visit.

Time Origin and Interpretation

The time origin determines the meaning of the intercept. If time zero is baseline, the intercept refers to baseline. If time is recentered, the fitted trajectories are unchanged, but the intercept and its covariance with the slope are re-expressed. This can make the intercept easier to interpret and can improve numerical stability when measurements occur far from time zero.

For a new origin \(c\), define \(t^*_{ij}=t_{ij}-c\), so \(t_{ij}=t^*_{ij}+c\). Substitution and collection of terms give

$$ \begin{aligned} Y_{ij} &=(\beta_0+c\beta_1)+( \beta_1)t^*_{ij}\\ &\quad +(b_{0i}+cb_{1i})+b_{1i}t^*_{ij}+\epsilon_{ij}. \end{aligned} $$

The new random intercept is \(b^*_{0i}=b_{0i}+cb_{1i}\), while the random slope remains \(b_{1i}\). Consequently, \(\operatorname{Var}(b^*_{0i})=\tau_{00}+2c\tau_{01}+c^2\tau_{11}\), and \(\operatorname{Cov}(b^*_{0i},b_{1i})=\tau_{01}+c\tau_{11}\). Centering time does not remove random slope variation; it changes which point on each trajectory is called its intercept.

Worked Example: Reading a Person-Specific Trajectory

Consider hypothetical outcome scores with time \(t\) measured in months. Suppose the fixed trajectory is \(50-2t\), and a particular person’s random-effect values are \(b_{0i}=4\) points and \(b_{1i}=-1\) point per month. Their conditional expected trajectory is

$$ E(Y_{ij}\mid b_{0i},b_{1i})=50-2t+4-t=54-3t. $$

At baseline (\(t=0\)), the person’s expected score is \(54\) points, four points above the population-average intercept of \(50\). At month two, it is \(54-3(2)=48\) points, compared with the fixed-effects value \(50-2(2)=46\) points. The person’s modeled slope is \(-3\) points per month: a decline of one additional point per month relative to the population-average slope. These are expected values conditional on the random effects; an observed score also contains residual variation.

Using Trajectories for Missing Visits

In chained-equation imputation, the conditional model for a repeated outcome should represent the dependence relevant to the data and the analysis. A random-trajectory model can use information from other visits to estimate a person’s trajectory and then predict an unobserved visit. The imputation must include uncertainty: filling every gap with a fitted conditional mean would create overly smooth data and understate variability.

For a proper stochastic imputation, a typical iteration draws model parameters, including variance components, and draws or updates person-specific random effects using the person’s observed outcomes and the current model. It then draws a missing outcome from its predictive distribution. This carries uncertainty in the fitted trajectory and the remaining visit-level variation into the completed data. The earlier material on drawing random effects for proper imputation and propagating uncertainty in variance components supplies the general draw-based principle; the key point here is that both trajectory components can inform the missing value.

Worked Example: Drawing a Missing Visit From a Trajectory

Suppose a hypothetical outcome model has fixed trajectory \(60-1.5t\), with time in months and score in points. During one imputation, assume a model-parameter draw and the person-effect draw based on that person’s observed visits give \(b_{0i}=-2\) points and \(b_{1i}=0.5\) point per month. Let the residual standard deviation for this draw be \(3\) points. The person’s conditional mean at a missing month-four visit is

$$ 60-1.5(4)-2+0.5(4)=54\ \text{points}. $$

A deterministic replacement would put exactly \(54\) points in the missing cell. Instead, suppose the residual draw is generated as \(3Z\), where \(Z\sim N(0,1)\), and the illustrative draw is \(Z=-0.4\). The imputed value is then

$$ 54+3(-0.4)=52.8\ \text{points}. $$

This single value is an illustrative stochastic imputation, not a prediction that the person’s true score was exactly \(52.8\). Across imputations, parameter and random-effect draws as well as residual draws should vary according to the fitted model. The observed visits contribute to the person-effect draw; the missing outcome is not treated as if its random effects were known without uncertainty.

Choosing the Random-Effects Structure

A random intercept and slope are not automatically preferable to every simpler model. The structure should reflect the scientific time scale, available repeated observations, and the amount of information in the data. The following alternatives make different assumptions:

ModelWhat varies between people?Implication for imputation
Random intercept onlyStarting level; common fixed time slopeAllows persistent person differences but cannot represent differing rates of change.
Random intercept and time slopeStarting level and rate of changeAllows person-specific linear trajectories, with their covariance modeled.
Fixed time effect with independent residualsNo modeled person-level trajectory deviationsCan inadequately represent within-person dependence and individual change patterns.

An unstructured \(G\) estimates the intercept variance, slope variance, and their covariance. A model that fixes the covariance to zero is more restrictive and is not merely a computational shortcut: it assumes that the two deviations are uncorrelated. With few people, few visits, or little spread in measurement times, slope variation and intercept-slope covariance may be weakly identified. A simpler random-intercept model can then be more stable, although it may fail to capture genuine heterogeneity in change.

For a linear random-slope model, examine whether the assumed mean trajectory is credible over the observed time range. Curvature, sharp phase changes, or treatment-specific trajectories may call for a richer fixed time structure or interactions. Adding a random linear slope does not itself model nonlinear mean change. Likewise, random slopes do not guarantee that the residual dependence assumption is adequate; additional serial residual structure is beyond this tutorial’s model.

Diagnostics, Failure Modes, and Limitations

Check both the fitted model and the completed imputations. Useful checks include whether estimated variance components are plausible, whether the random-effects covariance matrix is valid, and whether model fitting or chained-equation iterations show instability. Compare observed and imputed outcome distributions by visit and inspect whether imputed trajectories are implausibly smooth, steep, or dispersed. A systematic time pattern in residuals, or unexplained patterns in observed-minus-fitted outcomes, can signal that the linear trajectory or residual assumptions are inadequate.

  • Too little information for slopes. With only one observed visit for many people, individual slopes are largely informed by the population model rather than that person’s own history. Interpret the resulting imputations accordingly.
  • Unstable variance estimates. A slope variance near zero, a nearly singular \(G\), or unstable fitting across iterations can indicate that the data do not support the requested random-effects structure. Do not treat a numerical fit as proof that all components are well estimated.
  • Incorrect time coding. A slope is per unit of the time variable. Coding visits as 0, 1, 2 when the actual gaps are 0, 1, 12 months changes the assumed trajectory unless those numbers really represent the timing.
  • Overconfident deterministic fills. Conditional means omit predictive variation. Repeating them across completed data sets suppresses uncertainty and can distort later estimates.
  • Unaddressed model or missingness assumptions. A random trajectory does not by itself ensure an appropriate outcome distribution, account for every relevant auxiliary variable, or establish a missing-at-random assumption. The imputation model still needs to be scientifically defensible.

A common mistake is to say, “The random intercept already accounts for repeated measures, so adding a random slope is unnecessary.” A random intercept allows people to have different levels but imposes the same time slope on everyone. If rates of change differ and the data support estimating that variation, omitting the random slope can misrepresent dependence and the distribution of missing outcomes. Conversely, adding a slope when the data cannot identify it can make imputations unstable. The decision is a modeling choice to diagnose, not a universal rule.

Key takeaway: A random trajectory combines a population time trend with person-specific deviations in level and rate of change. For longitudinal imputation, use the person’s observed history to inform those deviations, and draw missing outcomes with predictive uncertainty rather than inserting fitted means alone.

Check Your Understanding

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

  1. In a random-intercept and random-slope model, what does \(b_{1i}\) add to the interpretation of person \(i\)’s time slope?
  2. Suppose \(\tau_{01}<0\). What association does this encode between intercept and slope deviations?
  3. At times \(t=0\) and \(t=3\), derive the covariance between two different outcomes for the same person from \(G\).
  4. Why is replacing every missing outcome with its conditional mean not equivalent to stochastic multiple imputation?
  5. A person has fixed trajectory \(40+2t\), with \(b_{0i}=-3\) and \(b_{1i}=-0.5\). What is the person’s expected outcome at \(t=4\)?

Solutions. (1) It is the person’s slope deviation in outcome units per time unit, so the person’s slope is \(\beta_1+b_{1i}\). (2) Higher intercept deviations tend to accompany lower slope deviations under the modeled random-effects distribution; this is association, not causation. (3) For \(t=0\) and \(t=3\), the formula gives \(\tau_{00}+3\tau_{01}+0\tau_{11}=\tau_{00}+3\tau_{01}\). (4) The conditional mean omits predictive variation; repeating it suppresses uncertainty and fails to generate a proper stochastic draw. (5) The person’s expected trajectory is \(40+2t-3-0.5t=37+1.5t\), so at \(t=4\) it is \(37+1.5(4)=43\) outcome units.

Clinical Biostats