Tutorials › Nonlinear Mixed-Effects Models (NLME) › Histograms And Quantile Plots Of Residuals

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

Histograms And Quantile Plots Of Residuals

Use residual histograms and normal quantile plots to assess distributional shape while keeping pooled and within-subject conclusions distinct.

Intermediate 9 min read

What You'll Learn

  • Choose a residual type that matches the population- or individual-level diagnostic target.
  • Read histogram shape without confusing bin choices with evidence of a model defect.
  • Construct and interpret a normal quantile plot using normal scores.
  • Recognize skewness, heavy tails, and departures concentrated in the extremes.
  • Explain why a pooled residual distribution does not describe every subject’s residual behavior.
  • Identify when sparse data, dependence, or standardization limits the conclusions from these plots.

Why Examine the Distribution of Residuals?

Residual plots against time, predictions, and other variables can reveal systematic structure, but they do not summarize the overall distributional shape of residuals. A histogram and a normal quantile plot (also called a normal Q–Q plot) offer complementary views: the histogram shows the broad shape, while the quantile plot compares observed residual quantiles with those expected under a reference normal distribution. They can help identify skewness, unusually heavy or light tails, and departures concentrated among the most extreme values.

In an NLME analysis, the choice of residual matters. A population-level diagnostic and an individual-level diagnostic answer different questions. The earlier material on raw, weighted, and conditional residuals, standardization, and reference distributions distinguishes these targets. Here, the key requirement is to state which residual is plotted and interpret its reference distribution accordingly. For example, CWRES are commonly assessed against an approximate standard normal reference for population-model adequacy; this is not a claim that every finite-sample set of estimated CWRES must be exactly independent standard normal observations.

Definition: A residual histogram groups residual values into intervals (bins) and displays the number or proportion in each interval. A normal quantile plot orders the observed residuals and plots them against theoretical quantiles from a specified normal reference distribution. If standardized residuals are being assessed against \(N(0,1)\), the reference quantiles are standard normal quantiles.

These are descriptive diagnostics, not automatic pass-or-fail tests. A roughly symmetric histogram and an approximately straight normal quantile plot are consistent with the selected normal reference, but do not prove the model is correct. Conversely, departures may arise from model misspecification, residual dependence, a small sample, heterogeneous residual behavior across subjects, or influential observations. The plots must be read alongside the model assumptions and other diagnostics.

Reading a Residual Histogram

A histogram’s shape depends partly on bin width and bin boundaries. Wide bins can hide features; narrow bins can make ordinary sampling variation look like multiple peaks. Always inspect the residual scale and units, state whether the vertical axis shows counts or proportions, and consider whether the broad pattern persists under reasonable bin choices.

For residuals standardized to a standard normal reference, zero is the reference center and values are measured in standard deviation units of that reference. A longer right tail than left tail suggests positive skewness; a longer left tail suggests negative skewness. More observations far from zero than expected under the reference suggest heavy tails, while fewer suggest light tails. A histogram alone does not reliably distinguish a smooth tail departure from a few isolated extreme values.

Worked Example: Counting Residuals in Histogram Bins

Suppose eight hypothetical standardized residuals are \(-1.40,-1.00,-0.70,-0.30,0.30,0.70,1.00,1.40\). Use bins \([-2,-1),[-1,0),[0,1),[1,2]\), with the final interval including its right endpoint. Find the bin counts and describe the display.

The first interval includes values at least \(-2\) but strictly less than \(-1\). Only \(-1.40\) falls there, so its count is 1. The second interval includes \(-1.00,-0.70,-0.30\), so its count is 3. The third includes \(0.30,0.70\), so its count is 2. The last includes \(1.00,1.40\), so its count is 2. The counts are therefore \(1,3,2,2\), and they sum to \(1+3+2+2=8\), the total number of residuals.

The values are balanced around zero, but this histogram is too coarse and the sample too small to establish a normal shape. The bin boundaries matter: \(-1.00\) belongs to \([-1,0)\), and \(1.00\) belongs to \([1,2]\), not to the preceding intervals. A different reasonable set of bins could give a different visual impression.

Constructing and Interpreting a Normal Quantile Plot

