Tutorials › Nonlinear Mixed-Effects Models (NLME) › Reference Distributions For CWRES And IWRES

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

Reference Distributions For CWRES And IWRES

You will learn the assumptions behind the standard normal reference for CWRES and IWRES, and how to interpret that reference cautiously when individual effects and population parameters are estimated.

Intermediate 9 min read

What You'll Learn

  • State the model conditions that support an approximate standard normal reference for CWRES.
  • Distinguish the residual-error standardization in IWRES from covariance whitening in CWRES.
  • Explain how empirical Bayes estimation and sparse individual data can narrow IWRES.
  • Work through scalar standardization and a correlated-residual whitening calculation.
  • Interpret departures from the reference without treating normality as a test of the full NLME model.

Why a Reference Distribution Needs Conditions

A standardized residual is often compared with a standard normal distribution, but standardization alone does not guarantee a standard normal result. The comparison is useful only when the model, the variance used to standardize, and the way predictions were estimated support that reference. In nonlinear mixed-effects models (NLME), this distinction matters because predictions may use estimated individual random effects, and an individual may contribute very few observations.

CWRES and IWRES are both residual diagnostics, but they use different standardizations. IWRES scales a residual by the observation-error standard deviation at an individual prediction. CWRES aims to account for the covariance of a subject's residual vector, including dependence induced by uncertain individual effects in the applicable approximation. Their normal references therefore have different conditions and limitations.

Model and reference: Let \(y_{ij}\) be the observation for individual \(i\) at observation \(j\), and let \(f_{ij}(\theta,\eta_i)\) be the model prediction, with population parameters \(\theta\) and individual random effects \(\eta_i\). A common model assumes \(\eta_i\sim N(0,\Omega)\) and, conditional on \(\eta_i\), observation errors have mean zero and covariance \(R_i\). A standard normal reference is justified only approximately when the model is correctly specified, the relevant variances are correctly represented, and prediction and estimation effects are adequately handled.

For an individual, collect the observations into a vector \(y_i\). A conditional prediction uses an estimate \(\hat\eta_i\), often an empirical Bayes estimate, and the corresponding residual vector is \(d_i=y_i-f_i(\hat\theta,\hat\eta_i)\). The fitted residual is not generally the same as an observation error evaluated at the unknown true \(\eta_i\). That difference is central to interpreting both residual types.

What the Two Residuals Standardize

An IWRES is a componentwise, individual weighted residual. In a simple case with conditionally independent observation errors, its value is the residual from the individual prediction divided by the conditional observation-error standard deviation. If the true individual effect were known, the residual model were correct, and the error were Gaussian, this standardized error would have a standard normal distribution. In practice, \(\hat\eta_i\) is estimated from the same subject's observations, so this ideal argument does not automatically apply to fitted IWRES.

A CWRES is intended to whiten the residual vector: it transforms the vector using its covariance, rather than dividing each component only by its own observation-error standard deviation. In common implementations, that covariance is obtained using a local approximation to the nonlinear model and an approximation to the uncertainty contributed by individual effects. Details vary across software and estimation methods; the implementation's definition should be checked before interpreting values.

Definition: In a common covariance-whitening representation, let \(C_i\) be the covariance matrix used for the fitted residual vector \(d_i\), and let \(L_i\) be its lower-triangular Cholesky factor, so \(C_i=L_iL_i^{T}\). The CWRES vector is \(L_i^{-1}d_i\). If \(d_i\) is approximately multivariate normal with mean zero and covariance \(C_i\), then the whitened vector is approximately multivariate normal with mean zero and identity covariance. Its components therefore have approximate \(N(0,1)\) marginal distributions.

The matrix condition matters. Dividing every residual by its own marginal standard deviation can give components with unit variance while leaving correlation between them. A covariance-whitening transformation addresses both the scale and the correlation, provided the covariance approximation is suitable. For nonlinear models, linearization and estimated parameters mean that the resulting normality is an approximation, not an exact finite-sample guarantee.

Worked Examples

Worked Example: Interpreting One IWRES

Suppose a hypothetical concentration observation is \(1.2\) mg/L above its individual prediction. At that prediction, the assumed conditional observation-error standard deviation is \(0.6\) mg/L. The individual effect is treated as known for this calculation, and the conditional error is assumed to be Gaussian with mean zero and the stated standard deviation.

