Tutorials › Pharmacometric Workflows and Reproducible Modeling › Residual-Error Variance at a Boundary

Debugging Model Failures · Tutorial 139 of 399

Residual-Error Variance at a Boundary

Use likelihood behavior and residual diagnostics to investigate residual-error variance estimates at a constraint, while considering plausible alternative explanations.

Advanced 12 min read

What You'll Learn

  • Distinguish a residual-error variance boundary from a residual standard-deviation boundary.
  • Use likelihood direction and objective-function changes to interpret a constrained estimate.
  • Calculate a constrained Gaussian variance estimate from residuals.
  • Diagnose residual patterns that suggest an unsuitable error model or model mismatch.
  • Check how bounds, scaling, and other model components can affect residual-error estimates.
  • Identify why ordinary curvature-based uncertainty summaries can be unreliable at a boundary.

Why a Residual-Error Boundary Deserves Attention

A residual-error variance estimate at its lower or upper bound is a diagnostic signal, not a complete explanation. It can indicate that the likelihood favors a value outside the allowed range, that the data contain little information about the parameter, or that another part of the model is accounting for variation that the residual model would otherwise describe. The same numerical result can therefore arise from quite different modeling situations.

The key is to combine the estimate with the likelihood’s behavior near the constraint and with residuals examined in context. A lower-bound estimate does not, by itself, establish that observations are measured without error. An upper-bound estimate does not establish that the true variance equals the software’s maximum. Both require checking the model, data, parameterization, and numerical estimation behavior.

Definition: A residual-error variance is a parameter describing the conditional variability of observations around the model prediction, after accounting for the modeled individual or population effects. It must be nonnegative. A boundary estimate occurs when the fitted value equals, or is numerically very close to, an imposed lower or upper constraint. If the model estimates a residual standard deviation instead, its variance is the square of that standard deviation.

Likelihood Behavior at a Constraint

Consider a simple diagnostic model in which predictions are treated as fixed and residuals \(e_i=y_i-f_i\) are independent normal random variables with mean zero and common variance \(v\). Here \(y_i\) is an observation, \(f_i\) its prediction, and \(v>0\) is the residual-error variance. This simplified setting gives a transparent way to understand likelihood direction; a pharmacometric model may also estimate predictions and other variance components.

$$ \ell(v)=-\frac{n}{2}\log(2\pi v)-\frac{\sum_{i=1}^{n}e_i^2}{2v} $$

The log likelihood combines a penalty for large variance through \(\log(v)\) with a penalty for residuals that are large relative to the variance. Differentiating with respect to \(v\) gives

$$ \frac{d\ell}{dv}=-\frac{n}{2v}+\frac{\sum e_i^2}{2v^2} =\frac{\sum e_i^2-nv}{2v^2}. $$

For an unconstrained maximum with positive residual sum of squares, setting this derivative to zero gives \(\hat v=\sum e_i^2/n\). The derivative is positive below that value and negative above it, so the likelihood increases up to \(\hat v\) and decreases afterward. If the permitted range is \(v_{\min}\leq v\leq v_{\max}\), the constrained maximum in this simple model is the unconstrained value clipped to that range: it is \(v_{\min}\) if \(\hat v<v_{\min}\), \(v_{\max}\) if \(\hat v>v_{\max}\), and \(\hat v\) otherwise. This result follows from the derivative’s sign on either side of \(\hat v\); it does not imply that a complex nonlinear mixed-effects model has such a closed-form estimate.

At a lower bound, ask whether the likelihood would continue to improve as \(v\) decreases. At an upper bound, ask whether it would improve as \(v\) increases. In both cases, compare only evaluations made with the same data, objective, and estimation setup. The objective function value (OFV), when defined as \(-2\ell\), moves in the opposite direction to the log likelihood: a lower log likelihood means a higher OFV.

Worked Example: A Lower-Bound Estimate in a Gaussian Diagnostic

Suppose eight hypothetical concentration residuals, in mg/L, are \(-0.1, 0.1, 0, 0.2, -0.2, 0, 0.1, -0.1\). Assume for this diagnostic that the predictions are fixed and the residuals are independent, mean-zero normal errors with common variance. The permitted variance range is \(0.04\) to \(4.00\) \((\text{mg/L})^2\).

The residual sum of squares is \(0.01+0.01+0+0.04+0.04+0+0.01+0.01=0.12\;(\text{mg/L})^2\). The unconstrained estimate is

$$ \hat v=\frac{\sum e_i^2}{n}=\frac{0.12}{8}=0.015\;(\text{mg/L})^2. $$

