Tutorials › Nonlinear Mixed-Effects Models (NLME) › Residuals Against Individual Predictions

Goodness-of-Fit Diagnostics and Their Pitfalls · Tutorial 545 of 797

Residuals Against Individual Predictions

Learn to interpret residual patterns against individual predictions while accounting for the data reuse and shrinkage inherent in empirical Bayes estimates.

Intermediate 12 min read

What You'll Learn

  • Define individual predictions and residuals based on empirical Bayes estimates.
  • Interpret trends and changing residual spread against individual predictions.
  • Derive how using the same observation to estimate an individual prediction creates residual–prediction dependence.
  • Calculate raw conditional residuals and standardized individual residuals.
  • Distinguish evidence of model misspecification from patterns induced by empirical Bayes estimation.
  • Choose complementary checks and recognize limitations of this diagnostic.

Why Plot Residuals Against Individual Predictions?

A residual-versus-prediction plot asks whether errors vary systematically with the level of a model's predictions. Against an individual's prediction, it can help reveal prediction-dependent bias or an inadequate residual-error model. But individual predictions are not independent reference values: they are calculated using empirical Bayes estimates informed by that individual's observations. The plotted horizontal and vertical coordinates are therefore linked, even when the model is correct.

This dependence changes how the plot should be read. A visible trend is a prompt to investigate, not by itself proof of misspecification; a flat-looking plot is not proof that the model is adequate. Interpretation should consider how the estimates were obtained and whether the pattern is larger than expected under the fitted model.

Definition and Model Setup

For individual \(i\) at observation time \(t_{ij}\), write the model prediction as \(f(t_{ij},\phi_i)\), where the individual parameter \(\phi_i\) depends on population parameters and the individual's random effects \(\eta_i\). An empirical Bayes estimate, denoted \(\hat{\eta}_i\), is estimated using that individual's observations along with the fitted population model. The individual prediction, often called IPRED, is the model prediction evaluated at that estimate.

Definition: The individual prediction for observation \(j\) from individual \(i\) is \(\mathrm{IPRED}_{ij}=f(t_{ij},\phi_i(\hat{\eta}_i))\). The raw individual conditional residual is \(e^I_{ij}=y_{ij}-\mathrm{IPRED}_{ij}\), where \(y_{ij}\) is the observed response. A standardized individual residual, often called IWRES, divides this residual by an appropriate conditional residual standard deviation. Positive residuals mean the observation exceeds the individual prediction; negative residuals mean it falls below it.

For example, if the observation model has conditional variance \(R_{ij}\), a simple standardized residual is \(e^I_{ij}/\sqrt{R_{ij}}\), with the variance evaluated according to the fitted error model. Some models require a more general calculation to account for correlated observations or transformations. The standardization convention must therefore match the model and software being used. Raw residuals retain the response units; standardized residuals are dimensionless.

The plot places IPRED on the horizontal axis and either \(e^I\) or IWRES on the vertical axis. Before interpreting it, check that the structural and residual-error models are plausible, that the estimation has converged, and that predictions and residuals were calculated consistently. A plot can flag a problem, but it cannot identify its cause on its own.

Why the Coordinates Are Dependent

A short Gaussian example makes the key issue precise. Suppose one individual has one observation and the model is \(Y=\mu+\eta+\varepsilon\), where \(\eta\sim N(0,\omega^2)\), \(\varepsilon\sim N(0,\sigma^2)\), and \(\eta\) and \(\varepsilon\) are independent. Assume \(\mu\), \(\omega^2\), and \(\sigma^2\) are known. Under this model, the conditional mean of \(\eta\) given \(Y=y\), which is also its conditional mode, is \(\lambda(y-\mu)\), where \(\lambda=\omega^2/(\omega^2+\sigma^2)\). This is the empirical Bayes estimate in this simple case.