The IWRES is the residual divided by its standard deviation:

$$ \mathrm{IWRES}=\frac{1.2\ \mathrm{mg/L}}{0.6\ \mathrm{mg/L}}=2.00. $$

The units cancel, so IWRES is dimensionless. Under the stated ideal conditions, a value of \(2.00\) is two standard deviations above the prediction. For a single standard normal draw, the two-sided reference probability of a value at least this far from zero is approximately \(P(|Z|\geq 2)=0.0455\), where \(Z\sim N(0,1)\). This is a reference-tail calculation, not a p-value proving model failure. The calculation also does not account for the fact that real individual effects and population parameters are estimated.

Worked Example: Whitening Correlated Residuals

Consider a hypothetical subject with residual vector \(d_i=(2,1)^T\) in arbitrary measurement units. Suppose a local covariance approximation is

$$ C_i= \begin{pmatrix} 4&1\\ 1&1 \end{pmatrix}, \qquad L_i= \begin{pmatrix} 2&0\\ 0.5&\sqrt{0.75} \end{pmatrix}, \qquad C_i=L_iL_i^T. $$

To find the CWRES vector \(z_i=L_i^{-1}d_i\), solve \(L_i z_i=d_i\). The first row gives \(2z_{i1}=2\), so \(z_{i1}=1\). The second row gives \(0.5(1)+\sqrt{0.75}z_{i2}=1\), hence

$$ z_{i2}=\frac{1-0.5}{\sqrt{0.75}}=\frac{0.5}{0.8660}=0.5774. $$

Thus the whitened residual vector is approximately \((1.00,0.5774)^T\). The original residual components were correlated under \(C_i\); the transformation uses that covariance rather than treating the two residuals as unrelated. The values are not proof that the covariance model is correct: the standard normal reference applies only if the residual vector's mean and covariance are adequately represented and the approximation used to obtain \(C_i\) is reasonable.

Worked Example: Why Sparse Data Can Narrow IWRES

Consider a deliberately simple hypothetical random-intercept model with one observation per individual: \(y_i=\eta_i+\epsilon_i\), where \(\eta_i\sim N(0,1)\) and \(\epsilon_i\sim N(0,1)\) are independent. The observation-error standard deviation is one unit. The posterior mean, or empirical Bayes estimate, of \(\eta_i\) given \(y_i\) is \(\hat\eta_i=y_i/2\). The fitted residual is therefore

$$ y_i-\hat\eta_i=y_i-\frac{y_i}{2}=\frac{y_i}{2}. $$

Because \(y_i=\eta_i+\epsilon_i\), its variance is \(1+1=2\). Thus the fitted residual has variance

$$ \operatorname{Var}\left(\frac{y_i}{2}\right) =\frac{1}{4}\operatorname{Var}(y_i) =\frac{2}{4}=0.5. $$

If IWRES divides this fitted residual by the observation-error standard deviation of one, its variance remains \(0.5\), and its standard deviation is \(\sqrt{0.5}=0.7071\), not one. In this example, the individual effect estimate uses the sole observation, pulling the fitted prediction toward that observation and shrinking the residual. This calculation illustrates why sparse data can undermine a standard normal reference for fitted IWRES. It is a simplified illustration, not a universal formula for IWRES or CWRES in a nonlinear model.

Justifying the CWRES Reference

The core justification is a standard result for a correctly specified multivariate normal vector. Suppose, for the moment, that \(d_i\sim N(0,C_i)\), where \(C_i\) is known and positive definite. With \(C_i=L_iL_i^T\), define \(z_i=L_i^{-1}d_i\). Then

$$ E(z_i)=L_i^{-1}E(d_i)=0, \qquad \operatorname{Cov}(z_i) =L_i^{-1}C_i(L_i^{-1})^T =L_i^{-1}L_iL_i^T(L_i^{-1})^T=I. $$

A linear transformation of a multivariate normal vector remains multivariate normal. Therefore \(z_i\sim N(0,I)\), and each component has a standard normal distribution. This derivation also shows exactly what must be true: the residual vector must have the specified mean and covariance, and the transformation must use that covariance. In NLME practice, the residual vector is constructed from fitted predictions and \(C_i\) is approximated, so the result supports a reference, not an exact law.