This is below the allowed lower bound, so the constrained estimate is \(v_{\min}=0.04\;(\text{mg/L})^2\), corresponding to a residual standard deviation of \(\sqrt{0.04}=0.200\) mg/L. Under the stated assumptions, the likelihood would increase as the variance moved downward from the allowed bound toward \(0.015\;(\text{mg/L})^2\). The estimate therefore indicates that the constraint is active; it does not show that \(0.04\;(\text{mg/L})^2\) is a data-determined optimum without the constraint.

For a separate likelihood comparison, suppose the evaluated inward trial has log-likelihood difference from the boundary of \(\Delta\ell=-3\log(2)-0.75+1.50=-1.3294415\). Its objective difference is \(\Delta\mathrm{OFV}=-2\Delta\ell=2.658883\), or 2.659 to four significant figures. Thus the inward trial has a higher OFV by 2.659 and a lower likelihood than the boundary point. This comparison describes those evaluations; it does not override the derivative evidence in the simplified calculation above.

Reading a Boundary Estimate in a Pharmacometric Model

A pharmacometric residual model may use an additive error, a proportional error, or a combination. For example, a proportional model expresses error scale relative to the prediction, whereas an additive model expresses it in the observation’s units. Consequently, whether a parameter is a variance, standard deviation, or proportional coefficient matters. A bound of \(0.01\) on a standard deviation is not the same constraint as a bound of \(0.01\) on its variance: the corresponding variance is \(0.0001\).

Before interpreting the boundary, verify which quantity was constrained and in what units. Check that the recorded bound is sensible for the model’s parameterization and scale, that the reported value is not merely rounded to the boundary, and that the estimation run has credible convergence diagnostics. A boundary value from an unstable or failed run is not persuasive evidence about the data. Use gradient, objective-trace, and curvature checks as context rather than treating any one diagnostic as decisive.

Then examine residuals against predictions, time, and other relevant covariates. Look for systematic trends, changing spread, outliers, or clusters. If a residual variance is at its lower bound but the residual plot shows a pronounced pattern, the boundary is not evidence that the model describes the observations adequately. Conversely, small, pattern-free residuals are compatible with a small residual component, but still do not identify why that component is small.

Worked Example: An Upper-Bound Estimate

Suppose four hypothetical fixed-prediction residuals are \(-1, 1, -1,\) and \(1\) mg/L. The model assumes independent, mean-zero normal residuals with common variance, and restricts \(v\) to \(0.10\) through \(0.60\;(\text{mg/L})^2\). The residual sum of squares is \(1+1+1+1=4\;(\text{mg/L})^2\), so the unconstrained estimate is \(4/4=1.00\;(\text{mg/L})^2\), above the permitted maximum. The constrained estimate is therefore \(0.60\;(\text{mg/L})^2\), with standard deviation \(\sqrt{0.60}=0.7746\) mg/L.

The derivative at the upper bound is \((4-4(0.60))/(2(0.60)^2)=2.222\), which is positive. Thus, in this diagnostic model, increasing the variance beyond the bound would increase the likelihood. As a check on direction, compare the boundary with an inward value \(v=0.50\;(\text{mg/L})^2\):

$$ \ell(0.60)-\ell(0.50) =-2\log(0.60/0.50)-2(1/0.60-1/0.50) =0.3020. $$

The boundary has the higher log likelihood by 0.3020 and the lower OFV by \(2(0.3020)=0.6040\). The fitted value is nevertheless constrained: the calculation does not say what the likelihood or best estimate would be if values above \(0.60\) were allowed. In a real analysis, investigate whether the limit was intentional and whether the residual pattern or data processing suggests a reason for unusually large residual variation.

Residual Patterns and Alternative Explanations

An estimate at a lower bound can arise because another model component accounts for variability that might otherwise appear as residual error. Random effects, for example, may explain between-individual differences, leaving a small estimated residual component. It can also arise when a chosen error structure is not well suited to the observations, when predictions are effectively overfitted, or when an implementation or data issue alters the residual scale. The boundary alone cannot distinguish these possibilities.

An upper-bound estimate calls for a different but overlapping set of checks. The model may leave substantial unexplained variability because its mean predictions are inadequate, because the data contain outliers or unmodeled heterogeneity, or because the residual error structure does not reflect how spread changes with prediction. A restrictive upper limit, a unit mismatch, or an inappropriate parameter scale can also force the estimate to the cap. These are hypotheses to investigate, not conclusions implied by the boundary.

Worked Example: A Small Additive Component with Proportional-Scale Residuals

