Tutorials › Model-Informed Drug Development (MIDD) › Residual Diagnostics Across Animal Species

Translational Modeling and Uncertainty · Tutorial 138 of 596

Residual Diagnostics Across Animal Species

Learn to calculate and interpret species-specific residuals and prediction errors to identify scaling, bias, and variance patterns that a pooled summary can hide.

Advanced 10 min read

What You'll Learn

  • Define residuals and prediction errors for observations grouped by animal species.
  • Distinguish additive residuals from log-scale residuals and observed-to-predicted ratios.
  • Detect species-specific bias that may be obscured by a pooled mean residual.
  • Use residual patterns across body size or another covariate to diagnose scaling failures.
  • Identify changing residual variance and choose an appropriate scale for inspection.
  • Recognize when sparse data, repeated measures, or in-sample fitting limit diagnostic conclusions.

Why Inspect Residuals by Species?

A translational model can have a small overall prediction error and still fail systematically for an animal species. Overprediction in one species can cancel underprediction in another; a model can also miss how an endpoint changes with body size while producing errors near zero on average. Species-stratified residual diagnostics make these patterns visible. They are a way to assess whether model predictions are consistent with the animal data and the model’s assumptions—not, by themselves, proof that a particular biological mechanism is responsible.

The introductory material on calibration of translational prediction intervals concerns whether intervals achieve their intended coverage. Residual diagnostics address a related but distinct question: what patterns do the prediction errors show across species, fitted values, and relevant covariates? A good overall coverage summary does not establish that errors are unbiased within each species or that their variance is stable.

Definition: For animal observation \(i\) in species \(j\), let \(y_{ij}\) be the observed outcome and \(\hat{y}_{ij}\) its model prediction on the same scale and in the same units. The additive residual is \(e_{ij}=y_{ij}-\hat{y}_{ij}\). A positive residual means the observation exceeds its prediction; a negative residual means the prediction exceeds the observation. A prediction error is the difference between an observed outcome and a prediction; when the prediction was generated from the same data used to fit the model, that error is an in-sample residual.

Residuals should be examined in context. For a positive outcome with multiplicative error, it may be more informative to inspect the log residual \(r_{ij}=\log(y_{ij})-\log(\hat{y}_{ij})\), which is also the log of the observed-to-predicted ratio. A positive log residual means the observation is proportionally higher than predicted. The additive residual has the outcome’s units; the log residual and ratio do not. Do not switch scales without saying so: patterns and interpretations can differ between additive and multiplicative error.

What Patterns to Look For

Begin with plots that retain species identity. Plot residuals against fitted values, body weight, dose, or another covariate relevant to the model, using different symbols or panels for each species. Also inspect species-specific residual distributions and observed-versus-predicted values against the identity line. A residual plot with points scattered around zero and no obvious structure is compatible with an adequate mean model, but it cannot establish that the model is correct.

  • Species-specific bias: residuals for one species tend to lie above or below zero. The direction indicates underprediction or overprediction, respectively.
  • Scaling failure: residuals change systematically with body size or another predictor. A model may have the wrong slope or exponent even when its average residual is close to zero.
  • Changing variance: the vertical spread of residuals grows or shrinks with fitted value, species, or a covariate. A constant-variance assumption may be unsuitable.
  • Other structure: curvature, clusters, or time-ordered patterns may indicate that the mean model, covariate structure, or dependence assumptions need attention.
Interpretation rule: Under a correctly specified conditional mean model, residuals should have conditional expectation zero given the modeled predictors. Constant residual variance is a separate assumption; it does not follow from a zero conditional mean. Independence is also separate and may fail for repeated observations from the same animal or study.

Worked Examples

Worked Example: Species-Specific Bias Hidden by Pooling

Suppose a hypothetical model predicts a clearance endpoint in L/h for four animals in each of two species. The values below are hypothetical. Calculate each residual as observed minus predicted.

SpeciesPredicted (L/h)Observed (L/h)Residuals (L/h)
Species A10, 12, 14, 1612, 13, 17, 182, 1, 3, 2
Species B20, 22, 24, 2619, 20, 24, 25-1, -2, 0, -1

For Species A, the mean residual is \((2+1+3+2)/4=8/4=2\) L/h. The model underpredicts this species’ observations on average by 2 L/h in this small sample. For Species B, the mean residual is \((-1-2+0-1)/4=-4/4=-1\) L/h, indicating average overprediction by 1 L/h.

The pooled mean residual is \((8-4)/8=0.5\) L/h. This modest pooled value conceals the different species patterns. It is evidence to investigate species-specific bias, not a definitive estimate of a general species effect: the samples are small, and the observed differences could reflect sampling variability or other features of the data.

Worked Example: A Residual Trend Suggests a Scaling Problem

Consider a hypothetical allometric model for clearance, with predictions proportional to body weight raised to the exponent 0.75. For three animals, compare observed and predicted clearance using the log residual \(r=\log(y)-\log(\hat{y})=\log(y/\hat{y})\).

Body weight (kg)Observed/predicted ratioLog residual
0.251.20\(\log(1.20)=0.1823\)
20.90\(\log(0.90)=-0.1054\)
100.70\(\log(0.70)=-0.3567\)

The residuals decline as body weight increases: the smallest animal’s clearance is 20% above prediction, whereas the largest animal’s is 30% below prediction. To quantify this descriptive trend between the endpoints, calculate the slope of log residual against log body weight:

$$ \frac{-0.3567-0.1823}{\log(10)-\log(0.25)} = \frac{-0.5390}{2.3026-(-1.3863)} = \frac{-0.5390}{3.6889} \approx -0.146 $$

If these observations follow the same relationship and the other model terms are appropriate, the fitted exponent of 0.75 may be too high: the observed log-clearance slope suggested by these endpoints is approximately \(0.75-0.146=0.604\). Three points do not establish the correct exponent or explain the trend. The diagnostic signal is that prediction error changes with size, so a single pooled error summary would be inadequate.

Worked Example: Residual Variance Increases With Prediction

In hypothetical data measured in mg/L, residuals at lower predicted concentrations are \(-1, 0, 1\), while residuals at higher predicted concentrations are \(-4, 0, 4\). Both groups have mean residual zero, so neither shows a mean shift in this example. Compare their sample standard deviations.

For the lower predictions, the mean is zero and the sample standard deviation is \(s=\sqrt{((-1)^2+0^2+1^2)/(3-1)}=\sqrt{2/2}=1\) mg/L.

For the higher predictions, it is \(s=\sqrt{((-4)^2+0^2+4^2)/(3-1)}=\sqrt{32/2}=4\) mg/L.

The residual spread is four times as large at higher predictions. A residual-versus-fitted plot would show a wider vertical spread in that region. This suggests that constant additive variance may be a poor description. It does not identify the correct replacement: possible next steps include checking a justified log scale or fitting a variance model, with the choice guided by the endpoint and scientific model.

Why the Log-Scale Diagnostic Works

A proportional error model gives a direct interpretation to log residuals. Suppose a positive outcome follows \(y=aW^\beta\), where \(W\) is body weight and \(a\) and \(\beta\) are constants. If the model predicts \(\hat{y}=\hat{a}W^{\hat{\beta}}\), then

$$ \log(y)-\log(\hat{y}) = \log(a/\hat{a})+(\beta-\hat{\beta})\log(W) $$

This follows by taking logarithms of both power relationships and subtracting: \(\log(y)=\log(a)+\beta\log(W)\) and \(\log(\hat{y})=\log(\hat{a})+\hat{\beta}\log(W)\). The difference therefore has an intercept component, \(\log(a/\hat{a})\), and a slope component, \(\beta-\hat{\beta}\), against \(\log(W)\). A constant log residual indicates a multiplicative offset; a trend with log weight is consistent with an exponent mismatch. This interpretation assumes the same power-law form applies over the observed range and that other relevant predictors or species differences do not account for the trend. It is a diagnostic decomposition, not a causal conclusion.

Standardization, Dependence, and Failure Modes

Raw residuals have the endpoint’s units, which makes them useful for judging practical magnitude. Standardized residuals can help compare observations with different expected precision. If an appropriate residual standard deviation \(\hat{\sigma}\) is available, a simple standardized residual is \(e_{ij}/\hat{\sigma}\). When prediction uncertainty differs across observations, dividing by a suitable observation-specific predictive standard deviation may be more relevant. The denominator must match the intended diagnostic; a residual divided only by an estimated measurement error does not automatically account for uncertainty in model parameters or other sources of prediction uncertainty.

