From a Population Trend to One Subject’s Trajectory
A fitted longitudinal model describes both an average biomarker pattern and how individual subjects may depart from that pattern. A subject-specific prediction combines these pieces: the fixed effects give the model’s population-level trend, while the subject’s predicted random effects shift or reshape that trend. In joint modeling, this trajectory can later be used alongside event-time information, but the calculation here concerns the longitudinal model alone.
The central distinction is between predicting a subject’s latent mean trajectory and predicting a future observed biomarker value. The latent trajectory excludes measurement-level residual variation. A future observed value includes that variation, so its prediction interval is generally wider.
For example, with a linear time effect and a random intercept and slope, the model is
The subject-specific intercept is \(\beta_0+b_{0i}\), and the subject-specific slope is \(\beta_1+b_{1i}\). Thus, a positive predicted random intercept shifts the trajectory upward, while a positive predicted random slope makes it increase faster over time. If time has been centered, the intercept refers to the biomarker level at the centering time, not necessarily at time zero on the original scale.
How the Random-Effect Prediction Is Obtained
Assume the observed biomarker vector for subject \(i\) follows \(y_i=X_i\beta+Z_i b_i+\epsilon_i\). The standard Gaussian mixed-model assumptions for the calculation below are \(b_i\sim N(0,D)\), \(\epsilon_i\sim N(0,R_i)\), and independence of \(b_i\) and \(\epsilon_i\). Subjects’ random effects and residuals are independent across subjects. The covariance matrices \(D\) and \(R_i\) are assumed known for the derivation; in practice they are estimated from the data and substituted. The marginal covariance of \(y_i\) is \(V_i=Z_iDZ_i^\mathsf{T}+R_i\).
If \(\beta\) is treated as known, the conditional distribution of \(b_i\) given \(y_i\) is normal. Its mean is the BLUP and its covariance quantifies remaining uncertainty about the random effects:
In applications, \(\beta,D,\) and \(R_i\) are estimated. Replacing them with fitted estimates gives the empirical BLUP and a plug-in estimate of \(C_i\). The prediction is shrunk toward zero relative to the raw subject-specific residual pattern: subjects with little information, or whose measurements are noisy, tend to have more strongly shrunk random effects.
Calculating the Trajectory
Worked Example: Combining a Fitted Intercept and Slope
Suppose a fitted model for a hypothetical biomarker measured in mg/L has fixed intercept \(\hat{\beta}_0=10.0\) mg/L and fixed slope \(\hat{\beta}_1=0.50\) mg/L per year. For one subject, the predicted random intercept is \(\hat{b}_{0i}=0.60\) mg/L and the predicted random slope is \(\hat{b}_{1i}=-0.20\) mg/L per year. Time \(t\) is measured in years from baseline. Calculate the subject-specific predicted values at 0, 2, and 4 years.
The fitted subject-specific trajectory is
At baseline, \(\hat{\eta}_i(0)=10.60+0.30(0)=10.60\) mg/L. At 2 years, \(\hat{\eta}_i(2)=10.60+0.30(2)=11.20\) mg/L. At 4 years, \(\hat{\eta}_i(4)=10.60+0.30(4)=11.80\) mg/L. The subject’s predicted slope is \(0.30\) mg/L per year, lower than the population slope of \(0.50\) mg/L per year. These are fitted conditional means, not guaranteed measurements at those times.
The calculation uses the model’s chosen time basis and covariate values. With polynomial time effects, for instance, the appropriate powers of time must be included in \(x_i(t)\) and \(z_i(t)\). A categorical treatment or baseline covariate must also be set to the subject’s value. Substituting a time value into the wrong design vector, or mixing centered time with uncentered coefficients, changes the prediction.
Worked Example: Calculating a Shrunk Random-Intercept Prediction
Consider a hypothetical random-intercept model with fixed trajectory \(\hat{\mu}(t)=10+0.50t\) mg/L, random-intercept variance \(D=4\) \((\text{mg/L})^2\), and independent residual variance \(\sigma^2=1\) \((\text{mg/L})^2\). A subject has observations \(y=(10.5,12.5)^\mathsf{T}\) mg/L at times \(-1\) and \(1\) years. Treat the fitted fixed effects and variance components as known for this calculation. Find the predicted random intercept and the resulting predicted value at \(t=2\).
The fixed fitted means at the observed times are \(10+0.50(-1)=9.5\) mg/L and \(10+0.50(1)=10.5\) mg/L. Thus the residual vector from the fixed trajectory is
For a random intercept, \(Z_i\) is a two-entry vector of ones. With independent residuals, the BLUP is \(\hat{b}_{0i}=D\sum_j r_{ij}/(\sigma^2+2D)\). Substitution gives
At \(t=2\), the fixed fitted mean is \(10+0.50(2)=11.0\) mg/L. The subject-specific predicted mean is therefore \(11.0+1.333=12.33\) mg/L. The raw average residual is \(1.5\) mg/L, but the model shrinks the random-intercept prediction to \(1.333\) mg/L because the subject’s measurements are not perfectly precise.
Uncertainty at a Selected Time
Under the Gaussian assumptions and treating fitted parameters and \(\beta\) as known, the conditional distribution of the latent mean at a selected time is normal, with mean \(\hat{\eta}_i(t)\) and variance \(z_i(t)^\mathsf{T}C_i z_i(t)\). A plug-in standard error is therefore the square root of that variance. A conditional interval can be formed as the predicted mean plus or minus 1.96 standard errors. Because parameters are estimated in real analyses, such intervals are usually approximate unless parameter-estimation uncertainty is also incorporated.
For a future observed biomarker value, add the future residual variation when it is independent of the existing observations. With residual variance \(\sigma^2\), the prediction variance is \(z_i(t)^\mathsf{T}C_i z_i(t)+\sigma^2\). If residuals are correlated over time, the prediction must instead account for the covariance between the future residual and the observed residuals; simply adding \(\sigma^2\) may not be correct.
Worked Example: Uncertainty for a Random-Intercept Prediction
Continue the hypothetical model and subject from the previous example. Given the two measurements, the conditional variance of the random intercept is \(C_i=(1/D+2/\sigma^2)^{-1}\). Calculate an approximate 95% interval for the latent mean at \(t=2\), then a prediction interval for a future observed value. Treat the fitted fixed effects and variance components as known.
The conditional variance and standard error of the random intercept are
The latent mean prediction at 2 years is \(12.33\) mg/L. Since the random intercept is constant over time, its conditional uncertainty at this time has the same standard error. The approximate interval is \(12.33\pm1.96(0.6667)\), or \(12.33\pm1.307\), giving \(11.03\) to \(13.64\) mg/L. This quantifies uncertainty in the subject’s latent mean under the stated plug-in assumptions.
For a future measurement with independent residual variance \(1\) \((\text{mg/L})^2\), the prediction variance is \(0.4444+1=1.4444\), so the prediction standard error is \(\sqrt{1.4444}=1.202\) mg/L. The approximate prediction interval is \(12.33\pm1.96(1.202)\), or \(9.978\) to \(14.69\) mg/L. Its greater width reflects measurement-level residual variation in addition to uncertainty about the latent trajectory.
The preceding intervals condition on fixed-effect estimates as though they were known. To include their estimation uncertainty, a common plug-in prediction-error variance for the latent mean can be written using the full observation vector \(y\). Let \(V\) be its marginal covariance, \(X\) its fixed-effect design matrix, \(A=X^\mathsf{T}V^{-1}X\), \(c=\operatorname{Cov}(y,z_i(t)^\mathsf{T}b_i)\), \(v_{00}=\operatorname{Var}(z_i(t)^\mathsf{T}b_i)\), and \(a=x_i(t)^\mathsf{T}-c^\mathsf{T}V^{-1}X\). With known covariance parameters and generalized least squares for \(\hat{\beta}\), the prediction-error variance is
The first two terms are the conditional random-effect uncertainty; the final term accounts for estimating the fixed effects. In practice, covariance-parameter estimation adds further uncertainty. A parametric bootstrap that refits the model in each simulated data set is one way to capture these sources, provided the fitted model is an adequate description of the data.
Worked Example: Random-Intercept and Random-Slope Uncertainty
Suppose a hypothetical fitted model gives a subject’s predicted random effects \(\hat{b}_i=(0.40,-0.15)^\mathsf{T}\), with units mg/L and mg/L per year. At \(t=3\) years, let the fixed fitted mean be \(13.2\) mg/L. Suppose the conditional covariance matrix for the predicted random effects is
where the diagonal entries have the corresponding squared units. Calculate a conditional interval for the latent mean and a prediction interval for a future measurement if the independent residual standard deviation is \(0.50\) mg/L.
At 3 years the random-effect design vector is \(z_i(3)=(1,3)^\mathsf{T}\). The predicted latent mean is \(13.2+0.40+3(-0.15)=13.15\) mg/L. Its conditional variance is
Thus the standard error is \(\sqrt{0.93}=0.9644\) mg/L, and the approximate conditional interval is \(13.15\pm1.96(0.9644)\), or \(11.26\) to \(15.04\) mg/L. For a future observation, add the residual variance \(0.50^2=0.25\), giving variance \(1.18\) and standard error \(\sqrt{1.18}=1.086\) mg/L. The prediction interval is \(13.15\pm1.96(1.086)\), or \(11.02\) to \(15.28\) mg/L. Both intervals treat the supplied fixed effects and covariance estimates as known.
Diagnostics, Alternatives, and Limitations
A subject-specific prediction is useful when the scientific question concerns a particular subject’s biomarker course, rather than only the average course. It is also a model-based estimate, not a direct observation of a person’s true trajectory. Its reliability depends on the model’s mean structure, covariance assumptions, and the amount and timing of that subject’s data.
- Check the fitted model first. Residual patterns, influential subjects, weakly identified random slopes, or a singular fit can undermine predicted trajectories. Predictions far beyond a subject’s observed follow-up are especially sensitive to the assumed time trend.
- Check the scale and design vectors. Confirm time units, centering, covariate values, and the correct fixed- and random-effect terms before substituting into the prediction formula.
- Do not treat the predicted random effect as known. It is estimated with shrinkage. A trajectory drawn through observed values without accounting for residual noise is not the same as a fitted subject-specific mean.
- Separate the target quantities. A latent-mean interval excludes residual measurement noise; a future-observation prediction interval includes it. Calling the first a prediction interval for a future measurement understates uncertainty.
- Do not confuse empirical BLUPs with unshrunk individual fits. Estimating a separate intercept and slope from each subject’s data alone can be unstable when that subject has few observations. The mixed-model prediction uses information from the population distribution to stabilize those estimates.
A population-average prediction uses the fixed effects alone, \(x_i(t)^\mathsf{T}\hat{\beta}\), and answers a different question from the subject-specific prediction, which adds \(z_i(t)^\mathsf{T}\hat{b}_i\). Neither is universally preferable: the appropriate choice depends on whether inference concerns an average pattern or an individual trajectory. Both remain limited by the fitted model; a smooth-looking prediction does not verify that the assumed trajectory or residual structure is correct.
Check Your Understanding
Answer each question, then compare with the brief solutions below.
- A model has fixed mean \(8+0.4t\), predicted random intercept \(0.5\), and predicted random slope \(-0.1\). What is the predicted subject-specific mean at \(t=5\)?
- Why is a random-effect prediction generally shrunk toward zero compared with a subject’s raw average residual?
- If the conditional variance of a latent mean prediction is \(0.64\) \((\text{mg/L})^2\), and independent residual variance is \(0.36\) \((\text{mg/L})^2\), what are the standard errors for the latent mean and a future observation?
- Why can a prediction far beyond the observed follow-up be unreliable even when its calculation is straightforward?
- For a random intercept and slope, which vector should be used in the conditional variance calculation at time \(t\), and why?
Solutions. (1) The predicted intercept is \(8+0.5=8.5\), and the predicted slope is \(0.4-0.1=0.3\), so \(8.5+0.3(5)=10.0\) in the biomarker’s units. (2) The mixed model combines the subject’s noisy residual pattern with the population distribution of random effects; limited or noisy subject data provide less reason to depart from zero. (3) The latent-mean standard error is \(\sqrt{0.64}=0.80\) mg/L. The future-observation variance is \(0.64+0.36=1.00\), so its standard error is \(1.00\) mg/L. (4) The prediction extrapolates the assumed time trend beyond the data, where the trajectory form and covariance assumptions receive little empirical support. (5) Use \(z(t)=(1,t)^\mathsf{T}\), because the random intercept contributes once and the random slope contributes multiplied by time; the variance is \(z(t)^\mathsf{T}C_i z(t)\).