Example: Three-compartment IV

This example fits a three-compartment IV bolus model. A third compartment is warranted when the concentration-time profile shows a distinct tri-exponential decline — an initial rapid distribution phase, a slower redistribution phase, and a terminal elimination phase.

Common drug classes: aminoglycosides at high doses, certain anesthetics (propofol, fentanyl), and some biologics with tissue redistribution.

Dataset

Standard NONMEM IV bolus format — identical to the two-compartment case. No absorption column required:

ID,TIME,DV,EVID,AMT,CMT,RATE,MDV
1,0,.,1,200,1,0,1
1,0.25,18.4,0,.,1,0,0
1,0.5,14.1,0,.,1,0,0
1,1,10.2,0,.,1,0,0
1,2,7.8,0,.,1,0,0
1,4,5.3,0,.,1,0,0
1,8,3.8,0,.,1,0,0
1,24,1.9,0,.,1,0,0

Model file

[parameters]
  theta TVCL(5.0, 0.1, 100.0)
  theta TVV1(10.0, 0.1, 500.0)
  theta TVQ2(2.0, 0.01, 50.0)
  theta TVV2(20.0, 0.1, 1000.0)
  theta TVQ3(1.5, 0.01, 50.0)
  theta TVV3(30.0, 0.1, 1000.0)

  omega ETA_CL ~ 0.09
  omega ETA_V1 ~ 0.04
  omega ETA_Q2 ~ 0.04
  omega ETA_V2 ~ 0.04
  omega ETA_Q3 ~ 0.04
  omega ETA_V3 ~ 0.04

  sigma PROP_ERR ~ 0.04

[individual_parameters]
  CL = TVCL * exp(ETA_CL)
  V1 = TVV1 * exp(ETA_V1)
  Q2 = TVQ2 * exp(ETA_Q2)
  V2 = TVV2 * exp(ETA_V2)
  Q3 = TVQ3 * exp(ETA_Q3)
  V3 = TVV3 * exp(ETA_V3)

[structural_model]
  pk three_cpt_iv_bolus(cl=CL, v1=V1, q2=Q2, v2=V2, q3=Q3, v3=V3)

[error_model]
  DV ~ proportional(PROP_ERR)

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

The three_cpt_iv_bolus built-in solves the three-compartment system analytically, without ODE integration. Six macro parameters are estimated.

Running

library(ferx)
ex  <- ferx_example("three_cpt_iv")
fit <- ferx_fit(ex$model, ex$data)
fit

Tips

  • Dataset requirements: six partially-collinear parameters (CL, V1, Q2, V2, Q3, V3) need dense sampling from the first minutes post-dose through the terminal phase. Sparse designs frequently produce non-estimable Q3 or V3.
  • Run time: expect roughly 2–5× longer than a comparable two-compartment fit. For exploratory runs, drop BSV on the inter-compartmental parameters (Q2, V2, Q3, V3) and re-add after the structural model converges.
  • Identifiability check: inspect condition number of the covariance matrix (fit$cov_matrix). A condition number > 1000 suggests parameter collinearity; consider fixing one of Q2/Q3 to a literature value.
  • SAEM→FOCEI chain: for complex datasets where FOCEI alone stalls, method = [saem, focei] often finds the global minimum more reliably.

See also