Skip to main content

ADDL/multiple-dose (warfarin)

Demonstrates the ADDL column for multiple-dose designs. A single dose row per subject (ADDL=6, II=24) is expanded to seven daily doses at read time; TAD resets to 0 at each expanded dose automatically. The [derived] block computes daily trough (CMIN_TAU), peak (CMAX), and periodic AUC (AUC_TAU).

Model

library(ferx)
ex <- ferx_example("warfarin_addl")
ferx_model_show(ex$model)
# model: warfarin_addl.ferx 
# Warfarin: multiple-dose design using ADDL column.
# The dataset has a single EVID=1 row per subject: ADDL=6, II=24
# (dose on day 1 + 6 additional doses = 7 daily doses).
# After ADDL expansion, subject.doses contains 7 explicit DoseEvents
# and TAD resets to 0 at each one automatically.

[parameters]
  theta TVCL(0.2, 0.001, 10.0)
  theta TVV(10.0, 0.1, 500.0)
  theta TVKA(1.5, 0.01, 50.0)

  omega ETA_CL ~ 0.09
  omega ETA_V  ~ 0.04
  omega ETA_KA ~ 0.30

  sigma PROP_ERR ~ 0.02 (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]
  DV ~ proportional(PROP_ERR)

[derived]
  KE     = CL / V
  T_HALF = 0.6931472 / KE

  # TAFD uses the first dose time; TAD resets at each expanded dose
  DAY    = floor(TAFD / 24) + 1

  CMAX   = max(IPRED)

  # Trough: minimum IPRED at dose time (TAD ~= 0 after ADDL expansion).
  # 1e-10 absorbs floating-point residuals from modular arithmetic.
  CMIN_TAU = min(IPRED, TAD < 1e-10)

  # Trough via window: last 4 h of the interval (no precision concern)
  CMIN_LATE = min(IPRED, TAD > 20)

  AUC_TAU = integral(IPRED, window=24, anchor=0, step=0.1)

[output]
  CL V KA

[fit_options]
  method  = foce
  maxiter = 300

Data structure

The dataset has one dose row per subject with ADDL=6, II=24 and observations spread across seven days: rich sampling on day 1, daily troughs at t = 24, 72, 120, 144 h (where TAD resets to 0 at each expanded dose), and rich steady-state sampling on day 7.

ferx_get_columns(ex)
Data file: /home/runner/work/_temp/Library/ferx/examples/data/warfarin_addl.csv
10 columns

 Required NONMEM:      [1] ID  [2] TIME  [3] DV  [4] EVID  [5] AMT  [6] CMT
 Optional NONMEM:      [7] RATE  [8] MDV  [9] II
 Covariates / other:   [10] ADDL
dat <- read.csv(ex$data)
head(dat[dat$EVID == 1, ])   # dose rows: ADDL=6, II=24
   ID TIME DV EVID AMT CMT RATE MDV II ADDL
1   1    0  .    1 100   1    0   1 24    6
18  2    0  .    1 100   1    0   1 24    6
35  3    0  .    1 100   1    0   1 24    6
52  4    0  .    1 100   1    0   1 24    6
69  5    0  .    1 100   1    0   1 24    6
86  6    0  .    1 100   1    0   1 24    6

Fit

fit <- ferx_fit(ex$model, ex$data)
print(fit)
============================================================
 NONLINEAR MIXED EFFECTS MODEL ESTIMATION
============================================================
 Model: warfarin_addl            Dataset: warfarin_addl
 Method: FOCE | Gradient: ANALYTIC | Subjects: 10 | Obs: 160

 STATUS: CONVERGED   47 iterations   1.3s
 OFV: 437.9396    AIC: 451.9396    BIC: 473.4659

MODEL STRUCTURE (auto-derived)
------------------------------------------------------------
  Structural:  1-cpt oral  (TVCL, TVV, TVKA)
  IIV:         ETA_CL, ETA_V, ETA_KA
  IOV:         none
  Residual:    proportional

THETA
------------------------------------------------------------
Parameter            Estimate           SE       %RSE
----------------------------------------------------
TVCL                 0.220216     0.014558        6.6
TVV                 10.570086     0.745985        7.1
TVKA                 1.666930     0.329792       19.8

OMEGA  (between-subject variability)
------------------------------------------------------------
  ETA_CL               [log-normal] = 0.045331  (CV% = 21.5)  SE = 0.022832
  ETA_V                [log-normal] = 0.049314  (CV% = 22.5)  SE = 0.025482
  ETA_KA               [log-normal] = 0.328928  (CV% = 62.4)  SE = 0.217225

SIGMA  (residual error)
------------------------------------------------------------
  PROP_ERR         [proportional] = 0.161349  (var = 0.026034, CV% = 16.1)  SE = 0.013085  [initial specified as SD]

SHRINKAGE
------------------------------------------------------------
 ETA_CL: 5.2%   ETA_V: 6.9%   ETA_KA: 14.2%   EPS: 7.4%

DIAGNOSTICS
------------------------------------------------------------
 Covariance: computed   Cond: 4.8   DW: 2.23 [no autocorrelation]   IWRES lag-1 r: -0.122

RUN INFO
------------------------------------------------------------
 Gradient (requested): auto   (used: analytic)
 ferx v0.4.0.9000 (core v0.4.0)

SETTINGS  (model file / call-time override)
------------------------------------------------------------
  method                       foce  [model only]
  maxiter                      300  [model only]
============================================================

Derived columns

# Per-subject summary (scalar derived quantities broadcast to all rows)
subj_summary <- unique(fit$sdtab[, c("ID", "KE", "T_HALF", "CMAX", "CMIN_TAU",
                                      "CMIN_LATE", "AUC_TAU")])
print(subj_summary, row.names = FALSE)
 ID         KE   T_HALF     CMAX CMIN_TAU CMIN_LATE  AUC_TAU
  1 0.02091093 33.14761 21.84428 5.685745 13.979486 173.5974
  1 0.02091093 33.14761 21.84428 5.685745 13.979486 296.0369
  1 0.02091093 33.14761 21.84428 5.685745 13.979486 269.0832
  1 0.02091093 33.14761 21.84428 5.685745 13.979486 323.2175
  1 0.02091093 33.14761 21.84428 5.685745 13.979486 431.3975
  1 0.02091093 33.14761 21.84428 5.685745 13.979486 335.5077
  2 0.02829320 24.49872 19.62157 5.307544 10.675247 179.4840
  2 0.02829320 24.49872 19.62157 5.307544 10.675247 292.9854
  2 0.02829320 24.49872 19.62157 5.307544 10.675247 224.7334
  2 0.02829320 24.49872 19.62157 5.307544 10.675247 251.8950
  2 0.02829320 24.49872 19.62157 5.307544 10.675247 363.1478
  2 0.02829320 24.49872 19.62157 5.307544 10.675247 256.2059
  3 0.02458470 28.19425 25.07667 6.631236 14.639318 215.5423
  3 0.02458470 28.19425 25.07667 6.631236 14.639318 355.1790
  3 0.02458470 28.19425 25.07667 6.631236 14.639318 296.2679
  3 0.02458470 28.19425 25.07667 6.631236 14.639318 342.5455
  3 0.02458470 28.19425 25.07667 6.631236 14.639318 475.5772
  3 0.02458470 28.19425 25.07667 6.631236 14.639318 351.3436
  4 0.01292486 53.62899 28.65652 6.690098 22.224787 180.3081
  4 0.01292486 53.62899 28.65652 6.690098 22.224787 329.2200
  4 0.01292486 53.62899 28.65652 6.690098 22.224787 364.6428
  4 0.01292486 53.62899 28.65652 6.690098 22.224787 491.3355
  4 0.01292486 53.62899 28.65652 6.690098 22.224787 617.1042
  4 0.01292486 53.62899 28.65652 6.690098 22.224787 533.3949
  5 0.02727511 25.41318 23.58933 6.645208 13.692500 216.3079
  5 0.02727511 25.41318 23.58933 6.645208 13.692500 363.1535
  5 0.02727511 25.41318 23.58933 6.645208 13.692500 285.4276
  5 0.02727511 25.41318 23.58933 6.645208 13.692500 322.4454
  5 0.02727511 25.41318 23.58933 6.645208 13.692500 455.4343
  5 0.02727511 25.41318 23.58933 6.645208 13.692500 328.6200
  6 0.01465072 47.31147 21.06407 4.961104 15.307137 140.9130
  6 0.01465072 47.31147 21.06407 4.961104 15.307137 247.2625
  6 0.01465072 47.31147 21.06407 4.961104 15.307137 261.7713
  6 0.01465072 47.31147 21.06407 4.961104 15.307137 342.6269
  6 0.01465072 47.31147 21.06407 4.961104 15.307137 437.2026
  6 0.01465072 47.31147 21.06407 4.961104 15.307137 367.3713
  7 0.02109607 32.85670 21.78741 5.755650 14.068976 174.5829
  7 0.02109607 32.85670 21.78741 5.755650 14.068976 299.9802
  7 0.02109607 32.85670 21.78741 5.755650 14.068976 271.5728
  7 0.02109607 32.85670 21.78741 5.755650 14.068976 325.5170
  7 0.02109607 32.85670 21.78741 5.755650 14.068976 434.0211
  7 0.02109607 32.85670 21.78741 5.755650 14.068976 337.6554
  8 0.02564063 27.03316 15.33002 4.374320  9.390287 135.6634
  8 0.02564063 27.03316 15.33002 4.374320  9.390287 234.5995
  8 0.02564063 27.03316 15.33002 4.374320  9.390287 192.3838
  8 0.02564063 27.03316 15.33002 4.374320  9.390287 220.3210
  8 0.02564063 27.03316 15.33002 4.374320  9.390287 302.5947
  8 0.02564063 27.03316 15.33002 4.374320  9.390287 225.3669
  9 0.01977656 35.04892 20.60588 5.141710 13.115687 158.2810
  9 0.01977656 35.04892 20.60588 5.141710 13.115687 265.5232
  9 0.01977656 35.04892 20.60588 5.141710 13.115687 247.9290
  9 0.01977656 35.04892 20.60588 5.141710 13.115687 301.8495
  9 0.01977656 35.04892 20.60588 5.141710 13.115687 400.7344
  9 0.01977656 35.04892 20.60588 5.141710 13.115687 314.7765
 10 0.02891420 23.97255 25.80301 7.038014 13.955597 238.8079
 10 0.02891420 23.97255 25.80301 7.038014 13.955597 390.4995
 10 0.02891420 23.97255 25.80301 7.038014 13.955597 295.4626
 10 0.02891420 23.97255 25.80301 7.038014 13.955597 329.6678
 10 0.02891420 23.97255 25.80301 7.038014 13.955597 477.8221
 10 0.02891420 23.97255 25.80301 7.038014 13.955597 334.9343

