How to estimate lambdaZ selecting specific points for each ID?

Does anyone know how I can estimate lambdaZ for each individual by choosing the specific points for each subject? I found this equation:

lambdaz = NCA.lambdaz(pop_bolus_sd; threshold = 3) # Terminal Elimination Rate Constant, threshold=3 specifies the max no. of time point used for calculation
lambdaz_1 = NCA.lambdaz(pop_bolus_sd; slopetimes = [8, 12, 16]) # slopetimes in this case specifies the exact time point you want for the calculation

But I would choose the points for each one

Thank you

You can do some functional programming with map, reduce; or mapreduce to iterate over lists of options and get a DataFrame out for each NCA Subject and the vcat everything into a single DataFrame.

To learn more about Julia functions that we are using here check our Julia tutorial: Julia Basics

using NCA
using PharmaDatasets

pop = read_nca(
    observations = :dv,

# Just the first 3 subjects for MWE
pop = pop[1:3]

# Define slopetimes for each Subject.
# I am using a `Dict` here
slopetimes_dict = Dict(
    1 => [0.5, 0.75, 1.0],
    2 => [0.5, 0.75, 1.0],
    3 => [0.75, 1.0, 2.0],

    id -> DataFrame(;
        λz = NCA.lambdaz(pop[id]; slopetimes = slopetimes_dict[id])

Does that help you?

Here’s a MWE: