Simulating Model with OCC and other covariates

I’m trying to build a population for a simulation using a model which has IOV random effects modeling. But I have other covariates in the data set as well. I looked at the tutorial but, I am not able to build a population still.

This is what I have

pop1 = map(
    subj -> Subject(
        id = subj,
        events = DosageRegimen(app_df.BSA[subj] * 40; 
            addl = 6, ii = 24, rate = (app_df.BSA[subj] * 40) / 1.5, route = NCA.IVInfusion
        ),
        covariates = (
            WT = app_df.WT[subj],
            HT = app_df.HT[subj],
            AGE = app_df.AGE[subj],
            CR = app_df.CR[subj],
            OCC = [1,2,3,4,5]
        ),
        covariates_time = [0,24,48,96,100],
        observations = (; DV = nothing),
    ),
    1:nrow(app_df),
)

But I get the following error:

 Length of covariate WT (1) does not match length of covariates_time (5).
Stacktrace:
  [1] #22
    @ C:\build\run\_work\PumasSystemImages\PumasSystemImages\julia_depot\packages\Pumas\aZRyj\src\data_parsing\interpolation.jl:260 [inlined]
  [2] map(f::Pumas.var"#22#23"{Vector{…}}, t::Tuple{Float64, Int64, Int64, Float64, Vector{…}}, s::NTuple{5, Symbol})
    @ Base .\tuple.jl:322
  [3] map(f::Function, nt::@NamedTuple{…}, nts::@NamedTuple{…})
    @ Base .\namedtuple.jl:266
  [4] covariates_interpolant(covariates_nt::@NamedTuple{…}, covariates_times::Vector{…}, id::String; covariates_direction::Symbol)
    @ Pumas C:\build\run\_work\PumasSystemImages\PumasSystemImages\julia_depot\packages\Pumas\aZRyj\src\data_parsing\interpolation.jl:255
  [5] covariates_interpolant
    @ C:\build\run\_work\PumasSystemImages\PumasSystemImages\julia_depot\packages\Pumas\aZRyj\src\data_parsing\interpolation.jl:240 [inlined]
  [6] Subject(; id::Int64, observations::@NamedTuple{…}, events::DosageRegimen{…}, time::Nothing, covariates::@NamedTuple{…}, covariates_time::Vector{…}, covariates_direction::Symbol)
    @ Pumas C:\build\run\_work\PumasSystemImages\PumasSystemImages\julia_depot\packages\Pumas\aZRyj\src\data_parsing\io.jl:1326
  [7] (::var"#59#60")(subj::Int64)
    @ Main c:\Users\abhim\Desktop\codespaces\pmx\lagenhorst-model.jl:238
  [8] iterate
    @ .\generator.jl:47 [inlined]
  [9] _collect(c::UnitRange{…}, itr::Base.Generator{…}, ::Base.EltypeUnknown, isz::Base.HasShape{…})
    @ Base .\array.jl:854
 [10] collect_similar(cont::UnitRange{Int64}, itr::Base.Generator{UnitRange{Int64}, var"#59#60"})
    @ Base .\array.jl:763
 [11] map(f::Function, A::UnitRange{Int64})
    @ Base .\abstractarray.jl:3285
 [12] top-level scope
    @ c:\Users\abhim\Desktop\codespaces\pmx\lagenhorst-model.jl:237
Some type information was truncated. Use `show(err)` to see complete types.

@farmacyst here you need to repeat the length of the constant covariates to the be the same as the covariate that changes with time. See example below

julia> s1 = Subject(id = 1, events = DosageRegimen(100), 
                   covariates = (wt = fill(70, 2), 
                                 crcl = [120, 90]),
                   covariates_time = [0, 48])
Subject
  ID: 1
  Events: 1
  Covariates: wt, crcl

julia> 
1 Like