CMIN_TAU uses TAD < 1e-10 to locate the observation at the exact start of each dosing interval (where TAD resets to 0 after ADDL expansion). CMIN_LATE uses TAD > 20 as an alternative window-based trough — less precise but avoids the floating-point boundary.

# DAY = floor(TAFD / 24) + 1; shows which dosing day each observation belongs to
head(fit$sdtab[, c("ID", "TIME", "TAFD", "TAD", "DAY", "IPRED")], 20)
   ID  TIME  TAFD  TAD DAY     IPRED
1   1   0.5   0.5  0.5   1  5.319748
2   1   1.0   1.0  1.0   1  7.515560
3   1   2.0   2.0  2.0   1  8.705849
4   1   4.0   4.0  4.0   1  8.628427
5   1   8.0   8.0  8.0   1  7.944945
6   1  24.0  24.0  0.0   2  5.685745
7   1  28.0  28.0  4.0   2 13.857942
8   1  32.0  32.0  8.0   2 12.754837
9   1  72.0  72.0  0.0   4 11.211801
10  1 120.0 120.0  0.0   6 13.237166
11  1 144.0 144.0  0.0   7 13.699554
12  1 145.0 145.0  1.0   7 20.931619
13  1 146.0 146.0  2.0   7 21.844278
14  1 148.0 148.0  4.0   7 21.228714
15  1 152.0 152.0  8.0   7 19.534171
16  1 168.0 168.0 24.0   8 13.979486
17  2   0.5   0.5  0.5   1  6.118433
18  2   1.0   1.0  1.0   1  8.488255
19  2   2.0   2.0  2.0   1  9.618914
20  2   4.0   4.0  4.0   1  9.339368

See also