The approximation is more credible when the structural and residual models are adequate, the random-effects distribution is represented reasonably, the covariance matrix is well estimated, and local linearization of the nonlinear predictions is adequate. It can be less credible with strong nonlinearities, very sparse observations, large or poorly identified individual effects, boundary estimates, or a small number of individuals. Estimation of \(\theta\), variance parameters, and \(\eta_i\) adds uncertainty and can induce dependence among residuals; treating all fitted residuals as independent standard normal draws ignores these effects.

Interpreting Departures and Comparing References

A departure from the standard normal reference is a prompt to investigate, not a model test. A nonzero residual center, unusually heavy tails, skewness, or an unexpectedly narrow spread can arise from misspecification, but also from estimation, limited sample size, an imperfect covariance approximation, or the composition of the pooled observations. Conversely, residuals that look approximately normal do not establish that the structural model, covariate relationships, or random-effects assumptions are correct. Normality of a residual summary is only one aspect of model evaluation.

Do not treat every observation-level residual as an independent replicate. Measurements from the same individual share estimated effects and may remain dependent, while subjects can have different numbers and timings of observations. Consequently, apparent departures in a pooled set can reflect repeated-measures structure or the mix of designs, and a conventional calculation that assumes an independent sample of residuals may overstate the evidence.

Residual referenceWhat it scales or accounts forKey caution
IWRESConditional residual divided by observation-error standard deviation at an individual predictionFitted individual effects may shrink residuals, especially with sparse data.
CWRESResidual vector transformed using an approximate covariance matrixThe covariance and linearization are approximate, and estimation uncertainty remains.
Raw or weighted residualsUnstandardized discrepancy or a simpler observation-error scalingThese do not, by themselves, have a universal standard normal reference.

A practical interpretation starts by confirming the software definition and the assumed residual model, then asking whether the data support the estimation of individual effects and covariance parameters. A large individual residual is a localized discrepancy worth understanding; a systematic distributional departure across many subjects may be more informative, but still needs to be evaluated in context. The later material on residual patterns by time, prediction, and other design features addresses where departures occur; the reference distribution alone does not identify their cause.

Common Mistakes and Limitations

  • Assuming standardization guarantees normality. Dividing by a standard deviation gives a dimensionless value; it does not make a nonnormal error or fitted residual normal.
  • Applying the same conditions to IWRES and CWRES. IWRES uses conditional observation-error scaling. CWRES uses a covariance transformation intended to account for residual-vector covariance. Neither eliminates all estimation effects.
  • Interpreting each residual as an independent normal draw. Within-individual observations and residuals affected by common parameter estimates need not be independent.
  • Calling a normal-looking residual distribution proof of model validity. It does not verify the structural model, random-effects distribution, covariate specification, or predictive performance.
  • Treating a departure as a formal rejection. A reference distribution is a diagnostic benchmark. Formal inference requires a specified test and a justified sampling distribution, not simply comparison with a normal curve.

The standard normal reference remains useful because it gives residuals a common scale and a clear benchmark: zero is the expected center, and one is the reference standard deviation. Its value depends on keeping the approximation visible. Sparse designs and estimated individual effects are not minor details; they can change the distribution being compared.

Check Your Understanding

Answer each question using the assumptions and distinctions developed above. Brief solutions follow the questions.

  1. If a residual vector has covariance \(C_i\) and \(C_i=L_iL_i^T\), what transformation gives unit covariance under the multivariate normal reference?
  2. Why might fitted IWRES be narrower than a standard normal distribution when each individual has very few observations?
  3. In the sparse-data example, what is the variance of the fitted residual \(y_i-\hat\eta_i\), and what is its standard deviation after division by the observation-error SD of one?
  4. Does an approximately standard normal CWRES distribution establish that the NLME structural model is correct? Explain.

Solutions. (1) Use \(z_i=L_i^{-1}d_i\); its covariance is \(L_i^{-1}C_i(L_i^{-1})^T=I\). (2) The same observations help estimate the individual effects used in the predictions, pulling fitted predictions toward the observations and shrinking residuals; sparse data can make this effect substantial. (3) The variance is \(0.5\), and the standard deviation after division by one remains \(\sqrt{0.5}=0.7071\). (4) No. Approximate normality is only one diagnostic feature and does not verify the structural model or other assumptions; it is a reference comparison, not a test of overall model validity.