$$ \widehat{\eta}=\lambda(y-\mu), \qquad \mathrm{IPRED}=\mu+\lambda(y-\mu), \qquad e^I=y-\mathrm{IPRED}=(1-\lambda)(y-\mu). $$

Eliminating \(y-\mu\) gives a direct relationship between the two plotted quantities:

$$ e^I=\frac{1-\lambda}{\lambda}(\mathrm{IPRED}-\mu), \qquad 0<\lambda<1. $$

Thus, even when the data come exactly from the assumed model, the raw residual tends to increase with IPRED in this one-observation example. The pattern is not evidence of a faulty model: the same observation moves both the estimated individual prediction and the residual. In more complex NLME models, the relationship need not be a straight line, but the underlying data reuse remains. The derivation assumes known population parameters and a Gaussian random effect and error; estimating population parameters adds further dependencies.

Worked Example: Quantifying the Dependence

Suppose the one-observation model above has population prediction \(\mu=10\) mg/L, random-effect variance \(\omega^2=4\), residual variance \(\sigma^2=1\), and observed concentration \(y=13\) mg/L. Calculate the shrinkage weight, IPRED, and raw residual.

Calculate the weight. Here \(\lambda=4/(4+1)=0.8\). The observation's deviation from the population prediction is \(13-10=3\) mg/L, so \(\hat{\eta}=0.8(3)=2.4\) mg/L.

Calculate IPRED and residual. IPRED is \(10+2.4=12.4\) mg/L. The raw residual is \(13-12.4=0.6\) mg/L. Since the residual standard deviation is \(\sqrt{1}=1\) mg/L, the standardized residual is \(0.6/1=0.6\).

The positive residual accompanies an IPRED above \(\mu\). In fact, the derived slope is \((1-0.8)/0.8=0.25\): for each 1 mg/L increase of IPRED above 10 mg/L, the raw residual increases by 0.25 mg/L in this model. This is a consequence of using \(y\) to estimate IPRED, not evidence on its own of systematic underprediction.

Reading the Plot Carefully

A useful plot displays residuals against IPRED with a horizontal reference at zero. Look for sustained departures from zero, curvature, or a change in spread over the prediction range. A smooth increase or decrease may be compatible with prediction-dependent bias, but the empirical Bayes dependence just derived can also produce a trend. Increasing spread may suggest an error variance that depends on response magnitude, but it can also reflect differences in observation precision or how residuals were standardized.

The plot is most informative when interpreted alongside the model's assumptions and a reference for patterns expected under those assumptions. A practical option is a simulation-based check: simulate datasets from the fitted model, refit the model using the same procedure, recalculate empirical Bayes estimates and residuals, and compare the resulting plots with the observed one. Refitting matters because it reproduces some of the estimation and data-reuse effects. A pattern outside the simulated range is more concerning than one commonly produced by the fitted model, though simulation checks still depend on the model used to generate the reference.

Worked Example: Calculating Conditional Residuals

In a hypothetical dataset, an individual has an observed concentration of 8.4 mg/L. The fitted individual prediction is 7.5 mg/L, and the conditional residual standard deviation at that prediction is 1.2 mg/L. Calculate and interpret the raw and standardized individual residual.

The raw residual is \(8.4-7.5=0.9\) mg/L. The standardized residual is \(0.9/1.2=0.75\). The observation is 0.9 mg/L above its individual prediction, or 0.75 conditional residual standard deviations above it.

On the plot, this point has horizontal coordinate 7.5 mg/L and vertical coordinate 0.75 if IWRES is used. It is one positive residual, not by itself a pattern. A collection of residuals is needed to assess whether errors systematically vary across the range of individual predictions.

Worked Example: Investigating an Apparent Trend

Consider four hypothetical observations with conditional residual standard deviations of 0.5 mg/L. Their individual predictions and raw residuals are shown below. Calculate IWRES and compare the lower- and higher-prediction groups.

