Error Model
The [error_model] block defines the residual error structure, specifying how observed data (DV) relates to model predictions.
Syntax
DV ~ ERROR_TYPE(SIGMA_PARAMS)
Available error models
Additive
DV ~ additive(SIGMA_NAME)
The residual variance is constant across all predictions:
\[\text{Var}(DV) = \sigma^2\]
Use when measurement error is independent of concentration (e.g. an assay with fixed precision).
Proportional
DV ~ proportional(SIGMA_NAME)
The residual variance scales with the predicted value:
\[\text{Var}(DV) = (\sigma \cdot f)^2\]
where \(f\) is the model prediction. Use when measurement error increases with concentration — the most common error model in PK.
Combined
DV ~ combined(SIGMA_PROP, SIGMA_ADD)
Combines proportional and additive components:
\[\text{Var}(DV) = (\sigma_1 \cdot f)^2 + \sigma_2^2\]
Use when both proportional and additive error sources are present. Requires two sigma parameters in [parameters].
Sigma scale
Initial value scale
The initial value for sigma is on the variance scale by default, matching omega. Use the (sd) annotation to specify the initial value as a standard deviation instead — the parser squares it before storing.
sigma PROP_ERR ~ 0.0004 # variance → SD = 0.02 → 2% CV
sigma PROP_ERR ~ 0.02 (sd) # SD coding → same result
The (sd) form is used throughout the bundled examples because it is easier to reason about: “I expect ~2% CV” → ~ 0.02 (sd).
Estimate scale
Regardless of how the initial value is written, estimates are always reported on the SD scale — in print(fit), ferx_estimates(), and the fit YAML.
| Error model | Estimated sigma means … |
|---|---|
proportional |
Residual SD scales as \(\sigma \cdot f\), i.e. CV% = \(\sigma \times 100\) |
additive |
Residual SD is \(\sigma\) in the units of DV |
combined |
First sigma is proportional (CV-style), second is additive (units of DV) |
The fit YAML emits both the SD (estimate) and the variance (variance: estimate²); for proportional components it also emits cv_pct = estimate * 100. The SE in ferx_estimates() is on the SD scale — multiply by 100 for an SE in CV-percentage points.
Examples
Proportional error (most common), using (sd) coding:
[parameters]
sigma PROP_ERR ~ 0.02 (sd) # 2% CV initial value
[error_model]
DV ~ proportional(PROP_ERR)
Additive error:
[parameters]
sigma ADD_ERR ~ 1.0 # variance → SD = 1.0 (same here)
# or equivalently:
# sigma ADD_ERR ~ 1.0 (sd)
[error_model]
DV ~ additive(ADD_ERR)
Combined error:
[parameters]
sigma PROP_ERR ~ 0.1 (sd) # 10% CV proportional component
sigma ADD_ERR ~ 0.5 (sd) # 0.5 units additive component
[error_model]
DV ~ combined(PROP_ERR, ADD_ERR)
Impact on estimation
The error model affects:
- IWRES — \((DV - IPRED) / \sqrt{\text{Var}}\) — individual weighted residual
- CWRES — accounts for uncertainty in random-effect estimates via the conditional variance \(\tilde{R}\)
- OFV — the likelihood includes \(\log(\text{Var})\) terms, so error model structure directly influences parameter estimates
FOCEI is recommended when the error model is proportional or combined, because the interaction between residual error and individual predictions is captured exactly (rather than evaluated at η = 0 as in FOCE).