Tutorials › Nonlinear Mixed-Effects Models (NLME) › Priors for Residual Error Parameters

Bayesian NLME with MCMC · Tutorial 238 of 797

Priors for Residual Error Parameters

Choose priors for residual-error scales that respect positivity and produce plausible observation-level variability across the range of model predictions.

Advanced 12 min read

What You'll Learn

  • Distinguish additive residual SDs, proportional residual CVs, and combined-error components.
  • Choose positive-support priors whose scales have clear units and interpretations.
  • Account for the Jacobian when a prior on an error scale is sampled on the log scale.
  • Calculate implied residual SDs at low, typical, and high predicted values.
  • Diagnose priors that imply implausible variability or rely on an unsuitable error structure.
  • Compare half-normal, half-t, lognormal, and bounded priors for residual scales.

Why Residual-Error Priors Need Their Own Calibration

A residual-error prior affects how much variation the model attributes to measurement or unexplained within-individual differences, rather than to the structural model or between-individual variation. It therefore changes the likelihood across observations and can influence estimates of other model parameters. A prior that looks numerically small may still imply excessive error at high predicted concentrations, while a prior that seems broad may be too restrictive near zero.

The key is to assess the prior on the observation scale. An additive residual standard deviation has the same units as the observation. A proportional residual scale is dimensionless, but its implied standard deviation changes with the model prediction. A combined model has both components. Prior calibration should therefore use plausible predictions over the range of the data, not just a stand-alone numerical scale.

Definition: Let \(y_{ij}\) be observation \(j\) from individual \(i\), and let \(f_{ij}\) be the model-predicted mean conditional on the population parameters and that individual's random effects. A normal residual model specifies \(y_{ij}\mid f_{ij},\boldsymbol{\theta},\boldsymbol{\eta}_i \sim N(f_{ij},\sigma_{ij}^2)\). The residual-error parameters determine \(\sigma_{ij}\), the conditional residual standard deviation. The variance is \(\sigma_{ij}^2\).

This formulation assumes the residuals have conditional mean zero and the stated variance, and that observations are conditionally independent given the model quantities, unless a different dependence structure is explicitly specified. Normality is an additional modeling assumption, not a consequence of choosing a prior. The prior determines plausible values of the residual parameters; it does not repair a misspecified residual distribution or dependence structure.

Three Common Residual-Error Structures

For an additive-error model, the residual standard deviation is constant across predictions. For a proportional-error model, it increases in proportion to the magnitude of the prediction. A common combined-error convention adds the component variances. The formulas below define that convention explicitly; software may use different parameterizations, so check its definition before transferring a prior.

Definition: In the additive model, \(\sigma_{ij}=\sigma_a\), where \(\sigma_a>0\) has the same units as \(y_{ij}\). In the proportional model, \(\sigma_{ij}=\sigma_p|f_{ij}|\), where \(\sigma_p>0\) is dimensionless. In the combined model, \(\sigma_{ij}^2=\sigma_a^2+\sigma_p^2 f_{ij}^2\), with \(\sigma_a>0\) and \(\sigma_p>0\). Thus \(\sigma_{ij}=\sqrt{\sigma_a^2+\sigma_p^2 f_{ij}^2}\).

The absolute value in the proportional model ensures that the standard deviation is nonnegative even if a prediction can be negative. When predictions are positive concentrations, \(\sigma_p\) is the conditional residual coefficient of variation under the normal model: the residual SD divided by the prediction is \(\sigma_p\). For example, \(\sigma_p=0.10\) corresponds to a residual SD equal to 10% of a positive prediction. The combined formula does not add the two SDs. It adds variances, as would result from independent additive and prediction-scaled error components.

Choosing Positive-Support Priors

Residual SDs and CVs cannot be negative. A prior directly on one of these scales should therefore have support only on positive values. Common choices include a half-normal, half-\(t\), and lognormal distribution. Each can be reasonable, but its scale and tail behavior must be calibrated to the context.

  • Half-normal: the absolute value of a zero-centered normal variable. Its scale parameter \(\tau\) has the same units as the residual SD. It concentrates near zero but has a relatively light tail.
  • Half-\(t\): a positive-valued \(t\)-distributed scale, often used when more prior probability for large values is desired. Its scale parameter also uses the units of the residual SD; degrees of freedom control tail heaviness.
  • Lognormal: if \(\log(\sigma)\sim N(m,s^2)\), then \(\sigma\) is positive, with median \(\exp(m)\). This parameterization is useful for quantities that vary multiplicatively, but its upper tail can be substantial.

