Tutorials › Nonlinear Mixed-Effects Models (NLME) › Residual Diagnostics for Developmental Scaling

Allometric Scaling and Maturation Functions · Tutorial 394 of 797

Residual Diagnostics for Developmental Scaling

Use age- and weight-stratified residual diagnostics to identify systematic developmental patterns that an allometric and maturation model may not capture.

Intermediate 11 min read

What You'll Learn

  • Define raw and standardized residuals for developmental scaling diagnostics.
  • Choose predictions that match the population-level or individual-level diagnostic question.
  • Calculate and interpret mean residuals within age and weight bands.
  • Recognize how covariate overlap affects age- and weight-stratified interpretations.
  • Distinguish a remaining mean trend from a change in residual variability.
  • Identify when residual plots point to a model limitation rather than a specific correction.

Why Stratify Residuals by Age and Weight?

An allometric function describes how a parameter changes with body size, while a maturation function describes its change with developmental age. After combining these functions, the fitted model should account for systematic changes in the response that those functions were intended to represent. Residual plots provide a direct check: do observations still tend to fall above or below the model’s predictions at particular ages or weights?

A trend in residuals does not, by itself, prove which part of the model is inadequate. Age and weight often change together during development, so a pattern seen against age could also reflect an unaccounted weight pattern, and vice versa. Stratified plots help describe the evidence, but interpretation also depends on whether the data cover comparable ages and weights.

Definition: For observation \(j\) from individual \(i\), let \(y_{ij}\) be the observed response and \(\hat{\mu}_{ij}\) the model prediction chosen for the diagnostic. The raw residual is \(e_{ij}=y_{ij}-\hat{\mu}_{ij}\). A positive residual means the observation is above the prediction (the model underpredicted); a negative residual means it is below the prediction (the model overpredicted). A standardized residual divides the raw residual by an appropriate estimate of its standard deviation, so its scale is comparable across observations.

The prediction must match the question. A population-level diagnostic assesses whether the model’s predicted response across individuals is appropriate at different ages and weights. For a nonlinear model, the population mean prediction is generally the prediction averaged over the random-effects distribution; it need not equal the prediction for a hypothetical individual with all random effects set to zero. An individual-level diagnostic instead uses predictions conditional on estimated individual effects. Because those effects are estimated using the individual’s observations, conditional residuals can look smaller and may conceal a population-level pattern. State which prediction and residual definition were used, and interpret the plot accordingly.

Raw residuals retain the response’s units, which can make their size meaningful. Standardized residuals are often more useful when residual variability differs with the predicted response or across observations. In a simple model with constant residual standard deviation \(\sigma\), a conditional standardized residual is \(e_{ij}/\sigma\). In more complex NLME models, use a standardization appropriate to the prediction and residual-error model; there is no single denominator that is correct for every model.

What a Residual Trend Means

The basic justification is the conditional mean property of a correctly specified response model. Suppose the model predicts the appropriate conditional mean given the covariates used for the diagnostic. If the model is correct, the expected residual at those covariates is zero:

$$ E(e_{ij}\mid \text{age}_{ij},\text{weight}_{ij}) = E(y_{ij}-\hat{\mu}_{ij}\mid \text{age}_{ij},\text{weight}_{ij}) = 0. $$

The equality follows because the prediction is the conditional expectation: \(E(y_{ij}\mid \text{age}_{ij},\text{weight}_{ij})=\hat{\mu}_{ij}\). If the model systematically underpredicts at a certain age range, observations in that range tend to have positive residuals; if it overpredicts, they tend to have negative residuals. In finite data, residuals will not average exactly to zero. The diagnostic question is whether their pattern is larger or more organized than would be expected from ordinary sampling and residual variation.

Plot residuals against continuous age and weight as well as examining age- and weight-stratified summaries. A smooth curve can reveal gradual structure that arbitrary bands obscure. Bands, in turn, make it easier to compare mean residuals across developmental ranges and to see how much data support each summary. Choose bands that are clinically interpretable and sufficiently populated; report the number of observations in each band.

Worked Example: Age-Stratified Residuals

