A two-compartment oral PK model with [derived] columns for micro-rate constants and NCA-style summaries: peak (CMAX, TMAX), first-week AUC (AUC_0_168), and a periodic 24-h AUC (AUC_TAU).
Model
library (ferx)
ex <- ferx_example ("two_cpt_oral_derived" )
ferx_model_show (ex$ model)
# model: two_cpt_oral_derived.ferx
# Two-compartment oral PK with [derived] output
[parameters]
theta TVCL(5.0, 0.1, 50.0)
theta TVV1(30.0, 3.0, 300.0)
theta TVQ( 2.0, 0.1, 20.0)
theta TVV2(50.0, 5.0, 500.0)
theta TVKA(1.0, 0.05, 20.0)
omega ETA_CL ~ 0.09
omega ETA_V1 ~ 0.09
sigma PROP_ERR ~ 0.02 (sd)
[individual_parameters]
CL = TVCL * exp(ETA_CL)
V1 = TVV1 * exp(ETA_V1)
Q = TVQ
V2 = TVV2
KA = TVKA
[structural_model]
pk two_cpt_oral(cl=CL, v1=V1, q=Q, v2=V2, ka=KA)
[error_model]
DV ~ proportional(PROP_ERR)
[derived]
K10 = CL / V1
K12 = Q / V1
K21 = Q / V2
CMAX = max(IPRED)
TMAX = tmax(IPRED)
AUC_0_168 = integral(IPRED, from=0, to=168, step=0.2)
AUC_TAU = integral(IPRED, window=24, anchor=0, step=0.2)
[output]
CL V1 Q V2 KA
[fit_options]
method = focei
maxiter = 500
The [derived] block computes:
K10
CL / V1
Elimination micro-rate constant
K12
Q / V1
Central→peripheral micro-rate
K21
Q / V2
Peripheral→central micro-rate
CMAX
max(IPRED)
Subject peak concentration
TMAX
tmax(IPRED)
Time of peak
AUC_0_168
integral(IPRED, from=0, to=168, step=0.2)
Week-1 AUC
AUC_TAU
integral(IPRED, window=24, anchor=0, step=0.2)
Periodic 24-h AUC
[output] echoes CL, V1, Q, V2, KA into sdtab.
This example uses the two_cpt_oral_cov dataset (which has WT and CRCL covariate columns). The model does not use these covariates — they are present in the dataset but ignored by the structural and individual-parameter blocks.
Fit
fit <- ferx_fit (ex$ model, ex$ data, verbose = FALSE )
print (fit)
============================================================
NONLINEAR MIXED EFFECTS MODEL ESTIMATION
============================================================
Model: two_cpt_oral_derived Dataset: two_cpt_oral_cov
Method: FOCEI | Gradient: ANALYTIC | Subjects: 30 | Obs: 300
STATUS: CONVERGED 79 iterations 2.5s
OFV: -696.7943 AIC: -680.7943 BIC: -651.1641
MODEL STRUCTURE (auto-derived)
------------------------------------------------------------
Structural: 2-cpt oral (TVCL, TVV1, TVQ, TVV2, TVKA)
IIV: ETA_CL, ETA_V1
IOV: none
Residual: proportional
THETA
------------------------------------------------------------
Parameter Estimate SE %RSE
----------------------------------------------------
TVCL 4.414336 0.349622 7.9
TVV1 50.331634 3.729802 7.4
TVQ 8.900906 0.389988 4.4
TVV2 91.174884 2.717180 3.0
TVKA 1.274237 0.086413 6.8
OMEGA (between-subject variability)
------------------------------------------------------------
ETA_CL [log-normal] = 0.181992 CV% = 44.7 SE = 0.049934
ETA_V1 [log-normal] = 0.109042 CV% = 33.9 SE = 0.029767
SIGMA (residual error)
------------------------------------------------------------
PROP_ERR [proportional] = 0.106962 (var = 0.011441, CV% = 10.7) SE = 0.004936 [initial specified as SD]
SHRINKAGE
------------------------------------------------------------
ETA_CL: 1.4% ETA_V1: 2.4% EPS: 9.8%
DIAGNOSTICS
------------------------------------------------------------
Covariance: computed Cond: 8.9 DW: 0.61 [positive autocorrelation] IWRES lag-1 r: 0.657
RUN INFO
------------------------------------------------------------
Gradient (requested): auto (used: analytic)
ferx v0.3.0 (core v0.3.0)
SETTINGS (model file / call-time override)
------------------------------------------------------------
method focei [model only]
maxiter 500 [model only]
------------------------------------------------------------
2 warning -- call ferx_get_warnings(fit) for details
============================================================
Derived columns
[1] "ID" "TIME" "DV" "PRED" "IPRED" "CWRES"
[7] "IWRES" "EBE_OFV" "N_OBS" "TAFD" "TAD" "CL"
[13] "V1" "Q" "V2" "KA" "K10" "K12"
[19] "K21" "CMAX" "TMAX" "AUC_0_168" "AUC_TAU"
Micro-rate constants
K10, K12, K21 are per-row (constant per subject, dependent on EBE parameters):
head (unique (fit$ sdtab[, c ("ID" , "CL" , "V1" , "Q" , "V2" , "K10" , "K12" , "K21" )]))
ID CL V1 Q V2 K10 K12 K21
1 1 4.269122 34.27204 8.900906 91.17488 0.12456572 0.2597133 0.09762454
11 2 5.684280 42.37496 8.900906 91.17488 0.13414244 0.2100511 0.09762454
21 3 4.786121 51.33898 8.900906 91.17488 0.09322587 0.1733752 0.09762454
31 4 3.070183 27.35196 8.900906 91.17488 0.11224725 0.3254211 0.09762454
41 5 5.614791 44.67357 8.900906 91.17488 0.12568484 0.1992432 0.09762454
51 6 7.805921 41.54367 8.900906 91.17488 0.18789677 0.2142542 0.09762454
Peak and AUC summaries
head (unique (fit$ sdtab[, c ("ID" , "CMAX" , "TMAX" , "AUC_0_168" )]))
ID CMAX TMAX AUC_0_168
1 1 4.214750 1 88.36858
11 2 3.508051 2 65.50441
21 3 3.190077 2 79.24877
31 4 5.129848 1 121.02102
41 5 3.407356 2 66.55003
51 6 3.438284 1 45.33505
Periodic AUC
AUC_TAU changes from interval to interval as the concentration profile accumulates or washes out:
fit$ sdtab[fit$ sdtab$ ID == fit$ sdtab$ ID[1 ],
c ("TIME" , "TAFD" , "AUC_TAU" )]
TIME TAFD AUC_TAU
1 0.5 0.5 35.689405
2 1.0 1.0 35.689405
3 2.0 2.0 35.689405
4 4.0 4.0 35.689405
5 6.0 6.0 35.689405
6 8.0 8.0 35.689405
7 12.0 12.0 35.689405
8 24.0 24.0 11.635928
9 36.0 36.0 11.635928
10 48.0 48.0 8.208649