Documentation

21.10 CWRES: conditional weighted residuals

CWRES uses a first-order conditional linearization at the subject’s conditional ETA estimate. nlmx documents the calculation as

L L' = G OMEGA G' + diag(V at eta-hat)
CWRES = L^-1 (DV - IPRED + G eta-hat)

The adjustment combines conditional predictions with the population random-effects structure. CWRES is designed to reveal population-model misspecification with better behavior than a simple individually weighted residual in nonlinear mixed-effects models.

nlmx provides two standard CWRES plots: versus time and versus PRED. Centering around zero, an approximately stable spread, and absence of systematic smooth trends are desirable. These properties are expectations, not rigid finite-sample guarantees. Sparse designs, repeated times, censoring, strong nonlinearity, and high shrinkage change the appearance.

Time and prediction axes reveal different failures

The Chapter 20 oral example’s CWRES-versus-time plot should be inspected for absorption-phase, peak, and terminal-phase patterns. Its residuals are generally centered, though the small synthetic dataset naturally has scatter and isolated values.

Verified CWRES versus time plot

A model can be flat against time but patterned against PRED, or vice versa. Always inspect both. Also compare CWRES with IWRES: large differences may reflect the covariance/linearization adjustment rather than a file inconsistency. For F_FLAG != 0 records, standard residuals are blank and those rows are excluded from the plot.

Common mistakes

  • Defining CWRES as IRES divided by residual SD.
  • Expecting exact standard normal behavior in every small dataset.
  • Looking only at time or only at PRED.
  • Interpreting blank CWRES on likelihood records as missing computation.
  • Applying universal numeric cutoffs without subject review.

Checklist

  • Confirm estimation and residual definitions.
  • Review CWRES against both time and PRED.
  • Inspect center, spread, tails, clusters, and smoother.
  • Compare with IWRES and raw residual findings.
  • Trace material values to source records and subjects.

Further reading

Continue with CWRES versus time, CWRES versus prediction, and Chapter 18’s residual theory.