A prior on a variance is not interchangeable with a prior on its standard deviation. For instance, a uniform prior on \(\sigma^2\) induces a density on \(\sigma\) proportional to \(\sigma\), rather than a uniform density on \(\sigma\). Likewise, putting a prior on \(\log(\sigma)\) and putting a prior on \(\sigma\) are different choices. If computation uses \(u=\log(\sigma)\) but the intended prior is specified on \(\sigma\), the density in the sampled coordinate must include the change-of-variable factor:

$$ p_u(u)=p_\sigma(\exp(u))\exp(u),\qquad \sigma=\exp(u). $$

The factor \(\exp(u)\) is the Jacobian. Omitting it changes the prior on \(\sigma\). Alternatively, one may intentionally specify a normal prior directly on \(u=\log(\sigma)\); that induces a lognormal prior on \(\sigma\), and no additional Jacobian is needed if the model is formulated with that prior on \(u\).

Worked Example: Calibrating an Additive-Error Prior

Suppose a hypothetical assay reports concentrations in mg/L. Scientific knowledge suggests that a typical additive residual SD is around 0.15 mg/L, and an SD near 0.5 mg/L would already be large for the intended application. Consider the prior \(\sigma_a\sim\text{Half-Normal}(0,0.25^2)\), where 0.25 mg/L is the half-normal scale.

For a zero-centered normal variable, the 95th percentile of its absolute value is approximately \(1.96\) times its SD. Thus the prior's 95th percentile is

$$ 1.96(0.25\ \text{mg/L})=0.490\ \text{mg/L}. $$

The prior mean is \(0.25\sqrt{2/\pi}=0.1995\) mg/L. These summaries put substantial prior mass near the anticipated 0.15 mg/L while allowing values approaching 0.5 mg/L, consistent with the stated judgment. Since this is an additive model, the same prior SD applies whether the predicted concentration is 0.2 mg/L or 5 mg/L. If that constant variability is implausible across the prediction range, changing the prior alone will not fix the structural choice of an additive error model.

Worked Example: Calibrating a Proportional-Error Prior

In a hypothetical concentration model, suppose prior knowledge places the proportional residual scale near 15%, while values above 30% should be unusual. Set \(\log(\sigma_p)\sim N(\log(0.15),s^2)\) and choose \(s\) so that the 95th percentile is 0.30. Since the 95th standard normal quantile is approximately 1.645,

$$ s=\frac{\log(0.30)-\log(0.15)}{1.645} =\frac{\log(2)}{1.645} \approx 0.4214. $$

This lognormal prior has median \(\exp(\log(0.15))=0.15\), and its 5th percentile is

$$ 0.15\exp(-1.645(0.4214))\approx 0.0750. $$

The central 90% prior interval for \(\sigma_p\) is therefore approximately 0.075 to 0.30, or 7.5% to 30%. At a prediction of 4 mg/L, the median prior value implies an SD of \(0.15(4)=0.600\) mg/L; the 95th-percentile scale implies \(0.30(4)=1.20\) mg/L. The prior is dimensionless, but its observation-scale implications are in mg/L and increase with the prediction.

Combined Error: Check the Whole Prediction Range

For a combined model, calibrate both components and inspect the resulting SD at several representative predictions. Neither component can be judged in isolation: the additive term can dominate near zero, while the proportional term can dominate at larger predictions. This behavior follows directly from the variance formula.

$$ \sigma_{ij}=\sqrt{\sigma_a^2+\sigma_p^2f_{ij}^2}. $$

For example, the additive and proportional contributions to variance are equal when \(\sigma_a^2=\sigma_p^2 f_{ij}^2\), or, for a positive prediction, when \(f_{ij}=\sigma_a/\sigma_p\). Below that prediction the additive component contributes more variance; above it the proportional component contributes more.

Worked Example: Checking a Combined Prior at Low and High Predictions

Consider hypothetical concentrations in mg/L and independent priors \(\sigma_a\sim\text{Half-Normal}(0,0.20^2)\) mg/L and \(\log(\sigma_p)\sim N(\log(0.08),0.40^2)\). To understand their scale, evaluate the combined formula at the component prior medians. The half-normal median is approximately \(0.6745(0.20)=0.1349\) mg/L, and the lognormal median is 0.08.

At a prediction of 0.5 mg/L, the reference combined SD is