Let \(e_1,\ldots,e_m\) denote the residuals under examination, and write their ordered values as \(e_{(1)}\leq \cdots \leq e_{(m)}\). For a standard normal reference, a common plotting-position convention pairs \(e_{(i)}\) with \(z_i=\Phi^{-1}((i-0.5)/m)\), where \(\Phi\) is the standard normal cumulative distribution function. Other plotting-position conventions are also used; the exact positions vary slightly, especially in small samples, but the interpretation is the same.

If the residuals follow the reference distribution reasonably well, the plotted points should lie approximately along a straight line. In a standard normal Q–Q plot with theoretical quantiles on the horizontal axis and residuals on the vertical axis, the reference pattern is near the line \(y=x\). A fitted line may have a different intercept or slope if location and scale are not fixed by standardization; systematic curvature is more informative about shape than a small shift or scale difference.

Derivation: If \(Z\sim N(0,1)\), then \(\Phi(Z)\) is uniformly distributed between 0 and 1. Thus the \(i\)th ordered value among \(m\) reference draws corresponds roughly to a cumulative probability near \(i/(m+1)\). The plotting position \((i-0.5)/m\) is a common finite-sample alternative. Applying \(\Phi^{-1}\) converts each probability to the normal score against which the ordered residual is compared. This construction explains why normal data tend to produce an approximately straight Q–Q plot; it does not make the plotted points independent or turn visual agreement into proof of normality.

Interpret departures by where they occur. A smooth bend through much of the plot can indicate skewness. If both ends bend away from the central trend, the tails may be heavier than the reference; if the extremes bend inward, they may be lighter. A departure confined to one or two end points may indicate an unusually extreme residual, but the plot alone cannot tell whether it reflects a data error, an unusual subject, or model inadequacy.

Worked Example: Detecting a Right-Tail Departure

Consider the hypothetical sorted standardized residuals \(-1.40,-1.00,-0.70,-0.30,0.30,0.70,1.00,2.40\). Use plotting positions \((i-0.5)/8\) and approximate standard normal scores. The first four probabilities are \(0.0625,0.1875,0.3125,0.4375\); by symmetry the remaining four are \(0.5625,0.6875,0.8125,0.9375\). Their approximate normal scores are \(-1.534,-0.887,-0.489,-0.157,0.157,0.489,0.887,1.534\).

Pair each score with the residual in the same rank. In the lower tail, the first pair is \((-1.534,-1.40)\); in the center, the fourth pair is \((-0.157,-0.30)\). The seventh pair is \((0.887,1.00)\), which is also reasonably close to the identity line. At the upper end, however, the eighth pair is \((1.534,2.40)\): the observed residual exceeds its reference quantile by \(2.40-1.534=0.866\) standardized units.

The main visible departure is therefore an upper-tail point above the reference trend, consistent with a more extreme positive residual than expected from the standard normal reference. This small hypothetical sample cannot establish that the population residual distribution is skewed or heavy-tailed. It also cannot identify the cause of the point; check data and model context and use appropriate subject-level diagnostics before drawing a conclusion.

Pooled Residuals and Within-Subject Behavior

Pooling residuals means combining observations from multiple subjects into one set before making the histogram or quantile plot. A pooled display describes the empirical distribution across the observations included; it does not show whether the same distributional behavior occurs within each subject. Subjects with more observations contribute more points and therefore more weight to an observation-level pooled plot.

This distinction is important in NLME models. Even if a pooled histogram is symmetric and the pooled quantile plot looks nearly straight, residuals could have subject-specific shifts, different spreads, or patterns over time. The reverse can happen too: a pooled distribution may depart from normality because subjects contribute residuals with differing locations or scales, even when no single subject’s limited set of residuals clearly shows the pooled feature. The shape of a mixture of distributions need not match the shape of each component.

Worked Example: A Pooled Center Can Hide Subject-Level Structure

Suppose four hypothetical subjects each contribute four standardized residuals. Their residuals, listed in observation order, are:

Subject A: \(-1.2,-0.8,-0.4,0.0\); Subject B: \(-0.4,0.0,0.4,0.8\); Subject C: \(-0.8,-0.4,0.0,0.4\); Subject D: \(0.0,0.4,0.8,1.2\).

