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)
5×36 DataFrame
Rowidtimecpcmdv_cpdv_cmauccpauccmthalfcpthalfcmcmaxcpcmaxcmtlagcptlagcmevidamtcmtratedurationssiirouteCentralMetaboliteCLVcCLMVMfmKKPMKMη_1η_2η_3η_4
StringFloat64Float64?Float64?Float64?Float64?Float64?Float64?Float64?Float64?Float64?Float64?MissingMissingInt64Float64?Symbol?Float64?Float64?Int8?Float64?NCA.Route?Float64?Float64?Float64?Float64?Float64?Float64?Float64?Float64?Float64?Float64?Float64Float64Float64Float64
110.0missingmissingmissingmissingmissingmissingmissingmissingmissingmissingmissingmissing12000.0Central0.00.000.0IVBolus2000.00.011.204850.752312.50768.053420.70.1545420.06623241.55308-0.02600420.01493330.223750.00665469
210.039.40710.039.29310.0179.28246.76953.139733.1415639.29317.35808missingmissing0missingmissingmissingmissingmissingmissingmissing2000.00.011.204850.752312.50768.053420.70.1545420.06623241.55308-0.02600420.01493330.223750.00665469
311.031.60057.2877131.90027.35808179.28246.76953.139733.1415639.29317.35808missingmissing0missingmissingmissingmissingmissingmissingmissing1603.7958.690911.204850.752312.50768.053420.70.1545420.06623241.55308-0.02600420.01493330.223750.00665469
412.025.34037.3860425.35387.33082179.28246.76953.139733.1415639.29317.35808missingmissing0missingmissingmissingmissingmissingmissingmissing1286.0859.482911.204850.752312.50768.053420.70.1545420.06623241.55308-0.02600420.01493330.223750.00665469
513.020.32036.2491420.20236.21602179.28246.76953.139733.1415639.29317.35808missingmissing0missingmissingmissingmissingmissingmissingmissing1031.350.326911.204850.752312.50768.053420.70.1545420.06623241.55308-0.02600420.01493330.223750.00665469