Why Examine the Distribution of Residuals?
Residuals versus time and residuals versus predictions can reveal patterns across those axes. A complementary question is whether the residuals, considered as a distribution, have the shape and scale expected for the residual quantity being plotted. A histogram makes broad shape features visible; a normal-quantile plot makes departures in the center and tails easier to locate. Neither plot, by itself, establishes that a model is adequate or inadequate.
In automated reporting, the plot is only as interpretable as its specification. The residual definition, reference distribution, filtering rules, binning, and axis scales need to be consistent and visible. In particular, a standard normal reference is appropriate only when the chosen residuals are intended to be approximately standardized with mean zero and variance one under the fitted model. It is not a universal assumption about every residual.
Specify the Reference Before Plotting
First name the plotted quantity. A raw residual measured in concentration units cannot be compared directly with a standard normal curve: the units and scale do not match. A standardized residual is dimensionless, but standardization alone does not prove that its distribution is exactly normal. Use the reference justified by the residual definition and model; if the residual has a different intended reference, display that reference instead of defaulting to \(N(0,1)\).
For a standard normal reference, a density histogram is useful because its area is one and it can be compared with the density curve \( \phi(x)=(2\pi)^{-1/2}\exp(-x^2/2) \). If bins have unequal widths, density rather than count must determine bar height for bar area to represent the fraction of observations in a bin. The plot should identify the residual type, the number of finite values included, and the reference distribution. It should also make any exclusions apparent through counts or metadata.
A normal-quantile plot, also called a normal Q-Q plot, uses ordered observed residuals on the vertical axis and theoretical normal quantiles on the horizontal axis. For \(n\) residuals ordered as \(r_{(1)}\leq\cdots\leq r_{(n)}\), one common plotting-position convention is \(p_i=(i-0.5)/n\), with theoretical quantile \(z_i=\Phi^{-1}(p_i)\), where \(\Phi\) is the standard normal cumulative distribution function. The choice of plotting positions is a convention; a report should use the same convention across comparable plots.
Worked Example: Building a Density Histogram
Suppose a hypothetical diagnostic report contains these 10 finite standardized residuals: \(-2.1,-1.4,-0.8,-0.3,0.0,0.2,0.4,0.7,1.1,2.6\). The intended reference is \(N(0,1)\). Use bins of width 1 with edges at the integers from \(-3\) to \(3\), and calculate the density in each bin.
For a bin with count \(c\), width \(w\), and \(n\) observations, histogram density is \(c/(nw)\). The six bin counts, from \([-3,-2)\) through \([2,3)\), are \(1,1,2,4,1,1\). Since \(n=10\) and \(w=1\), the densities are \(1/(10\times1)=0.10\), \(0.10\), \(2/(10\times1)=0.20\), \(4/(10\times1)=0.40\), \(0.10\), and \(0.10\), respectively.
The total bar area is \((0.10+0.10+0.20+0.40+0.10+0.10)\times1=1.00\), as required for a density histogram. The central bin is tallest, while one observation lies in each of the two outer bins. Overlaying the standard normal density gives a visual reference, but these 10 values are too few to make a stable judgment about subtle departures. The two outer observations are reasons to inspect the Q-Q plot, not proof of heavy tails.
How to Read a Normal-Quantile Plot
If the plotted residuals are approximately distributed as \(N(0,1)\), their ordered values should roughly track the theoretical quantiles. Small, irregular deviations are expected in finite samples. The identity line assesses both location and scale as well as shape: a systematic vertical shift suggests nonzero location, and a roughly straight line with a slope different from one suggests a scale difference. A fitted line through the first and third quartiles is sometimes used to emphasize shape, but it can conceal location and scale miscalibration. State which reference line is being shown.
Departures are interpreted by their pattern, not by a single point. A pronounced asymmetric bend can be consistent with skewness; an upper tail that rises above the reference line, especially alongside a lower tail below it, is consistent with heavier-than-normal tails. The reverse tail pattern can indicate lighter-than-normal tails. A few points at the extremes can occur by chance, particularly when \(n\) is small. Compare the plot with the histogram and with the residual definition before assigning an interpretation.
Worked Example: Comparing Ordered Residuals With Normal Quantiles
In a separate hypothetical fit, the seven ordered standardized residuals are \(-2.00,-1.10,-0.50,0.00,0.20,0.70,2.40\). Use \(p_i=(i-0.5)/7\) and compare the extremes with standard normal quantiles.
The plotting positions are approximately \(0.0714,0.2143,0.3571,0.5000,0.6429,0.7857,0.9286\). Their standard normal quantiles are approximately \(-1.465,-0.791,-0.366,0,0.366,0.791,1.465\). For example, the smallest residual is paired with \(\Phi^{-1}(0.5/7)\approx-1.465\), and the largest with \(\Phi^{-1}(6.5/7)\approx1.465\).
At the lower extreme, the observed value \(-2.00\) is \(0.535\) below its theoretical quantile: \(-2.00-(-1.465)=-0.535\). At the upper extreme, \(2.40\) is \(0.935\) above its theoretical quantile: \(2.40-1.465=0.935\). Both tails depart outward from the identity line, with a larger departure in the upper tail. This small sample is compatible with a tail or asymmetry concern, but it cannot establish either feature reliably; the remaining points and the histogram should also be inspected.
Why the Quantile Pairing Is Reasonable
The plotting positions are approximations to where ordered observations fall in a reference distribution. For independent observations from a continuous distribution with cumulative distribution function \(F\), the transformed values \(F(X_j)\) are independent uniform random variables on \((0,1)\). For the \(i\)th smallest of \(n\) such values, the expected order statistic is \(i/(n+1)\). Midpoint plotting positions such as \((i-0.5)/n\) are a widely used alternative approximation. Both put probabilities strictly between zero and one, so the corresponding normal quantiles are finite.
This argument motivates the Q-Q construction; it does not make residuals independent or guarantee that their theoretical distribution is exactly normal. In pharmacometric data, several observations may come from the same individual, and residuals can be related through the model, sampling schedule, or shared parameter estimates. Consequently, a Q-Q plot is a diagnostic display, not an independent-observation test with a calibrated error rate.
Worked Example: Automating the Plot Without Hiding Exclusions
Consider a hypothetical report specification for 12 residual records. The selected residual field is a dimensionless standardized residual intended to be compared with \(N(0,1)\). Ten records contain finite numeric values; one is missing and one is positive infinity. The finite values have mean \(0.10\) and sample standard deviation \(1.20\), calculated from those 10 values.
A reproducible pipeline first records the 12 input records, then counts the 10 finite values, the one missing value, and the one non-finite value separately. It does not treat infinity as an ordinary extreme residual or silently remove either record. It builds the density histogram and Q-Q plot from the 10 finite values, labels the reference as \(N(0,1)\), and reports the finite-value count and exclusions alongside the plots.
The mean and standard deviation are useful context: \(0.10\) is close to zero, while \(1.20\) is larger than the unit scale expected under the stated reference. A Q-Q plot against the identity line can show this scale departure as well as shape departures. The example does not establish why the values differ from the reference; the pipeline has made the display reproducible and the discrepancy visible rather than repairing it by recentering or rescaling the residuals.
Automated Diagnostics: Checks, Alternatives, and Limits
A reliable automated report applies the same documented rules to every run. Record the residual field, reference distribution, plotting-position convention, histogram bin rule, finite-value count, and missing or non-finite counts. Use consistent axes and binning when comparing panels, while choosing limits that do not clip meaningful extremes. If a subset has too few residuals to support interpretation, show the count and label the display as limited rather than presenting a smooth-looking curve that implies precision.
Check for failures before interpreting shape. A histogram with count heights may be mistakenly overlaid with a density curve; unequal-width bins may then misrepresent the distribution. A Q-Q plot can be reversed between axes across reporting tools, making a familiar pattern appear to have a different meaning. Selectively filtering extreme finite values, or standardizing each plotted sample to mean zero and variance one, can hide precisely the location, scale, or tail departures the diagnostic is meant to show. If residual units are not compatible with the reference, resolve the specification rather than forcing the comparison.
The histogram is effective for broad features such as concentration near zero, asymmetry, or multiple peaks, but its appearance depends on bin width and origin. The Q-Q plot is less dependent on bin choices and reveals which quantile regions depart from the reference, but it can be hard to read with very large samples and is noisy in the tails of very small samples. Together they are more informative than either alone. Formal normality tests are an alternative when a formal test is specifically needed, but they answer a different question: their result depends on sample size and assumptions, and a p-value does not describe the magnitude or practical importance of a departure. A plot should not be replaced by a test without a clear inferential purpose.
Most importantly, these plots assess the marginal distribution of the chosen residual values. They do not show where a departure occurs over time, predictions, or other explanatory variables; nor do they establish that a distributional feature caused poor predictive performance. Repeated within-individual observations can make the plotted points dependent, and a mixture of subpopulations can produce a non-normal marginal shape even when individual components look different. Interpret the figures alongside the residual definition and other model diagnostics, and describe departures as evidence to investigate rather than as a stand-alone verdict.
Check Your Understanding
Answer each question, then compare with the solutions below.
- A histogram has bins of width 2, each containing 4 observations, among \(n=20\) finite residuals. What is the density height for each bin?
- For \(n=5\), what plotting position and approximate standard normal quantile are paired with the largest ordered residual using \(p_i=(i-0.5)/n\)?
- In a Q-Q plot against \(N(0,1)\), the lower-tail points fall below the identity line and the upper-tail points rise above it. What departure is this pattern consistent with?
- Why should an automated report display the number of missing and non-finite residuals rather than silently omit them?
Solutions. (1) The density is \(4/(20\times2)=0.10\) per residual unit; each such bar has area \(0.10\times2=0.20\), matching the fraction \(4/20\). (2) The largest residual has rank \(i=5\), so \(p_5=(5-0.5)/5=0.90\), and \(\Phi^{-1}(0.90)\approx1.282\). (3) The outward departures in both tails are consistent with heavier-than-normal tails, though sampling variation and other features must be considered. (4) Explicit counts make the plotted sample and exclusions auditable; silent omission can conceal data-quality problems or change the apparent distribution.