Suppose a hypothetical model predicts a clearance-related response for three observations in each of three age bands. The following values are standardized residuals, calculated from the same fitted model and defined as observed minus predicted, divided by the appropriate residual standard deviation.

Age band (years)Standardized residualsMean residual
0–2−0.8, −0.4, −0.6?
2–80.1, 0.0, −0.2?
Over 80.7, 0.5, 0.8?

For ages 0–2, the mean is \((-0.8-0.4-0.6)/3=-1.8/3=-0.600\). For ages 2–8, it is \((0.1+0.0-0.2)/3=-0.1/3=-0.0333\). For ages over 8, it is \((0.7+0.5+0.8)/3=2.0/3=0.667\).

The means move from negative to positive with age. In this hypothetical sample, the model tends to overpredict at younger ages and underpredict at older ages. That pattern warrants checking the continuous residual-versus-age plot and the age coverage before drawing a conclusion. Three observations per band provide limited evidence; the trend is a diagnostic signal, not proof that a particular maturation function or parameter should be changed.

Weight-Stratified Checks and Covariate Overlap

A weight-stratified plot asks whether the fitted model leaves a systematic response pattern across body size. For example, positive mean residuals at lower weights and negative means at higher weights indicate underprediction at the lower end and overprediction at the upper end. This could be consistent with an inadequate allometric size relationship, but it is not uniquely diagnostic of that explanation. It could also arise because age and weight are distributed differently across the bands, or because the residual scale is misspecified.

Age and weight should therefore be examined together in the data, even when the primary plots are one covariate at a time. If nearly all young individuals have low weights and nearly all older individuals have high weights, separate plots cannot cleanly distinguish an age-related pattern from a weight-related one. Where there is adequate overlap, compare residual patterns across age within similar weight ranges and across weight within similar age ranges. If there is little overlap, describe that limitation rather than claiming the plots identify which developmental component is responsible.

Worked Example: Weight-Stratified Residuals

For nine hypothetical observations, suppose standardized residuals fall into three weight bands, with three observations in each band. All residuals use observed minus predicted as the sign convention.

Weight band (kg)Standardized residualsMean residual
Under 100.6, 0.4, 0.5?
10–250.1, −0.1, 0.0?
Over 25−0.5, −0.4, −0.6?

The means are \((0.6+0.4+0.5)/3=1.5/3=0.500\), \((0.1-0.1+0.0)/3=0/3=0.000\), and \((-0.5-0.4-0.6)/3=-1.5/3=-0.500\), respectively.

Thus, the model underpredicts on average in the lowest weight band and overpredicts in the highest. This orderly change is a reason to inspect the continuous residual-versus-weight plot and the age distribution within each weight band. It may motivate re-evaluation of the size relationship, but the plot alone does not establish that an allometric exponent is the cause. In particular, if the low-weight observations are mostly young and the high-weight observations mostly older, the apparent weight trend may reflect a remaining age pattern or their combination.

Worked Example: Interpreting Age Patterns Within Weight Bands

Consider a hypothetical set of observations with overlapping ages and weights. For simplicity, each cell contains two standardized residuals. The table reports the mean residual in each age-by-weight cell.

Lower weight bandHigher weight band
Younger age band0.40.1
Older age band0.1−0.2

Within the lower weight band, the mean changes from 0.4 in the younger group to 0.1 in the older group, a change of \(0.1-0.4=-0.3\). Within the higher weight band, it changes from 0.1 to −0.2, also a change of \(-0.2-0.1=-0.3\). The same direction of change across both weight bands is consistent with a residual age pattern that is not explained solely by the difference between the two weight bands.

There is also a weight pattern in these cell means: within the younger group the higher-weight mean is \(0.1-0.4=-0.3\) lower, and within the older group it is \(-0.2-0.1=-0.3\) lower. Thus these hypothetical data suggest patterns along both dimensions. The calculation does not establish a causal effect or identify a unique model revision. It is a descriptive diagnostic, and its strength depends on the number and distribution of observations within each cell.

Practical Reading of the Plots