$$ \sqrt{(0.1349\ \text{mg/L})^2+(0.08(0.5\ \text{mg/L}))^2} =\sqrt{0.01820+0.00160}\ \text{mg/L} \approx 0.1407\ \text{mg/L}. $$

At a prediction of 5 mg/L, it is

$$ \sqrt{(0.1349\ \text{mg/L})^2+(0.08(5\ \text{mg/L}))^2} =\sqrt{0.01820+0.1600}\ \text{mg/L} \approx 0.4221\ \text{mg/L}. $$

These are reference calculations using the component medians, not a 95% interval for the combined SD. They show that the same prior pair implies different observation-scale variability across the prediction range. For an additional stress check, the component 95th percentiles are approximately \(1.96(0.20)=0.392\) mg/L and \(0.08\exp(1.645(0.40))\approx0.154\). At 5 mg/L, using both upper component values gives \(\sqrt{0.392^2+(0.154(5))^2}\approx0.864\) mg/L. This is an upper-corner scenario, not a 95th percentile of the combined SD; with independent priors, the probability both components fall below their separate 95th percentiles is \(0.95^2=0.9025\).

Calibration, Diagnostics, and Common Alternatives

A practical prior check is to draw residual parameters from their prior, combine each draw with plausible model predictions, and inspect the resulting residual SDs or simulated observations on the measurement scale. Include predictions near the low end, a typical value, and the high end. If observations have different units across outcomes, calibrate each outcome's error parameters in its own measurement units. This is a prior predictive check: it asks what data variability the specified model and priors imply before using the observed data.

1
Write the error equation.
State whether the model is additive, proportional, or combined, and identify whether the parameter is an SD, variance, or CV.
2
Set support and units.
Use positive support for SDs and CVs. The additive SD uses observation units; the proportional scale is dimensionless.
3
Calibrate with domain knowledge.
Choose prior summaries, such as a median and an upper quantile, that correspond to interpretable amounts of observation-scale variation.
4
Check implied variability.
Evaluate or simulate residual SDs across plausible predictions. Revise priors or the error structure if the implied observations are implausible.

The alternatives have different consequences. A half-normal is straightforward to calibrate by its scale and suppresses very large values relatively quickly. A half-\(t\) allows more upper-tail mass, which may be useful when large residual SDs are plausible but can also permit implausible observation variability. A lognormal expresses uncertainty multiplicatively and is often easier to discuss through its median and quantiles. A bounded prior can rule out values outside known physical or operational limits, but the bound must be defensible; an arbitrary tight bound can force the likelihood to compensate elsewhere.

A common mistake is to put a normal prior directly on a residual SD because normal priors are familiar. That assigns positive probability to negative SDs, which are not valid values. Another is to put a prior on the residual variance while interpreting its parameter as an SD. The correction is to define the error parameter precisely, choose a prior with appropriate support, and verify the induced variability in the likelihood. Also avoid assuming that a proportional scale is a fixed SD: its implied SD is \(\sigma_p|f_{ij}|\). If residual plots or scientific knowledge indicate correlation, skewness, or a different variance trend, changing the prior family alone does not address that model inadequacy.

Key takeaway: A residual-error prior is well calibrated only when its support, units, and implied observation-scale variability are plausible. For combined error, inspect both components together at predictions across the data range.

Check Your Understanding

Answer each question, then compare with the solutions below.

  1. In an additive model with observations measured in ng/mL, what units must the residual SD have? What units does the proportional residual scale have?
  2. A proportional scale is 0.12 and the prediction is 3.0 mg/L. What is the implied residual SD?
  3. For a combined model, let \(\sigma_a=0.10\) mg/L, \(\sigma_p=0.05\), and \(f=2.0\) mg/L. Calculate the residual SD.
  4. Why does sampling \(u=\log(\sigma)\) require care if the intended prior is defined directly on \(\sigma\)?

Solutions. (1) The additive SD is in ng/mL, the same units as the observation. The proportional scale is dimensionless. (2) The SD is \(0.12(3.0\ \text{mg/L})=0.360\) mg/L. (3) The combined SD is \(\sqrt{0.10^2+(0.05(2.0))^2}=\sqrt{0.0200}\approx0.1414\) mg/L. (4) The transformation from \(\sigma\) to \(u\) has Jacobian \(\exp(u)\), so a prior specified on \(\sigma\) has density \(p_\sigma(\exp(u))\exp(u)\) in \(u\). Omitting that factor changes the induced prior.