Example 2 — Warfarin (FOCE)

Model: 1-compartment oral, FOCEI Script: examples/02_warfarin_foce.py

Demonstrates FOCE with interaction on a 10-subject warfarin dataset.

Model

result = (
    ModelBuilder()
    .problem("Warfarin 1-cmt oral FOCE")
    .data("warfarin.csv")
    .subroutines(advan=2, trans=2)
    .pk("""
        KA = THETA(1) * EXP(ETA(1))
        CL = THETA(2) * EXP(ETA(2))
        V  = THETA(3) * EXP(ETA(3))
    """)
    .error("Y = F * (1 + EPS(1))")
    .theta([(0.01, 0.9, 20),
            (0.001, 0.13, 5),
            (0.1, 8.7, 200)])
    .omega([0.4, 0.3, 0.3])
    .sigma(0.05)
    .estimation(method="FOCE", interaction=True, maxeval=800)
    .build()
    .fit()
)

Output

openpkpd/estimation/foce.py:236: UserWarning: ETA1 shrinkage is 97.6% (>30%). EBE-based analyses for this parameter may be unreliable.
  res.compute_shrinkage()
openpkpd/estimation/foce.py:236: UserWarning: ETA2 shrinkage is 93.0% (>30%). EBE-based analyses for this parameter may be unreliable.
  res.compute_shrinkage()
openpkpd/estimation/foce.py:236: UserWarning: ETA3 shrinkage is 92.3% (>30%). EBE-based analyses for this parameter may be unreliable.
  res.compute_shrinkage()
Running FOCE estimation...
Method: FOCEI
OFV: -54.7903
AIC: -34.7903
BIC: inf   (n_obs = 0)
n_parameters: 10
Converged: True
THETA: [ 0.47705443  0.2507444  17.29224252]
OMEGA (diagonal): [0.43531212 0.25385275 0.41279692]
SIGMA (diagonal): [0.00135071]
ETA shrinkage: ['97.6%', '93.0%', '92.3%']
Shrinkage warnings:
  ETA1 shrinkage is 97.6% (>30%). EBE-based analyses for this parameter may be unreliable.
  ETA2 shrinkage is 93.0% (>30%). EBE-based analyses for this parameter may be unreliable.
  ETA3 shrinkage is 92.3% (>30%). EBE-based analyses for this parameter may be unreliable.
Figures saved to docs/_static/examples

Figures

GOF panel ETA histograms

Notes

  • interaction=True is recommended when proportional error is used with FOCE.

  • Eta shrinkage for this small dataset may be high (>30%) — interpret individual estimates with caution.