A common mistake is to treat every animal observation as independent. Repeated measurements from the same animal, or animals clustered within a study, can produce correlated residuals. A sequence of residuals that looks like many independent points may then contain much less information than its point count suggests. Inspect residuals by animal and study where possible, and interpret species summaries in light of the sampling structure.

Another limitation is that in-sample residuals are calculated after using the data to estimate the model. They may look smaller or less patterned than errors for new data, especially when the model is flexible. Leave-one-species-out validation, covered in earlier material, asks how predictions perform when an entire species is withheld; residual plots from the fitted animal data instead help localize patterns in those data. Neither diagnostic alone establishes performance in an unobserved biological setting.

A Practical Diagnostic Sequence

1
Define the prediction and scale.
State the observed endpoint, units, prediction target, and whether errors are additive or multiplicative. Calculate residuals consistently as observed minus predicted.
2
Stratify before pooling.
Plot residuals by species and summarize their center and spread. Report the number of animals and studies contributing to each species summary.
3
Inspect covariate and fitted-value patterns.
Look for trends, curvature, clusters, or changing spread against fitted values, body weight, and other scientifically relevant predictors.
4
Check robustness and limitations.
Compare an appropriate alternative scale or variance description, account for repeated-measure structure, and distinguish diagnostic evidence from confirmation on new data.

Choosing a Response to a Diagnostic Signal

Observed patternPossible implicationCareful next step
Residuals mostly positive or negative within a speciesSpecies-specific mean bias or omitted structureCheck data, covariates, and model structure; quantify uncertainty rather than relying on a visual pattern alone
Residual trend with log body weightScaling exponent or other size-related structure may be inadequateAssess the trend on a scientifically justified scale and over the observed weight range
Spread increases with fitted valueConstant additive variance may not holdConsider whether a log scale or explicit variance model is defensible
Time- or animal-specific clustersResidual dependence may be presentInspect the measurement structure and use a model or summary that respects clustering

These responses are alternatives to indiscriminately adding species-specific parameters. A pooled model is parsimonious but can conceal bias; species-specific mean or variance terms can describe real differences but may be unstable with sparse species data. Transforming the outcome can clarify proportional error but changes the scale of interpretation. An explicit variance model retains the original scale when appropriate but requires adequate data to estimate its structure. The choice should be justified by the endpoint, scientific knowledge, and diagnostic evidence together.

Common Pitfalls

  • Relying on the pooled mean residual: a value near zero does not rule out opposing species-specific biases. Show species-stratified plots or summaries.
  • Calling a trend a mechanism: residual association with body size indicates unexplained size-related structure, not proof of its biological cause.
  • Confusing spread with bias: a species can have residuals centered near zero but much greater variance. Examine both center and spread.
  • Overinterpreting sparse plots: a few animals cannot reliably establish a species pattern. Show the data and describe the uncertainty and limits.
  • Mixing error scales: an additive residual is measured in endpoint units; a log residual describes a multiplicative discrepancy. State which one is used.
Key takeaway: Inspect residuals by species and against fitted values and relevant covariates. Species-specific centers, trends across size, and changing spread diagnose different potential failures; none should be replaced by a single pooled error statistic.

Check Your Understanding

Answer each question, then compare with the solutions below.

  1. A hypothetical observation is 18 mg/L and its prediction is 15 mg/L. What is the additive residual, and what does its sign mean?
  2. Two species have mean residuals of 3 and \(-2\) units, based on equal sample sizes. What is their pooled mean residual, and why is it potentially misleading?
  3. A log residual is \(\log(0.8)\). Interpret the observed-to-predicted ratio.
  4. Residual spread is similar across fitted values, but residuals for one species are mostly negative. Which feature is implicated: mean bias, variance change, or both?
  5. Why can many residuals from repeated measurements on a few animals overstate the amount of independent diagnostic information?

Solutions. (1) \(18-15=3\) mg/L; the observed value is 3 mg/L above its prediction. (2) With equal sample sizes the pooled mean is \((3+(-2))/2=0.5\) units. This hides the opposite species-specific patterns. (3) Since \(r=\log(y/\hat{y})\), the ratio is 0.8: the observation is 80% of its prediction, or 20% below it. (4) The negative residual center suggests overprediction, or negative mean bias, for that species; similar spread does not suggest a variance change. (5) Measurements from the same animal may be correlated, so they do not provide as much independent information as the same number of observations from independent animals.