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_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 (DUAL2) | Subjects: 10 | Obs: 160

 STATUS: CONVERGED   83 iterations   1.7s
 OFV: 437.3381    AIC: 451.3381    BIC: 472.8643

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.220865     0.014598        6.6
TVV                 10.594506     0.760543        7.2
TVKA                 1.668516     0.329271       19.7

OMEGA  (between-subject variability)
------------------------------------------------------------
  ETA_CL                   [log-normal]  = 0.045071  CV% = 21.5  SE = 0.022693
  ETA_V                    [log-normal]  = 0.049064  CV% = 22.4  SE = 0.025252
  ETA_KA                   [log-normal]  = 0.317467  CV% = 61.1  SE = 0.208533

SIGMA  (residual error)
------------------------------------------------------------
  PROP_ERR         [proportional] = 0.162628  (var = 0.026448, CV% = 16.3)  SE = 0.013296  [initial specified as SD]

SHRINKAGE
------------------------------------------------------------
 ETA_CL: 4.9%   ETA_V: 10.2%   ETA_KA: 13.2%   EPS: 7.6%

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

RUN INFO
------------------------------------------------------------
 Gradient (requested): auto   (used: analytic (Dual2))
 ferx v0.1.6 (core v0.1.6)

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.02105308 32.92379 21.80407 5.690902 13.929523 173.9020
  1 0.02105308 32.92379 21.80407 5.690902 13.929523 296.6108
  1 0.02105308 32.92379 21.80407 5.690902 13.929523 268.7053
  1 0.02105308 32.92379 21.80407 5.690902 13.929523 322.2378
  1 0.02105308 32.92379 21.80407 5.690902 13.929523 430.5146
  1 0.02105308 32.92379 21.80407 5.690902 13.929523 334.3086
  2 0.02756601 25.14500 19.41667 5.243885 10.729637 175.5885
  2 0.02756601 25.14500 19.41667 5.243885 10.729637 287.7194
  2 0.02756601 25.14500 19.41667 5.243885 10.729637 224.3112
  2 0.02756601 25.14500 19.41667 5.243885 10.729637 252.8226
  2 0.02756601 25.14500 19.41667 5.243885 10.729637 361.4935
  2 0.02756601 25.14500 19.41667 5.243885 10.729637 257.5113
  3 0.02528480 27.41359 24.79557 6.592680 14.284577 215.6498
  3 0.02528480 27.41359 24.79557 6.592680 14.284577 355.0844
  3 0.02528480 27.41359 24.79557 6.592680 14.284577 291.4773
  3 0.02528480 27.41359 24.79557 6.592680 14.284577 334.8580
  3 0.02528480 27.41359 24.79557 6.592680 14.284577 467.9988
  3 0.02528480 27.41359 24.79557 6.592680 14.284577 342.8299
  4 0.01330337 52.10312 28.02893 6.611472 21.600639 178.4672
  4 0.01330337 52.10312 28.02893 6.611472 21.600639 325.9845
  4 0.01330337 52.10312 28.02893 6.611472 21.600639 357.7689
  4 0.01330337 52.10312 28.02893 6.611472 21.600639 478.9092
  4 0.01330337 52.10312 28.02893 6.611472 21.600639 602.0438
  4 0.01330337 52.10312 28.02893 6.611472 21.600639 518.4153
  5 0.02662713 26.03161 23.26077 6.534187 13.679675 210.8681
  5 0.02662713 26.03161 23.26077 6.534187 13.679675 355.1982
  5 0.02662713 26.03161 23.26077 6.534187 13.679675 283.2740
  5 0.02662713 26.03161 23.26077 6.534187 13.679675 321.6976
  5 0.02662713 26.03161 23.26077 6.534187 13.679675 451.2211
  5 0.02662713 26.03161 23.26077 6.534187 13.679675 328.3122
  6 0.01399686 49.52164 21.17167 4.918681 15.597344 138.6984
  6 0.01399686 49.52164 21.17167 4.918681 15.597344 244.1052
  6 0.01399686 49.52164 21.17167 4.918681 15.597344 262.7095
  6 0.01399686 49.52164 21.17167 4.918681 15.597344 347.5560
  6 0.01399686 49.52164 21.17167 4.918681 15.597344 441.9387
  6 0.01399686 49.52164 21.17167 4.918681 15.597344 374.3363
  7 0.02154641 32.16997 21.67692 5.774092 13.917675 175.7851
  7 0.02154641 32.16997 21.67692 5.774092 13.917675 301.9107
  7 0.02154641 32.16997 21.67692 5.774092 13.917675 270.4686
  7 0.02154641 32.16997 21.67692 5.774092 13.917675 322.5552
  7 0.02154641 32.16997 21.67692 5.774092 13.917675 431.5141
  7 0.02154641 32.16997 21.67692 5.774092 13.917675 334.0242
  8 0.02637467 26.28079 14.92158 4.327036  9.116282 133.6985
  8 0.02637467 26.28079 14.92158 4.327036  9.116282 232.3967
  8 0.02637467 26.28079 14.92158 4.327036  9.116282 188.2741
  8 0.02637467 26.28079 14.92158 4.327036  9.116282 214.2617
  8 0.02637467 26.28079 14.92158 4.327036  9.116282 294.8110
  8 0.02637467 26.28079 14.92158 4.327036  9.116282 218.7908
  9 0.01976330 35.07245 20.34532 5.089378 12.987921 156.4035
  9 0.01976330 35.07245 20.34532 5.089378 12.987921 262.7954
  9 0.01976330 35.07245 20.34532 5.089378 12.987921 245.4599
  9 0.01976330 35.07245 20.34532 5.089378 12.987921 298.8920
  9 0.01976330 35.07245 20.34532 5.089378 12.987921 396.7068
  9 0.01976330 35.07245 20.34532 5.089378 12.987921 311.7101
 10 0.02727360 25.41459 25.69278 6.968952 14.360105 231.5649
 10 0.02727360 25.41459 25.69278 6.968952 14.360105 381.4126
 10 0.02727360 25.41459 25.69278 6.968952 14.360105 299.3396
 10 0.02727360 25.41459 25.69278 6.968952 14.360105 338.1659
 10 0.02727360 25.41459 25.69278 6.968952 14.360105 481.3399
 10 0.02727360 25.41459 25.69278 6.968952 14.360105 344.6425

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.250084
2   1   1.0   1.0  1.0   1  7.467992
3   1   2.0   2.0  2.0   1  8.712081
4   1   4.0   4.0  4.0   1  8.658896
5   1   8.0   8.0  8.0   1  7.970254
6   1  24.0  24.0  0.0   2  5.690902
7   1  28.0  28.0  4.0   2 13.890178
8   1  32.0  32.0  8.0   2 12.779037
9   1  72.0  72.0  0.0   4 11.196053
10  1 120.0 120.0  0.0   6 13.200035
11  1 144.0 144.0  0.0   7 13.655015
12  1 145.0 145.0  1.0   7 20.838532
13  1 146.0 146.0  2.0   7 21.804073
14  1 148.0 148.0  4.0   7 21.211078
15  1 152.0 152.0  8.0   7 19.508672
16  1 168.0 168.0 24.0   8 13.929523
17  2   0.5   0.5  0.5   1  5.956461
18  2   1.0   1.0  1.0   1  8.258441
19  2   2.0   2.0  2.0   1  9.356280
20  2   4.0   4.0  4.0   1  9.094307

See also