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].observations.auccp # AUC for cp of first subject
sim[1].observations.cmaxcp # Cmax for cp of first subject

simdf = DataFrame(sim)
first(simdf, 5)
5×36 DataFrame
Rowidtimecpcmdv_cpdv_cmauccpauccmthalfcpthalfcmcmaxcpcmaxcmtlagcptlagcmevidamtcmtratedurationssiirouteη_1η_2η_3η_4CentralMetaboliteCLVcCLMVMfmKKPMKM
String?Float64Float64?Float64?Float64?Float64?Float64?Float64?Float64?Float64?Float64?Float64?MissingMissingInt64?Float64?Symbol?Float64?Float64?Int8?Float64?NCA.Route?Float64?Float64?Float64?Float64?Float64?Float64?Float64?Float64?Float64?Float64?Float64?Float64?Float64?Float64?
110.0missingmissingmissingmissingmissingmissingmissingmissingmissingmissingmissingmissing12000.0Central0.00.000.0IVBolus0.00700991-0.06287730.06087070.5064942000.00.011.580946.952910.627613.27570.70.1726540.07399470.800531
210.042.59580.042.45580.0173.80455.71212.80582.8314742.45588.34338missingmissing0missingmissingmissingmissingmissingmissingmissing0.00700991-0.06287730.06087070.5064942000.00.011.580946.952910.627613.27570.70.1726540.07399470.800531
311.033.2856.6883433.02386.75715173.80455.71212.80582.8314742.45588.34338missingmissing0missingmissingmissingmissingmissingmissingmissing0.00700991-0.06287730.06087070.5064941562.8388.792411.580946.952910.627613.27570.70.1726540.07399470.800531
412.026.00948.2300326.1648.34338173.80455.71212.80582.8314742.45588.34338missingmissing0missingmissingmissingmissingmissingmissingmissing0.00700991-0.06287730.06087070.5064941221.22109.2611.580946.952910.627613.27570.70.1726540.07399470.800531
513.020.32417.7799920.38957.7397173.80455.71212.80582.8314742.45588.34338missingmissing0missingmissingmissingmissingmissingmissingmissing0.00700991-0.06287730.06087070.506494954.278103.28511.580946.952910.627613.27570.70.1726540.07399470.800531