Model integrated NCA
In addition to running NCA independently on a dataset, Pumas provides the ability to integrate NCA analysis as part of the model by annotating the observed variables of interest with @nca
in the @observed
block, see @observed
: Sampled observations.
In addition to the standard columns required as per PumasNDF, to perform integrated NCA it is required to pass route
column to compute dose NCA parameters that require dosage information. The column should have (not case-sensitive) "iv"
or "ev"
or "inf"
for bolus, extravascular and infusion modes of administration respectively, if the Dosage Regimen Terminology is used for specifying the dosage, the route
field should be specified.
parmet = @model begin
@param begin
θ ∈ VectorDomain(5)
Ω ∈ PDiagDomain(4)
σ_prop ∈ RealDomain(; lower = 0)
end
@random begin
η ~ MvNormal(Ω)
end
@pre begin
CL = θ[1] * exp(η[1])
Vc = θ[2] * exp(η[2])
CLM = θ[3] * exp(η[3])
VM = θ[4] * exp(η[4])
fm = θ[5]
K = (fm * (CL / Vc))
KPM = ((1 - fm) * (CL / Vc))
KM = (CLM / VM)
end
@dynamics begin
Central' = -K * Central - KPM * Central
Metabolite' = KPM * Central - KM * Metabolite
end
@derived begin
cp = @. Central / Vc
cm = @. Metabolite / VM
dv_cp ~ @. Normal(cp, abs(cp) * σ_prop)
dv_cm ~ @. Normal(cm, abs(cm) * σ_prop)
end
@observed begin
ncas := @nca dv_cp dv_cm
auccp, auccm = @. NCA.auc(ncas)
thalfcp, thalfcm = @. NCA.thalf(ncas)
cmaxcp, cmaxcm = @. NCA.cmax(ncas)
tlagcp, tlagcm = @. NCA.tlag(ncas)
end
end
ev = DosageRegimen(2000; ii = 24, addl = 3, route = NCA.IVBolus)
population = map(i -> Subject(; id = i, events = ev), 1:4)
parms = (;
θ = [
11.5, # CL
50.0, # V
10.0, # CLM
8.0, # VM
0.7, # fm
],
Ω = diagm(0 => [0.04, 0.04, 0.04, 0.04]),
σ_prop = 0.01,
)
The NCA functions can take any additional arguments discussed in The NCA Functions, same as when used directly on data. The NCA results are obtained as part of the simulation output and can be accessed directly for each subject or by converting the simulation result into a DataFrame
.
sim = simobs(parmet, population, parms; obstimes = 0:1:108)
sim[1].observed.auccp # AUC for cp of first subject
sim[1].observed.cmaxcp # Cmax for cp of first subject
simdf = DataFrame(sim)
first(simdf, 5)
Row | id | time | cp | cm | dv_cp | dv_cm | auccp | auccm | thalfcp | thalfcm | cmaxcp | cmaxcm | tlagcp | tlagcm | evid | amt | cmt | rate | duration | ss | ii | route | Central | Metabolite | CL | Vc | CLM | VM | fm | K | KPM | KM | η_1 | η_2 | η_3 | η_4 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
String | Float64 | Float64? | Float64? | Float64? | Float64? | Float64? | Float64? | Float64? | Float64? | Float64? | Float64? | Missing | Missing | Int64 | Float64? | Symbol? | Float64? | Float64? | Int8? | Float64? | NCA.Route? | Float64? | Float64? | Float64? | Float64? | Float64? | Float64? | Float64? | Float64? | Float64? | Float64? | Float64 | Float64 | Float64 | Float64 | |
1 | 1 | 0.0 | missing | missing | missing | missing | missing | missing | missing | missing | missing | missing | missing | missing | 1 | 2000.0 | Central | 0.0 | 0.0 | 0 | 0.0 | IVBolus | 2000.0 | 0.0 | 11.2048 | 50.7523 | 12.5076 | 8.05342 | 0.7 | 0.154542 | 0.0662324 | 1.55308 | -0.0260042 | 0.0149333 | 0.22375 | 0.00665469 |
2 | 1 | 0.0 | 39.4071 | 0.0 | 39.2931 | 0.0 | 179.282 | 46.7695 | 3.13973 | 3.14156 | 39.2931 | 7.35808 | missing | missing | 0 | missing | missing | missing | missing | missing | missing | missing | 2000.0 | 0.0 | 11.2048 | 50.7523 | 12.5076 | 8.05342 | 0.7 | 0.154542 | 0.0662324 | 1.55308 | -0.0260042 | 0.0149333 | 0.22375 | 0.00665469 |
3 | 1 | 1.0 | 31.6005 | 7.28771 | 31.9002 | 7.35808 | 179.282 | 46.7695 | 3.13973 | 3.14156 | 39.2931 | 7.35808 | missing | missing | 0 | missing | missing | missing | missing | missing | missing | missing | 1603.79 | 58.6909 | 11.2048 | 50.7523 | 12.5076 | 8.05342 | 0.7 | 0.154542 | 0.0662324 | 1.55308 | -0.0260042 | 0.0149333 | 0.22375 | 0.00665469 |
4 | 1 | 2.0 | 25.3403 | 7.38604 | 25.3538 | 7.33082 | 179.282 | 46.7695 | 3.13973 | 3.14156 | 39.2931 | 7.35808 | missing | missing | 0 | missing | missing | missing | missing | missing | missing | missing | 1286.08 | 59.4829 | 11.2048 | 50.7523 | 12.5076 | 8.05342 | 0.7 | 0.154542 | 0.0662324 | 1.55308 | -0.0260042 | 0.0149333 | 0.22375 | 0.00665469 |
5 | 1 | 3.0 | 20.3203 | 6.24914 | 20.2023 | 6.21602 | 179.282 | 46.7695 | 3.13973 | 3.14156 | 39.2931 | 7.35808 | missing | missing | 0 | missing | missing | missing | missing | missing | missing | missing | 1031.3 | 50.3269 | 11.2048 | 50.7523 | 12.5076 | 8.05342 | 0.7 | 0.154542 | 0.0662324 | 1.55308 | -0.0260042 | 0.0149333 | 0.22375 | 0.00665469 |