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 adition 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.0001)
  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)
ev1 = [Subject(id=i, events=ev) for i in 1:4]
p = (θ = [
  11.5,  #CL
  50.0,  #V
  10.0, #CLM
  8.0, #VM
  0.7,
],
Ω = 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, ev1, p)

sim[1].observations.auccp # AUC for cp of first subject
sim[1].observations.cmaxcp # Cmax for cp of first subject

simdf = DataFrame(sim)