Consider eight hypothetical observations with predictions \(1, 1, 2, 2, 10, 10, 20, 20\) mg/L. Their corresponding residuals are \(0.1, -0.1, 0.2, -0.2, 1, -1, 2, -2\) mg/L. The residual magnitudes grow with the predictions, so inspect relative residuals as well as raw residuals.

Dividing each residual by its prediction gives \(0.1, -0.1, 0.1, -0.1, 0.1, -0.1, 0.1, -0.1\). The root mean square relative residual is \(\sqrt{(8(0.1^2))/8}=0.100\), or 10.0%. This pattern is consistent with a roughly constant relative error scale in this small illustration. It is not consistent with a constant absolute scale: absolute residual magnitudes range from 0.1 to 2 mg/L.

If a combined error model estimates its additive variance at the lower bound while retaining a proportional component, this pattern is one plausible reason: the proportional term can account for variation that an additive term would otherwise represent. The example does not prove that the proportional model is correct. Check residuals under the fitted model, other plausible error structures, and whether the result is stable under appropriate estimation checks. In particular, do not infer from the small additive estimate that all measurement error is absent.

1
Confirm the parameter.
Identify whether the estimated quantity is a variance, standard deviation, or error coefficient, and record its units and permitted range.
2
Check the estimation evidence.
Review convergence and objective behavior; a boundary from an unreliable run cannot support a substantive interpretation.
3
Determine the likelihood direction.
Compare feasible nearby values with the same setup. Establish whether moving inward worsens the likelihood or whether the estimate appears numerically unstable.
4
Inspect residuals and alternatives.
Look for trends, changing spread, and outliers; consider other error structures, data or unit issues, and the role of other model components.

Uncertainty, Comparisons, and Limitations

At a boundary, ordinary uncertainty summaries based on local curvature deserve caution. A standard error derived from a symmetric quadratic approximation presumes a sufficiently regular interior estimate. At a constraint, the likelihood may be asymmetric and its feasible direction is restricted; the curvature calculation may also be unstable. A small standard error or a successful covariance step does not, by itself, resolve the boundary diagnosis.

Useful comparisons include checking the fitted residual model against a scientifically plausible alternative error structure, inspecting residual plots under each fit, and comparing likelihoods only when the data and fitting setup make the comparison valid. Refit behavior across reasonable starting values and estimation settings can reveal numerical sensitivity. These checks help identify explanations, but none turns a constrained estimate into an unconstrained one. A bound should not be silently removed merely to obtain a more convenient estimate.

The simple Gaussian derivation assumes fixed predictions and independent, identically distributed normal residuals. In a mixed-effects model, predictions and other parameters are estimated, observations may have different conditional variances, and the likelihood can integrate over random effects. The derivative calculation is therefore a guide to the meaning of likelihood direction, not a substitute for evaluating the actual model. Nor does a boundary estimate alone establish a true zero residual effect or a unique cause. Report the constraint, parameter scale, diagnostics, and remaining uncertainty clearly.

Common pitfall: “The residual variance is at its lower bound, so the data show there is no residual error.” This conclusion confuses a constrained estimate with an unconstrained scientific result. The estimate may be limited by the bound, another component may be absorbing variation, or the residual model and data may not be behaving as assumed. Check the likelihood direction, residual patterns, parameter scale, and fit diagnostics before interpreting it.

Check Your Understanding

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

  1. In the fixed-prediction Gaussian diagnostic, \(n=10\) and the residual sum of squares is \(0.20\;(\text{mg/L})^2\). If the permitted variance range is \(0.03\) to \(1.00\;(\text{mg/L})^2\), what is the constrained estimate?
  2. A residual standard deviation is reported at its lower bound of \(0.05\) mg/L. What is the corresponding variance, and why must the distinction be stated?
  3. At an upper-bound estimate, what does a positive likelihood derivative in the simple variance model indicate?
  4. Why is “the variance is at its lower bound, therefore there is no measurement error” an inadequate conclusion?

Solutions. (1) The unconstrained estimate is \(0.20/10=0.020\;(\text{mg/L})^2\), below the lower bound, so the constrained estimate is \(0.030\;(\text{mg/L})^2\). (2) The variance is \(0.05^2=0.0025\;(\text{mg/L})^2\). Standard deviation and variance have different units and numerical scales, so the reported parameter and bound must be identified. (3) The likelihood increases as the variance increases locally; if this holds up to the maximum allowed value, the constrained estimate is at that upper bound, while the unconstrained optimum may lie beyond it. (4) The constraint limits the estimate, and other model components, error structures, data issues, or numerical behavior may explain it. Residual diagnostics and likelihood behavior are needed before drawing a scientific interpretation.

Clinical Biostats