The pooled sum is \((-2.4)+0.8+(-0.8)+2.4=0\), so the pooled mean is \(0/16=0\). The pooled values are symmetric about zero: each of \(-1.2\) and \(1.2\) appears once, each of \(-0.8\) and \(0.8\) appears twice, each of \(-0.4\) and \(0.4\) appears three times, and zero appears four times. A pooled histogram would consequently look centered and symmetric.

But the subject means are different: A has mean \((-1.2-0.8-0.4+0)/4=-0.60\); B has mean \((-0.4+0+0.4+0.8)/4=0.20\); C has mean \((-0.8-0.4+0+0.4)/4=-0.20\); and D has mean \((0+0.4+0.8+1.2)/4=0.60\). In addition, each subject’s listed residuals increase from one observation to the next. The pooled center and symmetry therefore do not establish that residual behavior is centered or pattern-free within every subject. Subject-specific summaries or displays are needed to investigate that question, while recognizing that four residuals per subject are too few for stable subject-level distributional conclusions.

Practical Interpretation, Alternatives, and Limitations

The main alternative to a histogram is the normal quantile plot, not because one replaces the other, but because each emphasizes different features. A histogram makes overall shape and possible multimodality easy to see, but depends on bin choices. A Q–Q plot avoids bins and highlights departures in the tails, but can look irregular when there are few observations and cannot reveal time ordering. Use both when the sample allows, and relate their evidence to plots that address time, predictions, and subject-level structure.

Several limitations deserve attention. Standardized residuals may have an approximate, rather than exact, normal reference because model parameters are estimated and the residuals can be correlated. Some residual definitions also condition on subject-specific estimates; the reference distribution and diagnostic target must match the chosen residual. Unequal numbers of observations per subject affect pooled displays. Sparse within-subject sampling makes individual histograms or quantile plots unstable. Finally, a single extreme residual can strongly affect the tails without establishing a general distributional departure.

Do not use these plots as a substitute for checking residuals against time or predictions. A normal-looking pooled histogram cannot rule out serial structure, and a normal quantile plot does not assess whether residual variance changes with time or fitted value. Nor do these displays alone identify influential subjects or establish that a particular observation should be removed.

Common pitfall: “The pooled histogram is symmetric and centered at zero, so every subject has well-behaved normal residuals.” This conclusion does not follow. Pooling can conceal subject-specific shifts, spreads, or patterns, and a histogram discards observation order. Inspect the appropriate population- and individual-level residuals, use subject-level displays when informative, and combine distributional plots with time- and prediction-based diagnostics.

A Focused Diagnostic Workflow

1
Name the residual and target.
State whether the display uses population-level or individual-level residuals and what reference distribution is appropriate.
2
Inspect the pooled shape.
Check centering, asymmetry, tail behavior, sample size, and whether the impression is sensitive to reasonable histogram bins.
3
Compare quantiles to the reference.
Look for broad curvature, tail departures, or isolated extreme points rather than demanding exact alignment.
4
Separate pooled from subject-level evidence.
Consider observation counts per subject and inspect suitable subject-level or time-ordered displays before making within-subject claims.
5
Integrate, do not overclaim.
Use the plots with the other model diagnostics; describe departures as evidence to investigate, not as a stand-alone decision about model validity.

Check Your Understanding

Answer each question, then compare with the brief solutions.

  1. What does an approximately straight normal quantile plot support, and what does it not prove?
  2. For bins \([-2,-1),[-1,0),[0,1),[1,2]\), where does a residual of \(-1\) belong? Where does a residual of \(1\) belong?
  3. A pooled residual histogram is centered at zero. Can you conclude that each subject’s residuals are centered at zero? Explain.
  4. What kind of departure in a normal quantile plot is consistent with heavier-than-reference tails?
  5. Why should a histogram and a normal quantile plot be paired with time- or subject-level diagnostics?

Solutions. (1) It supports approximate agreement with the selected normal reference, while not proving the model correct, independence, or exact normality. (2) \(-1\) belongs to \([-1,0)\); \(1\) belongs to \([1,2]\), because the last bin includes its right endpoint. (3) No. Opposing subject-specific shifts can cancel in the pooled mean, and pooling does not preserve subject identity. (4) Both tails bending away from the central reference trend is consistent with heavier tails. (5) Histograms and quantile plots omit observation order and can hide subject-specific behavior; other displays assess those features.