IPRED (mg/L)Raw residual (mg/L)IWRES
2-0.60-1.20
4-0.35-0.70
60.300.60
80.551.10

For each row, IWRES is the raw residual divided by 0.5 mg/L. For example, at IPRED 2 mg/L, \(-0.60/0.5=-1.20\); at IPRED 8 mg/L, \(0.55/0.5=1.10\). The mean IWRES for the two lower predictions is \((-1.20-0.70)/2=-0.95\). For the two higher predictions it is \((0.60+1.10)/2=0.85\). The difference is \(0.85-(-0.95)=1.80\).

These hypothetical points show a marked increasing pattern, worth investigating. They do not establish misspecification: as the Gaussian derivation illustrates, data reuse can generate positive residual–prediction association. A useful next step is to compare this pattern with plots from simulations that reproduce the fitting procedure, and to check whether a similar structure appears in complementary diagnostics. The four-point group difference is descriptive, not a calibrated significance test.

What This Diagnostic Can and Cannot Establish

Residuals against individual predictions focus on whether conditional discrepancies depend on the fitted level for each individual. They differ from residuals against population predictions, whose horizontal coordinate does not use that individual's empirical Bayes estimate in the same direct way. The population-prediction plot can be a useful complement, while the individual-prediction plot can show how well the model fits after individual-level adaptation. Neither plot is a stand-alone test of model adequacy.

A recurring pattern may motivate checking the structural model or the residual-error specification, but this plot alone cannot distinguish those explanations. Nor does a small residual necessarily imply strong evidence that the individual's parameters are well determined: an empirical Bayes estimate can adapt toward the observations, especially when individual information is limited. Accordingly, do not interpret residuals as independent observations or apply a simple regression p-value as if the horizontal coordinates were fixed independently of the data.

The main limitation is that individual predictions are partly fitted to the observations being assessed. Sparse data, strong shrinkage, nonlinear estimation, and misspecified error variance can all complicate interpretation. A sensible reading combines the plot with the model assumptions, other residual displays, and checks that account for the full estimation procedure.

Common Mistake

  • Wrong reasoning: “The residuals rise with IPRED, so the model must systematically underpredict at high concentrations.”
  • Correction: The same observations help determine both IPRED and the residual. In a correctly specified one-observation Gaussian example, this alone creates an increasing relationship. Treat the pattern as a diagnostic signal to investigate, and compare it with what the fitted model and estimation procedure would produce under simulation.
  • Wrong reasoning: “The residuals are close to zero, so the model is adequate.”
  • Correction: Empirical Bayes estimates are informed by the observations and can pull individual predictions toward them. Small residuals do not replace checks of the structural model, error assumptions, or residual patterns.
Key takeaway: A residual-versus-IPRED plot can reveal prediction-dependent structure, but residuals and individual predictions are linked because they reuse the same observations. Interpret patterns in that light and seek corroboration rather than treating the plot as a formal, independent test.

Check Your Understanding

Answer each question, then check the concise solutions below.

  1. An observation is 5.7 mg/L and its individual prediction is 6.2 mg/L. What is the raw residual, and what does its sign mean?
  2. In the one-observation Gaussian model, \(\omega^2=3\) and \(\sigma^2=1\). Find \(\lambda\) and the slope of raw residual against IPRED.
  3. Why can a positive trend in raw residuals against IPRED occur even when the model is correct?
  4. Why is a simple regression p-value for residuals on IPRED not automatically a valid test of model adequacy?

Solutions. (1) \(5.7-6.2=-0.5\) mg/L; the observation is 0.5 mg/L below its individual prediction. (2) \(\lambda=3/(3+1)=0.75\), so the slope is \((1-0.75)/0.75=1/3\). (3) The same observation contributes to the empirical Bayes estimate used for IPRED and to the residual, inducing dependence. (4) The horizontal values are not independent of the residuals, and the standard regression reference distribution does not automatically account for this fitting and data reuse.