Why Matching the Display Matters
A residual plot can look better simply because its vertical axis is wider, its difficult observations are absent, or its residuals were computed from a different kind of prediction. In a nonlinear mixed-effects model (NLME), these choices matter especially because predictions may represent a typical subject or may use subject-specific random-effect estimates. A fair comparison of candidate fits therefore requires more than placing two plots side by side: the displays must use the same records, outcome scale, prediction target, residual definition, and axis limits.
This tutorial focuses on visual comparisons of residual and individual-fit displays. A matched display can reveal differences in patterns and fit, but it is not by itself a formal test or a complete model-selection procedure. Its value is that it prevents avoidable differences in plotting choices from being mistaken for evidence that one model fits better.
What Must Be Held Constant
Begin by defining the comparison target. For example, a plot might compare observed concentrations with population predictions, or it might compare them with individual predictions that use estimated subject-specific random effects. These answer different questions. Population predictions describe the model’s typical profile conditional on the included covariates; individual predictions also reflect estimated subject-level deviations. Use the same target for both candidate models and label it clearly. Comparing one model’s population predictions with another model’s individual predictions confounds model differences with prediction differences.
The observations also need to match. Construct the comparison from the same subjects and records, with the same handling of missing values and excluded records. If one model’s diagnostic output omits a record, determine why. A comparison based on different subsets does not isolate the effect of changing the model. This is particularly important when sampling is uneven across subjects: a plot with more records from some subjects can look different because those subjects contribute more points, not because the candidate model behaves differently for a typical subject.
Next, choose the outcome scale and residual definition. Raw residuals are in the outcome’s units, such as mg/L. If the outcome is displayed on a logarithmic scale, both models must use the same transformation, and the residuals must be defined consistently on that scale. A raw residual on the concentration scale and a difference on the log-concentration scale are not interchangeable quantities.
A model may also provide normalized residuals, formed by dividing a residual by a model-based estimate of its standard deviation. Such residuals can help assess patterns relative to the assumed observation error, but the denominator may differ between candidate models. Therefore, model-specific normalized residuals are useful for assessing each model against its own error assumptions; they are not automatically a common yardstick for comparing absolute errors. State what was scaled and, when useful, show a common-unit raw-residual display as well.
Worked Example: Comparing Raw Residual Magnitudes
Worked Example: Comparing Raw Residual Magnitudes
Suppose two hypothetical models are fitted to the same four concentration observations, and both use population predictions. The observed concentrations are \(5, 8, 4,\) and \(10\) mg/L. Model A predicts \(5.5, 8, 3,\) and \(11\) mg/L; Model B predicts \(6, 7.5, 2.5,\) and \(10.5\) mg/L. Compute the raw residuals and their root mean squared error (RMSE) for each model.
For each record, \(e_{ij}=y_{ij}-\hat y_{ij}\). Model A’s residuals are \(-0.5, 0, 1,\) and \(-1\) mg/L. Thus,
Model B’s residuals are \(-1, 0.5, 1.5,\) and \(-0.5\) mg/L. The squared residuals sum to \(1+0.25+2.25+0.25=3.75\), so
On these four records and this raw-residual definition, Model A has the smaller RMSE. A residual-versus-time plot could still reveal a systematic pattern that this single summary conceals. The visual comparison should therefore show both models on the same time and residual axes, with the same zero reference line and the same concentration units.
Justification for Matching the Records
RMSE is directly comparable across models only when it summarizes errors on the same outcome scale and the same observations. This follows from its definition: it averages squared residuals over the records included in the calculation. If the records change, the average changes both because the residuals may differ and because the set being averaged has changed.
where \(m\) is the number of included observations. With the same \(m\) records and the same residual units, the two RMSEs summarize squared errors on a common basis. If records differ, the resulting values describe different averages and may not support a direct model comparison. This does not make RMSE a complete measure of model adequacy; it only explains the conditions needed for this particular numerical comparison to be interpretable.
Worked Example: Detecting a Subset Mismatch
Consider five hypothetical concentration records. For the first four records, Model A has residuals \(0.2, 0.3, 0.1,\) and \(0.4\) mg/L. Model B has residuals \(0.5, 0.4, 0.6,\) and \(0.5\) mg/L. At the fifth record, Model A has a residual of \(2.0\) mg/L, while Model B’s diagnostic output is missing because that record was excluded from its output.
If Model A’s RMSE is calculated using all five records, its squared residuals sum to \(0.04+0.09+0.01+0.16+4.00=4.30\). Therefore, \(\operatorname{RMSE}_A=\sqrt{4.30/5}\approx0.9274\) mg/L. Model B’s four-record RMSE is \(\sqrt{(0.25+0.16+0.36+0.25)/4}=\sqrt{1.02/4}\approx0.5050\) mg/L. These values use different subsets, so they do not provide a fair comparison.
On the common first four records, Model A’s RMSE is \(\sqrt{0.30/4}\approx0.2739\) mg/L, whereas Model B’s is \(\sqrt{1.02/4}\approx0.5050\) mg/L. This matched comparison favors Model A for those four records only. The missing fifth Model B residual must be investigated; omitting it without explanation could hide an important difference. The conclusion is not that one calculation is universally correct, but that the comparison’s target and included records must be explicit.
Individual-Fit Displays and Prediction Definitions
An individual-fit display typically places observations and a model-predicted profile together for each subject. It is useful for seeing whether the model follows subject-specific profiles, especially when sampling is sparse. For model comparisons, make the panels use the same subjects, observations, time range, outcome scale, and prediction definition. Use a common vertical range across panels if the goal is to compare the magnitude of deviations visually; separately scaled panels may be helpful for inspecting each subject’s shape, but they do not support direct visual comparisons of absolute deviations.
Individual predictions often use estimated random effects for that subject, whereas population predictions do not. Because the individual predictions are informed by that subject’s data, they can appear closer to the observed points. That appearance should not be attributed solely to a better structural model if the other model’s display uses population predictions. Even when both displays use individual predictions, a closer in-sample fit is not, by itself, evidence of better performance for new subjects or future observations.
Worked Example: Matching the Prediction Target
For one hypothetical subject, suppose the observed concentrations at three times are \(4, 7,\) and \(5\) mg/L. Model A’s population predictions are \(3, 5,\) and \(4\) mg/L, while its individual predictions are \(3.8, 6.5,\) and \(4.8\) mg/L. Model B’s population predictions are \(3.5, 6,\) and \(4.5\) mg/L, while its individual predictions are \(3.9, 6.6,\) and \(4.9\) mg/L.
Using population predictions, Model A has residuals \(1,2,1\) mg/L and RMSE \(\sqrt{(1+4+1)/3}=\sqrt{2}\approx1.414\) mg/L. Model B has residuals \(0.5,1,0.5\) mg/L and RMSE \(\sqrt{(0.25+1+0.25)/3}=\sqrt{0.5}\approx0.7071\) mg/L.
Using individual predictions instead, Model A’s residuals are \(0.2,0.5,0.2\) mg/L, giving \(\sqrt{(0.04+0.25+0.04)/3}=\sqrt{0.11}\approx0.3317\) mg/L. Model B’s residuals are \(0.1,0.4,0.1\) mg/L, giving \(\sqrt{(0.01+0.16+0.01)/3}=\sqrt{0.06}\approx0.2449\) mg/L. Comparing Model A’s population RMSE with Model B’s individual RMSE would mix prediction targets and is not a fair comparison. Comparing like with like, Model B has the smaller RMSE in both sets of predictions for this subject. This small example does not establish a general advantage across subjects or a predictive-performance result.
Diagnostics, Alternatives, and Limitations
Before interpreting a matched display, check that its construction is internally consistent. Confirm the record count and subject identifiers in both panels; verify that the same transformation, residual sign convention, prediction target, and units were used; and inspect axis limits and reference lines. If a plot changes sharply after switching from a population to an individual prediction, note that change rather than attributing it to a model alteration. If normalized residuals are displayed, document the variance used for scaling and avoid implying that model-specific standardizations have identical denominators.
A matched residual-versus-time plot is useful for inspecting time-related structure, while observed-versus-predicted plots summarize agreement across the displayed observations. Individual profiles emphasize subject-level patterns. These displays complement one another: an overall plot can obscure a few poorly fit subjects, while selected individual profiles may not represent the full dataset. Numerical summaries such as RMSE can support a concise comparison, but they compress information and depend on the chosen records and scale. No single plot or summary should replace examination of the others when the question concerns different aspects of fit.
Visual diagnostics are descriptive. They do not, on their own, quantify uncertainty in a model comparison, establish that a discrepancy is statistically meaningful, or show how well a model will predict new data. They can also be affected by overplotting, unequal numbers of observations per subject, and choices about which subjects to display. Keep the full comparison’s scope clear, and use later inferential or predictive procedures when the question requires them.
Check Your Understanding
Answer each question, then compare with the short solutions below.
- Two raw-residual plots use the same records and units, but one has vertical limits of \(-1\) to \(1\) mg/L and the other \(-5\) to \(5\) mg/L. What is the problem?
- Why is it unfair to compare a candidate’s population-prediction residuals with another candidate’s individual-prediction residuals?
- State two conditions needed for a direct comparison of RMSE values.
- A model’s normalized residuals are divided by its own estimated observation standard deviations. What should be considered before comparing their magnitudes with those from another model?
Solutions. (1) The panels use different vertical scales, so equal visual distances do not represent equal residual magnitudes; use identical limits for direct visual comparison. (2) The prediction targets differ: individual predictions use subject-level information, so the comparison confounds model changes with prediction-definition changes. (3) At minimum, use the same observations and the same outcome scale and residual definition, with residuals in comparable units. (4) The standardization denominators may differ across models; explain the scaling and do not treat model-specific normalized residuals as a common absolute-error scale without justification.