A useful diagnostic set includes residuals against age, residuals against weight, and, where data support it, summaries that compare age patterns within weight ranges or weight patterns within age ranges. Use the same residual definition consistently across these displays. Include a horizontal zero reference for residuals and show the data density or stratum counts; a smooth fitted through a sparse tail can look more certain than the data justify.

  • Changing mean residual: a sustained positive-to-negative or negative-to-positive pattern suggests systematic underprediction or overprediction across the covariate range.
  • Changing spread: residuals that fan out or contract while their center remains near zero suggest that the residual variability may be inadequately described. A mean-trend plot alone cannot diagnose the variance structure.
  • Isolated extremes: a few large residuals may be influential observations, data issues, or expected tail values. Check records and context before attributing them to developmental structure.
  • Uneven coverage: a pattern in a region with very few observations is uncertain. Show counts and avoid interpreting empty or sparse age-weight combinations as evidence of no trend.

Repeated observations from one individual are not independent replicates. A band containing many measurements from a few individuals may provide less information about a population-level pattern than the raw count suggests. Examine how observations are distributed across individuals, and avoid treating a simple average residual or a conventional independent-observation test as definitive evidence. Residual plots are primarily diagnostic; formal uncertainty calculations must respect the NLME structure.

Alternatives, Limitations, and Common Pitfalls

A continuous residual plot retains detail and can show nonlinear patterns, but may be hard to read when observations overlap. Binned means are easier to summarize but depend on the chosen cut points and can hide within-band trends. Both views can be informative when presented with counts and an indication of uncertainty. Simulation-based residual diagnostics offer another way to compare observed data with model-generated behavior, particularly when residual distributions are complex, but they do not remove the need to inspect whether age and weight are adequately represented.

The most important limitation is that residual patterns do not uniquely identify model corrections. A pattern may reflect an inadequate mean function, residual variability, covariate imbalance, an influential record, or an unsuitable prediction type for the question. A good diagnostic sequence is to verify the data and residual construction, inspect both covariates and their overlap, then assess whether the pattern is coherent and supported by enough observations. Any proposed model change should be checked against the same diagnostics and the model’s physiological rationale.

  • Mistake: “The positive residuals prove maturation is too weak.” Positive residuals mean underprediction in those observations, but do not distinguish a maturation issue from weight imbalance, an error-model issue, or another source of misspecification. Check the weight-stratified and joint patterns before attributing the trend.
  • Mistake: “The binned means are close to zero, so the model is correct.” Opposing residual patterns can cancel within a wide band. Inspect continuous plots and use bands narrow enough to reveal interpretable structure without creating unsupported summaries.
  • Mistake: “Every standardized residual should be between −2 and 2.” Standardization does not impose a hard bound. Some values will lie outside that range, especially in small or variable data sets; interpret their pattern and context rather than applying a mechanical cutoff.
Key takeaway: Residual trends across age or weight show where fitted predictions tend to be too high or too low. They are evidence to investigate, not a diagnosis of a unique model defect. Interpret them using a clearly defined prediction, adequate covariate overlap, appropriate residual scaling, and the distribution of observations across individuals.

Check Your Understanding

Answer each question, then compare your reasoning with the solutions below.

  1. If the mean residuals in successive age bands are −0.5, −0.1, and 0.4, what pattern in prediction error do they suggest?
  2. Why might residuals conditional on estimated individual effects conceal a population-level developmental trend?
  3. A weight-stratified plot shows positive residuals at low weight and negative residuals at high weight. Name one interpretation and one reason not to treat it as conclusive.
  4. Why can separate age and weight plots be difficult to interpret when young individuals are almost all low weight?
  5. Residual means are near zero across weight bands, but residual spread increases with weight. What kind of issue should be considered?

Solutions. (1) The model tends to overpredict at younger ages and underpredict at older ages, because negative residuals are observed minus predicted and positive residuals indicate underprediction. (2) Estimated individual effects use each individual’s data to tailor predictions, which can absorb some of the same pattern being assessed. (3) The pattern is consistent with underprediction at low weights and overprediction at high weights; it is not conclusive because age distribution, residual variability, or other model features may produce it. (4) Age and weight are then confounded in the observed data, so a marginal age pattern may also be a weight pattern. (5) Consider whether residual variability changes with weight; a changing spread is distinct from a changing mean.