Example: Log-transform-both-sides (LTBS) error

The log-transform-both-sides (LTBS) error model fits additive (normal) residual error on the log scale. Writing log(DV) ~ additive(SIGMA_LOG) in the [error_model] block instructs ferx to log-transform both observations and model predictions before computing the likelihood.

Under LTBS the estimated SIGMA_LOG is the residual standard deviation on the log scale, which approximates the coefficient of variation on the natural scale for small values.

When to use LTBS

Situation Recommendation
Observations span several orders of magnitude LTBS
Log-normal residuals (variance proportional to mean²) Proportional or LTBS
Symmetry on log scale desired LTBS
Low concentrations near zero Proportional may be preferable; LTBS is singular at DV=0

LTBS and the proportional error model are asymptotically equivalent for small residual variance, but LTBS imposes exact log-normality while the proportional model is an approximation.

Model file

[parameters]
  theta TVCL(0.134, 0.001, 10.0)
  theta TVV(8.1, 0.1, 500.0)
  theta TVKA(1.0, 0.01, 50.0)

  omega ETA_CL ~ 0.07
  omega ETA_V  ~ 0.02
  omega ETA_KA ~ 0.40

  sigma SIGMA_LOG ~ 0.1 (sd)

[individual_parameters]
  CL = TVCL * exp(ETA_CL)
  V  = TVV  * exp(ETA_V)
  KA = TVKA * exp(ETA_KA)

[structural_model]
  pk one_cpt_oral(cl=CL, v=V, ka=KA)

[error_model]
  log(DV) ~ additive(SIGMA_LOG)

[fit_options]
  method     = focei
  maxiter    = 300
  covariance = true

The only difference from the standard proportional warfarin model is the log(DV) ~ prefix in [error_model] and the use of SIGMA_LOG (variance on the log scale) rather than PROP_ERR.

Running

library(ferx)

ex  <- ferx_example("warfarin_ltbs")
fit <- ferx_fit(ex$model, ex$data, method = "focei")
fit

Check how ferx labels the residual type:

fit$sigma_types
#> [1] "additive (log-transformed)"

ferx_model_inspect(fit)$residual
#> [1] "additive (log-transformed)"

Interpreting sigma

fit$sigma returns the estimated variance on the log scale. Take the square root to get the SD, which approximates the CV:

sqrt(fit$sigma)  # approximate CV on natural scale

For SIGMA_LOG ~ 0.1 (sd), the initial SD is 0.1 (≈ 10 % CV). The (sd) suffix means the initial value is already on the SD scale, consistent with the LTBS interpretation.

Alternative syntax

If the data file already contains log-transformed observations (i.e., DV is log(concentration)), use the log_additive shorthand instead:

[error_model]
  DV ~ log_additive(SIGMA_LOG)

This is equivalent to log(DV) ~ additive(SIGMA_LOG) when the data are pre-transformed.

See also