Covariates in emmodel diagnostics

I’m trying to run diagnostics on a SAEM parameter estimation

pkmodel = @emmodel begin
    @random begin
        Tlag ~ 1 | LogNormal
        ka ~ 1 | LogNormal
        Vc ~ 1 + logwt | LogNormal
        CL ~ 1 | LogNormal
    end
    @covariates logwt
    @dosecontrol begin
        lags  = Tlag
    end
    @dynamics begin
        Depot'   = -ka*Depot
        Central' =  ka*Depot - (CL/Vc)*Central
    end
    @post begin
        cp = Central/Vc
    end
    @error begin
        dv ~ CombinedNormal(cp)
    end
end

# Initialise parameters
ini_p = (
    Tlag = 1.0,
    ka = 1.0,
    Vc = (10.0, 4.0),
    CL = 0.1)

rngv = [MersenneTwister(1941964947i + 1) for i ∈ 1:Threads.nthreads()];
fit_res = fit(pkmodel, data_pop, ini_p, SAEM(); ensemblealg=EnsembleThreads(), rng=rngv)

Apparently, I don’t know the proper syntax in calculating the vpc or using inspect because if I run

continuous_vpc = vpc(fit_res)
fit_res_inspection = inspect(fit_res)

I get the following error in both cases:

ERROR: type NamedTuple has no field logwt

Furthermore, is it correct that I specify @covariate logwt because I use it in @random or should this be @covariate wt?

That depends. How are you importing your data? Can you paste also the read_pumas call here?

Oh, yes, sorry.

data_pop = read_pumas(
    data_pk;
    id = :id,
    time = :time,
    observations = [:dv],
    amt = :amt,
    covariates = [:logwt, :wt, :sex, :age]
    )

So, you see that I have a :wt and a transformed :logwt column in data_pk.

Can you give us a reproducible example, or at least a complete stack trace so we can have some idea of what is going on?

The full output after continuous_vpc = vpc(fit_res) is:

[ Info: Continuous VPC
β”Œ Warning: number of nodes returned (9) is less to number of nodes requested (11) to avoid duplicate node values
β”” @ Pumas /build/_work/PumasSystemImages/PumasSystemImages/julia_depot/packages/Pumas/9AGx1/src/estimation/vpc.jl:99
ERROR: type NamedTuple has no field logwt
Stacktrace:
  [1] getproperty
    @ ./Base.jl:38 [inlined]
  [2] (::var"#23#27")(t::Float64, param::NamedTuple{(:Tlag, :ka, :Vc, :CL), NTuple{4, Float64}})
    @ Main /build/_work/PumasSystemImages/PumasSystemImages/julia_depot/packages/Pumas/9AGx1/src/dsl/emmodel_macro.jl:37
  [3] (::Base.Fix2{var"#23#27", NamedTuple{(:Tlag, :ka, :Vc, :CL), NTuple{4, Float64}}})(y::Float64)
    @ Base ./operators.jl:1113
  [4] (::Pumas.ValTypeWrapper{(:Depot, :Central), Base.Fix2{var"#23#27", NamedTuple{(:Tlag, :ka, :Vc, :CL), NTuple{4, Float64}}}})(args::Float64)
    @ Pumas /build/_work/PumasSystemImages/PumasSystemImages/julia_depot/packages/Pumas/9AGx1/src/models/model_api.jl:2151
  [5] _problem(model::Pumas.PumasEMModel{(1, 1, 1, 1), 0, (:logwt,), (Symbol("##A##"), Symbol("##b##")), (:lags,), (:Depot, :Central), (:cp,), var"#23#27", Tuple{Pumas.Formula{:Tlag, (1,), :LogNormal}, Pumas.Formula{:ka, (1,), :LogNormal}, Pumas.Formula{:Vc, (1, :logwt), :LogNormal}, Pumas.Formula{:CL, (1,), :LogNormal}}, var"#22#26", var"#21#25", Pumas.LinearODE, var"#24#28", Tuple{Pumas.Error{:dv, :cp, :CombinedNormal}}, ModelingToolkit.ODESystem}, subject::Subject{NamedTuple{(:dv,), Tuple{Vector{Float64}}}, Pumas.ConstantCovar{NamedTuple{(:logwt, :wt, :sex, :age), Tuple{Float64, Float64, Int64, Int64}}}, StaticArraysCore.SVector{1, Pumas.Event{Float64, Float64, Float64, Float64, Float64, Float64, Int64}}, Vector{Float64}}, col::Pumas.Collated{NamedTuple{(:Tlag, :ka, :Vc, :CL), NTuple{4, Float64}}, var"#22#26", Pumas.ConstantCovar{NamedTuple{(:logwt, :wt, :sex, :age), Tuple{Float64, Float64, Int64, Int64}}}}, dcp::Pumas.ValTypeWrapper{(:Depot, :Central), Base.Fix2{var"#23#27", NamedTuple{(:Tlag, :ka, :Vc, :CL), NTuple{4, Float64}}}}, ::Val{Float64}; diffeq_options::NamedTuple{(:callback, :continuity, :saveat, :alg, :abstol, :reltol), Tuple{Nothing, Symbol, Vector{Float64}, OrdinaryDiffEq.CompositeAlgorithm{Tuple{Vern7{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, Rodas5{1, true, LinearSolve.LUFactorization{LinearAlgebra.RowMaximum}, typeof(OrdinaryDiffEq.DEFAULT_PRECS), Val{:forward}, true, nothing}}, OrdinaryDiffEq.AutoSwitch{Vern7{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, Rodas5{1, true, LinearSolve.LUFactorization{LinearAlgebra.RowMaximum}, typeof(OrdinaryDiffEq.DEFAULT_PRECS), Val{:forward}, true, nothing}, Rational{Int64}, Int64}}, Float64, Float64}}, steadystate_options::NamedTuple{(), Tuple{}})
    @ Pumas /build/_work/PumasSystemImages/PumasSystemImages/julia_depot/packages/Pumas/9AGx1/src/models/model_api.jl:1248
  [6] simobs(::Pumas.PumasEMModel{(1, 1, 1, 1), 0, (:logwt,), (Symbol("##A##"), Symbol("##b##")), (:lags,), (:Depot, :Central), (:cp,), var"#23#27", Tuple{Pumas.Formula{:Tlag, (1,), :LogNormal}, Pumas.Formula{:ka, (1,), :LogNormal}, Pumas.Formula{:Vc, (1, :logwt), :LogNormal}, Pumas.Formula{:CL, (1,), :LogNormal}}, var"#22#26", var"#21#25", Pumas.LinearODE, var"#24#28", Tuple{Pumas.Error{:dv, :cp, :CombinedNormal}}, ModelingToolkit.ODESystem}, ::Subject{NamedTuple{(:dv,), Tuple{Vector{Float64}}}, Pumas.ConstantCovar{NamedTuple{(:logwt, :wt, :sex, :age), Tuple{Float64, Float64, Int64, Int64}}}, StaticArraysCore.SVector{1, Pumas.Event{Float64, Float64, Float64, Float64, Float64, Float64, Int64}}, Vector{Float64}}, ::NamedTuple{(:ΞΌ, :Ο‰, :Οƒ), Tuple{NamedTuple{(:Tlag, :ka, :Vc, :CL), Tuple{Float64, Float64, StaticArraysCore.SVector{2, Float64}, Float64}}, NTuple{4, Float64}, Tuple{NamedTuple{(:ₐ, :β‚š), Tuple{Float64, Float64}}}}}, ::Nothing; obstimes::Nothing, ensemblealg::EnsembleSerial, diffeq_options::NamedTuple{(:alg, :callback, :abstol, :reltol), Tuple{OrdinaryDiffEq.CompositeAlgorithm{Tuple{Vern7{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, Rodas5{1, true, LinearSolve.LUFactorization{LinearAlgebra.RowMaximum}, typeof(OrdinaryDiffEq.DEFAULT_PRECS), Val{:forward}, true, nothing}}, OrdinaryDiffEq.AutoSwitch{Vern7{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, Rodas5{1, true, LinearSolve.LUFactorization{LinearAlgebra.RowMaximum}, typeof(OrdinaryDiffEq.DEFAULT_PRECS), Val{:forward}, true, nothing}, Rational{Int64}, Int64}}, Nothing, Float64, Float64}}, rng::TaskLocalRNG, simulate_error::Val{true}, isfor_derived::Val{false}, return_model::Val{true})
    @ Pumas /build/_work/PumasSystemImages/PumasSystemImages/julia_depot/packages/Pumas/9AGx1/src/models/model_api.jl:1525
  [7] #_simobs!#355
    @ /build/_work/PumasSystemImages/PumasSystemImages/julia_depot/packages/Pumas/9AGx1/src/models/model_api.jl:1819 [inlined]
  [8] _simobs(::Pumas.PumasEMModel{(1, 1, 1, 1), 0, (:logwt,), (Symbol("##A##"), Symbol("##b##")), (:lags,), (:Depot, :Central), (:cp,), var"#23#27", Tuple{Pumas.Formula{:Tlag, (1,), :LogNormal}, Pumas.Formula{:ka, (1,), :LogNormal}, Pumas.Formula{:Vc, (1, :logwt), :LogNormal}, Pumas.Formula{:CL, (1,), :LogNormal}}, var"#22#26", var"#21#25", Pumas.LinearODE, var"#24#28", Tuple{Pumas.Error{:dv, :cp, :CombinedNormal}}, ModelingToolkit.ODESystem}, ::Vector{Subject{NamedTuple{(:dv,), Tuple{Vector{Float64}}}, Pumas.ConstantCovar{NamedTuple{(:logwt, :wt, :sex, :age), Tuple{Float64, Float64, Int64, Int64}}}, StaticArraysCore.SVector{1, Pumas.Event{Float64, Float64, Float64, Float64, Float64, Float64, Int64}}, Vector{Float64}}}, ::StaticArraysCore.SVector{1, NamedTuple{(:ΞΌ, :Ο‰, :Οƒ), Tuple{NamedTuple{(:Tlag, :ka, :Vc, :CL), Tuple{Float64, Float64, StaticArraysCore.SVector{2, Float64}, Float64}}, NTuple{4, Float64}, Tuple{NamedTuple{(:ₐ, :β‚š), Tuple{Float64, Float64}}}}}}, ::Nothing; rng::TaskLocalRNG, diffeq_options::NamedTuple{(:abstol, :reltol, :alg), Tuple{Float64, Float64, OrdinaryDiffEq.CompositeAlgorithm{Tuple{Vern7{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, Rodas5{1, true, LinearSolve.LUFactorization{LinearAlgebra.RowMaximum}, typeof(OrdinaryDiffEq.DEFAULT_PRECS), Val{:forward}, true, nothing}}, OrdinaryDiffEq.AutoSwitch{Vern7{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, Rodas5{1, true, LinearSolve.LUFactorization{LinearAlgebra.RowMaximum}, typeof(OrdinaryDiffEq.DEFAULT_PRECS), Val{:forward}, true, nothing}, Rational{Int64}, Int64}}}}, isfor_derived::Val{false}, simulate_error::Val{true}, obstimes::Nothing, ensemblealg::EnsembleSerial)
    @ Pumas /build/_work/PumasSystemImages/PumasSystemImages/julia_depot/packages/Pumas/9AGx1/src/models/model_api.jl:2102
  [9] simobs(::Pumas.PumasEMModel{(1, 1, 1, 1), 0, (:logwt,), (Symbol("##A##"), Symbol("##b##")), (:lags,), (:Depot, :Central), (:cp,), var"#23#27", Tuple{Pumas.Formula{:Tlag, (1,), :LogNormal}, Pumas.Formula{:ka, (1,), :LogNormal}, Pumas.Formula{:Vc, (1, :logwt), :LogNormal}, Pumas.Formula{:CL, (1,), :LogNormal}}, var"#22#26", var"#21#25", Pumas.LinearODE, var"#24#28", Tuple{Pumas.Error{:dv, :cp, :CombinedNormal}}, ModelingToolkit.ODESystem}, ::Vector{Subject{NamedTuple{(:dv,), Tuple{Vector{Float64}}}, Pumas.ConstantCovar{NamedTuple{(:logwt, :wt, :sex, :age), Tuple{Float64, Float64, Int64, Int64}}}, StaticArraysCore.SVector{1, Pumas.Event{Float64, Float64, Float64, Float64, Float64, Float64, Int64}}, Vector{Float64}}}, ::NamedTuple{(:ΞΌ, :Ο‰, :Οƒ), Tuple{NamedTuple{(:Tlag, :ka, :Vc, :CL), Tuple{Float64, Float64, StaticArraysCore.SVector{2, Float64}, Float64}}, NTuple{4, Float64}, Tuple{NamedTuple{(:ₐ, :β‚š), Tuple{Float64, Float64}}}}}, ::Nothing; rng::TaskLocalRNG, kwargs::Base.Pairs{Symbol, Any, Tuple{Symbol, Symbol, Symbol}, NamedTuple{(:ensemblealg, :obstimes, :diffeq_options), Tuple{EnsembleSerial, Nothing, NamedTuple{(:abstol, :reltol, :alg), Tuple{Float64, Float64, OrdinaryDiffEq.CompositeAlgorithm{Tuple{Vern7{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, Rodas5{1, true, LinearSolve.LUFactorization{LinearAlgebra.RowMaximum}, typeof(OrdinaryDiffEq.DEFAULT_PRECS), Val{:forward}, true, nothing}}, OrdinaryDiffEq.AutoSwitch{Vern7{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, Rodas5{1, true, LinearSolve.LUFactorization{LinearAlgebra.RowMaximum}, typeof(OrdinaryDiffEq.DEFAULT_PRECS), Val{:forward}, true, nothing}, Rational{Int64}, Int64}}}}}}})
    @ Pumas /build/_work/PumasSystemImages/PumasSystemImages/julia_depot/packages/Pumas/9AGx1/src/models/model_api.jl:1981
 [10] #_simobs#1462
    @ /build/_work/PumasSystemImages/PumasSystemImages/julia_depot/packages/Pumas/9AGx1/src/estimation/vpc.jl:806 [inlined]
 [11] (::Pumas._VPCF{Nothing, Pumas.ContinuousVPC, Pumas.PumasEMModel{(1, 1, 1, 1), 0, (:logwt,), (Symbol("##A##"), Symbol("##b##")), (:lags,), (:Depot, :Central), (:cp,), var"#23#27", Tuple{Pumas.Formula{:Tlag, (1,), :LogNormal}, Pumas.Formula{:ka, (1,), :LogNormal}, Pumas.Formula{:Vc, (1, :logwt), :LogNormal}, Pumas.Formula{:CL, (1,), :LogNormal}}, var"#22#26", var"#21#25", Pumas.LinearODE, var"#24#28", Tuple{Pumas.Error{:dv, :cp, :CombinedNormal}}, ModelingToolkit.ODESystem}, Vector{Subject{NamedTuple{(:dv,), Tuple{Vector{Float64}}}, Pumas.ConstantCovar{NamedTuple{(:logwt, :wt, :sex, :age), Tuple{Float64, Float64, Int64, Int64}}}, StaticArraysCore.SVector{1, Pumas.Event{Float64, Float64, Float64, Float64, Float64, Float64, Int64}}, Vector{Float64}}}, NamedTuple{(:ΞΌ, :Ο‰, :Οƒ), Tuple{NamedTuple{(:Tlag, :ka, :Vc, :CL), Tuple{Float64, Float64, StaticArraysCore.SVector{2, Float64}, Float64}}, NTuple{4, Float64}, Tuple{NamedTuple{(:ₐ, :β‚š), Tuple{Float64, Float64}}}}}, EnsembleSerial, Tuple{}, TaskLocalRNG, NamedTuple{(:abstol, :reltol, :alg), Tuple{Float64, Float64, OrdinaryDiffEq.CompositeAlgorithm{Tuple{Vern7{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, Rodas5{1, true, LinearSolve.LUFactorization{LinearAlgebra.RowMaximum}, typeof(OrdinaryDiffEq.DEFAULT_PRECS), Val{:forward}, true, nothing}}, OrdinaryDiffEq.AutoSwitch{Vern7{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, Rodas5{1, true, LinearSolve.LUFactorization{LinearAlgebra.RowMaximum}, typeof(OrdinaryDiffEq.DEFAULT_PRECS), Val{:forward}, true, nothing}, Rational{Int64}, Int64}}}}, Vector{Any}, QuantileRegressions.IP, Vector{Any}, Pumas.FastNormal{Float64, Float64}})(i::Int64)
    @ Pumas /build/_work/PumasSystemImages/PumasSystemImages/julia_depot/packages/Pumas/9AGx1/src/estimation/vpc.jl:840
 [12] macro expansion
    @ /build/_work/PumasSystemImages/PumasSystemImages/julia_depot/packages/Pumas/9AGx1/src/estimation/progress.jl:53 [inlined]
 [13] macro expansion
    @ /build/_work/PumasSystemImages/PumasSystemImages/julia_depot/packages/ProgressLogging/6KXlp/src/ProgressLogging.jl:470 [inlined]
 [14] withprogress(f::Pumas._VPCF{Nothing, Pumas.ContinuousVPC, Pumas.PumasEMModel{(1, 1, 1, 1), 0, (:logwt,), (Symbol("##A##"), Symbol("##b##")), (:lags,), (:Depot, :Central), (:cp,), var"#23#27", Tuple{Pumas.Formula{:Tlag, (1,), :LogNormal}, Pumas.Formula{:ka, (1,), :LogNormal}, Pumas.Formula{:Vc, (1, :logwt), :LogNormal}, Pumas.Formula{:CL, (1,), :LogNormal}}, var"#22#26", var"#21#25", Pumas.LinearODE, var"#24#28", Tuple{Pumas.Error{:dv, :cp, :CombinedNormal}}, ModelingToolkit.ODESystem}, Vector{Subject{NamedTuple{(:dv,), Tuple{Vector{Float64}}}, Pumas.ConstantCovar{NamedTuple{(:logwt, :wt, :sex, :age), Tuple{Float64, Float64, Int64, Int64}}}, StaticArraysCore.SVector{1, Pumas.Event{Float64, Float64, Float64, Float64, Float64, Float64, Int64}}, Vector{Float64}}}, NamedTuple{(:ΞΌ, :Ο‰, :Οƒ), Tuple{NamedTuple{(:Tlag, :ka, :Vc, :CL), Tuple{Float64, Float64, StaticArraysCore.SVector{2, Float64}, Float64}}, NTuple{4, Float64}, Tuple{NamedTuple{(:ₐ, :β‚š), Tuple{Float64, Float64}}}}}, EnsembleSerial, Tuple{}, TaskLocalRNG, NamedTuple{(:abstol, :reltol, :alg), Tuple{Float64, Float64, OrdinaryDiffEq.CompositeAlgorithm{Tuple{Vern7{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, Rodas5{1, true, LinearSolve.LUFactorization{LinearAlgebra.RowMaximum}, typeof(OrdinaryDiffEq.DEFAULT_PRECS), Val{:forward}, true, nothing}}, OrdinaryDiffEq.AutoSwitch{Vern7{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, Rodas5{1, true, LinearSolve.LUFactorization{LinearAlgebra.RowMaximum}, typeof(OrdinaryDiffEq.DEFAULT_PRECS), Val{:forward}, true, nothing}, Rational{Int64}, Int64}}}}, Vector{Any}, QuantileRegressions.IP, Vector{Any}, Pumas.FastNormal{Float64, Float64}}, ::typeof(foreach), xs::UnitRange{Int64}; threshold::Float64, name::String)
    @ Pumas /build/_work/PumasSystemImages/PumasSystemImages/julia_depot/packages/Pumas/9AGx1/src/estimation/progress.jl:52
 [15] _vpc(model::Pumas.PumasEMModel{(1, 1, 1, 1), 0, (:logwt,), (Symbol("##A##"), Symbol("##b##")), (:lags,), (:Depot, :Central), (:cp,), var"#23#27", Tuple{Pumas.Formula{:Tlag, (1,), :LogNormal}, Pumas.Formula{:ka, (1,), :LogNormal}, Pumas.Formula{:Vc, (1, :logwt), :LogNormal}, Pumas.Formula{:CL, (1,), :LogNormal}}, var"#22#26", var"#21#25", Pumas.LinearODE, var"#24#28", Tuple{Pumas.Error{:dv, :cp, :CombinedNormal}}, ModelingToolkit.ODESystem}, population::Vector{Subject{NamedTuple{(:dv,), Tuple{Vector{Float64}}}, Pumas.ConstantCovar{NamedTuple{(:logwt, :wt, :sex, :age), Tuple{Float64, Float64, Int64, Int64}}}, StaticArraysCore.SVector{1, Pumas.Event{Float64, Float64, Float64, Float64, Float64, Float64, Int64}}, Vector{Float64}}}, param::NamedTuple{(:ΞΌ, :Ο‰, :Οƒ), Tuple{NamedTuple{(:Tlag, :ka, :Vc, :CL), Tuple{Float64, Float64, StaticArraysCore.SVector{2, Float64}, Float64}}, NTuple{4, Float64}, Tuple{NamedTuple{(:ₐ, :β‚š), Tuple{Float64, Float64}}}}}, samples::Int64, qreg_method::QuantileRegressions.IP, vpctype::Pumas.ContinuousVPC; observation::Symbol, covariate::Symbol, stratify_by::Vector{Symbol}, quantiles::Tuple{Float64, Float64, Float64}, level::Float64, ensemblealg::EnsembleSerial, bandwidth::Float64, smooth::Bool, glmdist::Pumas.FastNormal{Float64, Float64}, maxnumstrats::Vector{Int64}, count_vals::Vector{Any}, rng::TaskLocalRNG, nodes::Dict{Tuple{}, Vector{Float64}}, diffeq_options::NamedTuple{(:abstol, :reltol, :alg), Tuple{Float64, Float64, OrdinaryDiffEq.CompositeAlgorithm{Tuple{Vern7{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, Rodas5{1, true, LinearSolve.LUFactorization{LinearAlgebra.RowMaximum}, typeof(OrdinaryDiffEq.DEFAULT_PRECS), Val{:forward}, true, nothing}}, OrdinaryDiffEq.AutoSwitch{Vern7{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, Rodas5{1, true, LinearSolve.LUFactorization{LinearAlgebra.RowMaximum}, typeof(OrdinaryDiffEq.DEFAULT_PRECS), Val{:forward}, true, nothing}, Rational{Int64}, Int64}}}}, prediction_correction_df::DataFrame, simulations::Nothing)
    @ Pumas /build/_work/PumasSystemImages/PumasSystemImages/julia_depot/packages/Pumas/9AGx1/src/estimation/vpc.jl:965
 [16] vpc(model::Pumas.PumasEMModel{(1, 1, 1, 1), 0, (:logwt,), (Symbol("##A##"), Symbol("##b##")), (:lags,), (:Depot, :Central), (:cp,), var"#23#27", Tuple{Pumas.Formula{:Tlag, (1,), :LogNormal}, Pumas.Formula{:ka, (1,), :LogNormal}, Pumas.Formula{:Vc, (1, :logwt), :LogNormal}, Pumas.Formula{:CL, (1,), :LogNormal}}, var"#22#26", var"#21#25", Pumas.LinearODE, var"#24#28", Tuple{Pumas.Error{:dv, :cp, :CombinedNormal}}, ModelingToolkit.ODESystem}, _population::Vector{Subject{NamedTuple{(:dv,), Tuple{Vector{Float64}}}, Pumas.ConstantCovar{NamedTuple{(:logwt, :wt, :sex, :age), Tuple{Float64, Float64, Int64, Int64}}}, StaticArraysCore.SVector{1, Pumas.Event{Float64, Float64, Float64, Float64, Float64, Float64, Int64}}, Vector{Float64}}}, param::NamedTuple{(:ΞΌ, :Ο‰, :Οƒ), Tuple{NamedTuple{(:Tlag, :ka, :Vc, :CL), Tuple{Float64, Float64, StaticArraysCore.SVector{2, Float64}, Float64}}, NTuple{4, Float64}, Tuple{NamedTuple{(:ₐ, :β‚š), Tuple{Float64, Float64}}}}}; samples::Int64, qreg_method::QuantileRegressions.IP, observations::Vector{Symbol}, stratify_by::Vector{Symbol}, quantiles::Tuple{Float64, Float64, Float64}, level::Float64, ensemblealg::EnsembleSerial, bandwidth::Nothing, maxnumstrats::Vector{Int64}, covariates::Vector{Symbol}, smooth::Bool, rng::TaskLocalRNG, nnodes::Int64, nodes::Dict{Tuple{}, Vector{Float64}}, diffeq_options::NamedTuple{(:abstol, :reltol, :alg), Tuple{Float64, Float64, OrdinaryDiffEq.CompositeAlgorithm{Tuple{Vern7{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, Rodas5{1, true, LinearSolve.LUFactorization{LinearAlgebra.RowMaximum}, typeof(OrdinaryDiffEq.DEFAULT_PRECS), Val{:forward}, true, nothing}}, OrdinaryDiffEq.AutoSwitch{Vern7{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, Rodas5{1, true, LinearSolve.LUFactorization{LinearAlgebra.RowMaximum}, typeof(OrdinaryDiffEq.DEFAULT_PRECS), Val{:forward}, true, nothing}, Rational{Int64}, Int64}}}}, prediction_correction::Bool, simulations::Nothing)
    @ Pumas /build/_work/PumasSystemImages/PumasSystemImages/julia_depot/packages/Pumas/9AGx1/src/estimation/vpc.jl:1521
 [17] vpc(fpm::Pumas.FittedPumasEMModel{NamedTuple{(:Tlag, :ka, :Vc, :CL), Tuple{Float64, Float64, StaticArraysCore.SVector{2, Float64}, Float64}}, NTuple{4, Float64}, Tuple{NamedTuple{(:ₐ, :β‚š), Tuple{Float64, Float64}}}, Subject{NamedTuple{(:dv,), Tuple{Vector{Float64}}}, Pumas.ConstantCovar{NamedTuple{(:logwt, :wt, :sex, :age), Tuple{Float64, Float64, Int64, Int64}}}, StaticArraysCore.SVector{1, Pumas.Event{Float64, Float64, Float64, Float64, Float64, Float64, Int64}}, Vector{Float64}}, SAEM, Array{Float64, 3}, Pumas.PumasEMModel{(1, 1, 1, 1), 0, (:logwt,), (Symbol("##A##"), Symbol("##b##")), (:lags,), (:Depot, :Central), (:cp,), var"#23#27", Tuple{Pumas.Formula{:Tlag, (1,), :LogNormal}, Pumas.Formula{:ka, (1,), :LogNormal}, Pumas.Formula{:Vc, (1, :logwt), :LogNormal}, Pumas.Formula{:CL, (1,), :LogNormal}}, var"#22#26", var"#21#25", Pumas.LinearODE, var"#24#28", Tuple{Pumas.Error{:dv, :cp, :CombinedNormal}}, ModelingToolkit.ODESystem}, Vector{Tuple{NTuple{5, Float64}, NTuple{4, Float64}, Tuple{Tuple{Float64, Float64}}, Float64}}, NamedTuple{(:ensemblealg, :diffeq_options), Tuple{EnsembleThreads, NamedTuple{(:abstol, :reltol, :alg), Tuple{Float64, Float64, OrdinaryDiffEq.CompositeAlgorithm{Tuple{Vern7{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, Rodas5{1, true, LinearSolve.LUFactorization{LinearAlgebra.RowMaximum}, typeof(OrdinaryDiffEq.DEFAULT_PRECS), Val{:forward}, true, nothing}}, OrdinaryDiffEq.AutoSwitch{Vern7{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, Rodas5{1, true, LinearSolve.LUFactorization{LinearAlgebra.RowMaximum}, typeof(OrdinaryDiffEq.DEFAULT_PRECS), Val{:forward}, true, nothing}, Rational{Int64}, Int64}}}}}}, Nothing}; samples::Int64, qreg_method::QuantileRegressions.IP, observations::Vector{Symbol}, stratify_by::Vector{Symbol}, quantiles::Tuple{Float64, Float64, Float64}, level::Float64, ensemblealg::EnsembleSerial, bandwidth::Nothing, maxnumstrats::Vector{Int64}, covariates::Vector{Symbol}, smooth::Bool, rng::TaskLocalRNG, nodes::Dict{Tuple{}, Vector{Float64}}, nnodes::Int64, prediction_correction::Bool)
    @ Pumas /build/_work/PumasSystemImages/PumasSystemImages/julia_depot/packages/Pumas/9AGx1/src/estimation/vpc.jl:1645
 [18] vpc(fpm::Pumas.FittedPumasEMModel{NamedTuple{(:Tlag, :ka, :Vc, :CL), Tuple{Float64, Float64, StaticArraysCore.SVector{2, Float64}, Float64}}, NTuple{4, Float64}, Tuple{NamedTuple{(:ₐ, :β‚š), Tuple{Float64, Float64}}}, Subject{NamedTuple{(:dv,), Tuple{Vector{Float64}}}, Pumas.ConstantCovar{NamedTuple{(:logwt, :wt, :sex, :age), Tuple{Float64, Float64, Int64, Int64}}}, StaticArraysCore.SVector{1, Pumas.Event{Float64, Float64, Float64, Float64, Float64, Float64, Int64}}, Vector{Float64}}, SAEM, Array{Float64, 3}, Pumas.PumasEMModel{(1, 1, 1, 1), 0, (:logwt,), (Symbol("##A##"), Symbol("##b##")), (:lags,), (:Depot, :Central), (:cp,), var"#23#27", Tuple{Pumas.Formula{:Tlag, (1,), :LogNormal}, Pumas.Formula{:ka, (1,), :LogNormal}, Pumas.Formula{:Vc, (1, :logwt), :LogNormal}, Pumas.Formula{:CL, (1,), :LogNormal}}, var"#22#26", var"#21#25", Pumas.LinearODE, var"#24#28", Tuple{Pumas.Error{:dv, :cp, :CombinedNormal}}, ModelingToolkit.ODESystem}, Vector{Tuple{NTuple{5, Float64}, NTuple{4, Float64}, Tuple{Tuple{Float64, Float64}}, Float64}}, NamedTuple{(:ensemblealg, :diffeq_options), Tuple{EnsembleThreads, NamedTuple{(:abstol, :reltol, :alg), Tuple{Float64, Float64, OrdinaryDiffEq.CompositeAlgorithm{Tuple{Vern7{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, Rodas5{1, true, LinearSolve.LUFactorization{LinearAlgebra.RowMaximum}, typeof(OrdinaryDiffEq.DEFAULT_PRECS), Val{:forward}, true, nothing}}, OrdinaryDiffEq.AutoSwitch{Vern7{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, Rodas5{1, true, LinearSolve.LUFactorization{LinearAlgebra.RowMaximum}, typeof(OrdinaryDiffEq.DEFAULT_PRECS), Val{:forward}, true, nothing}, Rational{Int64}, Int64}}}}}}, Nothing})
    @ Pumas /build/_work/PumasSystemImages/PumasSystemImages/julia_depot/packages/Pumas/9AGx1/src/estimation/vpc.jl:1645

And the full output after fit_res_inspection = inspect(fit_res) is

[ Info: Calculating predictions.
[ Info: Calculating weighted residuals.
[ Info: Calculating empirical bayes.
[ Info: Evaluating individual parameters.
[ Info: Evaluating dose control parameters.
ERROR: type NamedTuple has no field logwt
Stacktrace:
  [1] getproperty
    @ ./Base.jl:38 [inlined]
  [2] (::var"#23#27")(t::Float64, param::NamedTuple{(:Tlag, :ka, :Vc, :CL), NTuple{4, Float64}})
    @ Main /build/_work/PumasSystemImages/PumasSystemImages/julia_depot/packages/Pumas/9AGx1/src/dsl/emmodel_macro.jl:37
  [3] (::Base.Fix2{var"#23#27", NamedTuple{(:Tlag, :ka, :Vc, :CL), NTuple{4, Float64}}})(y::Float64)
    @ Base ./operators.jl:1113
  [4] (::Pumas.ValTypeWrapper{(:Depot, :Central), Base.Fix2{var"#23#27", NamedTuple{(:Tlag, :ka, :Vc, :CL), NTuple{4, Float64}}}})(args::Float64)
    @ Pumas /build/_work/PumasSystemImages/PumasSystemImages/julia_depot/packages/Pumas/9AGx1/src/models/model_api.jl:2151
  [5] _broadcast_getindex_evalf
    @ ./broadcast.jl:670 [inlined]
  [6] _broadcast_getindex
    @ ./broadcast.jl:643 [inlined]
  [7] getindex
    @ ./broadcast.jl:597 [inlined]
  [8] copy
    @ ./broadcast.jl:899 [inlined]
  [9] materialize
    @ ./broadcast.jl:860 [inlined]
 [10] _dosecontrol(model::Pumas.PumasEMModel{(1, 1, 1, 1), 0, (:logwt,), (Symbol("##A##"), Symbol("##b##")), (:lags,), (:Depot, :Central), (:cp,), var"#23#27", Tuple{Pumas.Formula{:Tlag, (1,), :LogNormal}, Pumas.Formula{:ka, (1,), :LogNormal}, Pumas.Formula{:Vc, (1, :logwt), :LogNormal}, Pumas.Formula{:CL, (1,), :LogNormal}}, var"#22#26", var"#21#25", Pumas.LinearODE, var"#24#28", Tuple{Pumas.Error{:dv, :cp, :CombinedNormal}}, ModelingToolkit.ODESystem}, subject::Subject{NamedTuple{(:dv,), Tuple{Vector{Float64}}}, Pumas.ConstantCovar{NamedTuple{(:logwt, :wt, :sex, :age), Tuple{Float64, Float64, Int64, Int64}}}, StaticArraysCore.SVector{1, Pumas.Event{Float64, Float64, Float64, Float64, Float64, Float64, Int64}}, Vector{Float64}}, param::NamedTuple{(:ΞΌ, :Ο‰, :Οƒ), Tuple{NamedTuple{(:Tlag, :ka, :Vc, :CL), Tuple{Float64, Float64, StaticArraysCore.SVector{2, Float64}, Float64}}, NTuple{4, Float64}, Tuple{NamedTuple{(:ₐ, :β‚š), Tuple{Float64, Float64}}}}}, randeffs::NTuple{4, Float64})
    @ Pumas /build/_work/PumasSystemImages/PumasSystemImages/julia_depot/packages/Pumas/9AGx1/src/estimation/diagnostics.jl:1932
 [11] (::Pumas.var"#1310#1311"{Pumas.FittedPumasEMModel{NamedTuple{(:Tlag, :ka, :Vc, :CL), Tuple{Float64, Float64, StaticArraysCore.SVector{2, Float64}, Float64}}, NTuple{4, Float64}, Tuple{NamedTuple{(:ₐ, :β‚š), Tuple{Float64, Float64}}}, Subject{NamedTuple{(:dv,), Tuple{Vector{Float64}}}, Pumas.ConstantCovar{NamedTuple{(:logwt, :wt, :sex, :age), Tuple{Float64, Float64, Int64, Int64}}}, StaticArraysCore.SVector{1, Pumas.Event{Float64, Float64, Float64, Float64, Float64, Float64, Int64}}, Vector{Float64}}, SAEM, Array{Float64, 3}, Pumas.PumasEMModel{(1, 1, 1, 1), 0, (:logwt,), (Symbol("##A##"), Symbol("##b##")), (:lags,), (:Depot, :Central), (:cp,), var"#23#27", Tuple{Pumas.Formula{:Tlag, (1,), :LogNormal}, Pumas.Formula{:ka, (1,), :LogNormal}, Pumas.Formula{:Vc, (1, :logwt), :LogNormal}, Pumas.Formula{:CL, (1,), :LogNormal}}, var"#22#26", var"#21#25", Pumas.LinearODE, var"#24#28", Tuple{Pumas.Error{:dv, :cp, :CombinedNormal}}, ModelingToolkit.ODESystem}, Vector{Tuple{NTuple{5, Float64}, NTuple{4, Float64}, Tuple{Tuple{Float64, Float64}}, Float64}}, NamedTuple{(:ensemblealg, :diffeq_options), Tuple{EnsembleThreads, NamedTuple{(:abstol, :reltol, :alg), Tuple{Float64, Float64, OrdinaryDiffEq.CompositeAlgorithm{Tuple{Vern7{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, Rodas5{1, true, LinearSolve.LUFactorization{LinearAlgebra.RowMaximum}, typeof(OrdinaryDiffEq.DEFAULT_PRECS), Val{:forward}, true, nothing}}, OrdinaryDiffEq.AutoSwitch{Vern7{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, Rodas5{1, true, LinearSolve.LUFactorization{LinearAlgebra.RowMaximum}, typeof(OrdinaryDiffEq.DEFAULT_PRECS), Val{:forward}, true, nothing}, Rational{Int64}, Int64}}}}}}, Nothing}, NamedTuple{(:ΞΌ, :Ο‰, :Οƒ), Tuple{NamedTuple{(:Tlag, :ka, :Vc, :CL), Tuple{Float64, Float64, StaticArraysCore.SVector{2, Float64}, Float64}}, NTuple{4, Float64}, Tuple{NamedTuple{(:ₐ, :β‚š), Tuple{Float64, Float64}}}}}})(subject::Subject{NamedTuple{(:dv,), Tuple{Vector{Float64}}}, Pumas.ConstantCovar{NamedTuple{(:logwt, :wt, :sex, :age), Tuple{Float64, Float64, Int64, Int64}}}, StaticArraysCore.SVector{1, Pumas.Event{Float64, Float64, Float64, Float64, Float64, Float64, Int64}}, Vector{Float64}}, vrandeffsorth::Vector{Float64})
    @ Pumas /build/_work/PumasSystemImages/PumasSystemImages/julia_depot/packages/Pumas/9AGx1/src/estimation/diagnostics.jl:1887
 [12] stable_map(::Pumas.var"#1310#1311"{Pumas.FittedPumasEMModel{NamedTuple{(:Tlag, :ka, :Vc, :CL), Tuple{Float64, Float64, StaticArraysCore.SVector{2, Float64}, Float64}}, NTuple{4, Float64}, Tuple{NamedTuple{(:ₐ, :β‚š), Tuple{Float64, Float64}}}, Subject{NamedTuple{(:dv,), Tuple{Vector{Float64}}}, Pumas.ConstantCovar{NamedTuple{(:logwt, :wt, :sex, :age), Tuple{Float64, Float64, Int64, Int64}}}, StaticArraysCore.SVector{1, Pumas.Event{Float64, Float64, Float64, Float64, Float64, Float64, Int64}}, Vector{Float64}}, SAEM, Array{Float64, 3}, Pumas.PumasEMModel{(1, 1, 1, 1), 0, (:logwt,), (Symbol("##A##"), Symbol("##b##")), (:lags,), (:Depot, :Central), (:cp,), var"#23#27", Tuple{Pumas.Formula{:Tlag, (1,), :LogNormal}, Pumas.Formula{:ka, (1,), :LogNormal}, Pumas.Formula{:Vc, (1, :logwt), :LogNormal}, Pumas.Formula{:CL, (1,), :LogNormal}}, var"#22#26", var"#21#25", Pumas.LinearODE, var"#24#28", Tuple{Pumas.Error{:dv, :cp, :CombinedNormal}}, ModelingToolkit.ODESystem}, Vector{Tuple{NTuple{5, Float64}, NTuple{4, Float64}, Tuple{Tuple{Float64, Float64}}, Float64}}, NamedTuple{(:ensemblealg, :diffeq_options), Tuple{EnsembleThreads, NamedTuple{(:abstol, :reltol, :alg), Tuple{Float64, Float64, OrdinaryDiffEq.CompositeAlgorithm{Tuple{Vern7{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, Rodas5{1, true, LinearSolve.LUFactorization{LinearAlgebra.RowMaximum}, typeof(OrdinaryDiffEq.DEFAULT_PRECS), Val{:forward}, true, nothing}}, OrdinaryDiffEq.AutoSwitch{Vern7{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, Rodas5{1, true, LinearSolve.LUFactorization{LinearAlgebra.RowMaximum}, typeof(OrdinaryDiffEq.DEFAULT_PRECS), Val{:forward}, true, nothing}, Rational{Int64}, Int64}}}}}}, Nothing}, NamedTuple{(:ΞΌ, :Ο‰, :Οƒ), Tuple{NamedTuple{(:Tlag, :ka, :Vc, :CL), Tuple{Float64, Float64, StaticArraysCore.SVector{2, Float64}, Float64}}, NTuple{4, Float64}, Tuple{NamedTuple{(:ₐ, :β‚š), Tuple{Float64, Float64}}}}}}, ::Vector{Subject{NamedTuple{(:dv,), Tuple{Vector{Float64}}}, Pumas.ConstantCovar{NamedTuple{(:logwt, :wt, :sex, :age), Tuple{Float64, Float64, Int64, Int64}}}, StaticArraysCore.SVector{1, Pumas.Event{Float64, Float64, Float64, Float64, Float64, Float64, Int64}}, Vector{Float64}}}, ::Vector{Vector{Float64}})
    @ StableMap /build/_work/PumasSystemImages/PumasSystemImages/julia_depot/packages/StableMap/26WC7/src/StableMap.jl:105
 [13] dosecontrol(fpm::Pumas.FittedPumasEMModel{NamedTuple{(:Tlag, :ka, :Vc, :CL), Tuple{Float64, Float64, StaticArraysCore.SVector{2, Float64}, Float64}}, NTuple{4, Float64}, Tuple{NamedTuple{(:ₐ, :β‚š), Tuple{Float64, Float64}}}, Subject{NamedTuple{(:dv,), Tuple{Vector{Float64}}}, Pumas.ConstantCovar{NamedTuple{(:logwt, :wt, :sex, :age), Tuple{Float64, Float64, Int64, Int64}}}, StaticArraysCore.SVector{1, Pumas.Event{Float64, Float64, Float64, Float64, Float64, Float64, Int64}}, Vector{Float64}}, SAEM, Array{Float64, 3}, Pumas.PumasEMModel{(1, 1, 1, 1), 0, (:logwt,), (Symbol("##A##"), Symbol("##b##")), (:lags,), (:Depot, :Central), (:cp,), var"#23#27", Tuple{Pumas.Formula{:Tlag, (1,), :LogNormal}, Pumas.Formula{:ka, (1,), :LogNormal}, Pumas.Formula{:Vc, (1, :logwt), :LogNormal}, Pumas.Formula{:CL, (1,), :LogNormal}}, var"#22#26", var"#21#25", Pumas.LinearODE, var"#24#28", Tuple{Pumas.Error{:dv, :cp, :CombinedNormal}}, ModelingToolkit.ODESystem}, Vector{Tuple{NTuple{5, Float64}, NTuple{4, Float64}, Tuple{Tuple{Float64, Float64}}, Float64}}, NamedTuple{(:ensemblealg, :diffeq_options), Tuple{EnsembleThreads, NamedTuple{(:abstol, :reltol, :alg), Tuple{Float64, Float64, OrdinaryDiffEq.CompositeAlgorithm{Tuple{Vern7{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, Rodas5{1, true, LinearSolve.LUFactorization{LinearAlgebra.RowMaximum}, typeof(OrdinaryDiffEq.DEFAULT_PRECS), Val{:forward}, true, nothing}}, OrdinaryDiffEq.AutoSwitch{Vern7{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, Rodas5{1, true, LinearSolve.LUFactorization{LinearAlgebra.RowMaximum}, typeof(OrdinaryDiffEq.DEFAULT_PRECS), Val{:forward}, true, nothing}, Rational{Int64}, Int64}}}}}}, Nothing})
    @ Pumas /build/_work/PumasSystemImages/PumasSystemImages/julia_depot/packages/Pumas/9AGx1/src/estimation/diagnostics.jl:1886
 [14] inspect(fpm::Pumas.FittedPumasEMModel{NamedTuple{(:Tlag, :ka, :Vc, :CL), Tuple{Float64, Float64, StaticArraysCore.SVector{2, Float64}, Float64}}, NTuple{4, Float64}, Tuple{NamedTuple{(:ₐ, :β‚š), Tuple{Float64, Float64}}}, Subject{NamedTuple{(:dv,), Tuple{Vector{Float64}}}, Pumas.ConstantCovar{NamedTuple{(:logwt, :wt, :sex, :age), Tuple{Float64, Float64, Int64, Int64}}}, StaticArraysCore.SVector{1, Pumas.Event{Float64, Float64, Float64, Float64, Float64, Float64, Int64}}, Vector{Float64}}, SAEM, Array{Float64, 3}, Pumas.PumasEMModel{(1, 1, 1, 1), 0, (:logwt,), (Symbol("##A##"), Symbol("##b##")), (:lags,), (:Depot, :Central), (:cp,), var"#23#27", Tuple{Pumas.Formula{:Tlag, (1,), :LogNormal}, Pumas.Formula{:ka, (1,), :LogNormal}, Pumas.Formula{:Vc, (1, :logwt), :LogNormal}, Pumas.Formula{:CL, (1,), :LogNormal}}, var"#22#26", var"#21#25", Pumas.LinearODE, var"#24#28", Tuple{Pumas.Error{:dv, :cp, :CombinedNormal}}, ModelingToolkit.ODESystem}, Vector{Tuple{NTuple{5, Float64}, NTuple{4, Float64}, Tuple{Tuple{Float64, Float64}}, Float64}}, NamedTuple{(:ensemblealg, :diffeq_options), Tuple{EnsembleThreads, NamedTuple{(:abstol, :reltol, :alg), Tuple{Float64, Float64, OrdinaryDiffEq.CompositeAlgorithm{Tuple{Vern7{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, Rodas5{1, true, LinearSolve.LUFactorization{LinearAlgebra.RowMaximum}, typeof(OrdinaryDiffEq.DEFAULT_PRECS), Val{:forward}, true, nothing}}, OrdinaryDiffEq.AutoSwitch{Vern7{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, Rodas5{1, true, LinearSolve.LUFactorization{LinearAlgebra.RowMaximum}, typeof(OrdinaryDiffEq.DEFAULT_PRECS), Val{:forward}, true, nothing}, Rational{Int64}, Int64}}}}}}, Nothing}; wres_approx::FOCE, nsim::Int64, rng::TaskLocalRNG)
    @ Pumas /build/_work/PumasSystemImages/PumasSystemImages/julia_depot/packages/Pumas/9AGx1/src/estimation/diagnostics.jl:1452
 [15] inspect(fpm::Pumas.FittedPumasEMModel{NamedTuple{(:Tlag, :ka, :Vc, :CL), Tuple{Float64, Float64, StaticArraysCore.SVector{2, Float64}, Float64}}, NTuple{4, Float64}, Tuple{NamedTuple{(:ₐ, :β‚š), Tuple{Float64, Float64}}}, Subject{NamedTuple{(:dv,), Tuple{Vector{Float64}}}, Pumas.ConstantCovar{NamedTuple{(:logwt, :wt, :sex, :age), Tuple{Float64, Float64, Int64, Int64}}}, StaticArraysCore.SVector{1, Pumas.Event{Float64, Float64, Float64, Float64, Float64, Float64, Int64}}, Vector{Float64}}, SAEM, Array{Float64, 3}, Pumas.PumasEMModel{(1, 1, 1, 1), 0, (:logwt,), (Symbol("##A##"), Symbol("##b##")), (:lags,), (:Depot, :Central), (:cp,), var"#23#27", Tuple{Pumas.Formula{:Tlag, (1,), :LogNormal}, Pumas.Formula{:ka, (1,), :LogNormal}, Pumas.Formula{:Vc, (1, :logwt), :LogNormal}, Pumas.Formula{:CL, (1,), :LogNormal}}, var"#22#26", var"#21#25", Pumas.LinearODE, var"#24#28", Tuple{Pumas.Error{:dv, :cp, :CombinedNormal}}, ModelingToolkit.ODESystem}, Vector{Tuple{NTuple{5, Float64}, NTuple{4, Float64}, Tuple{Tuple{Float64, Float64}}, Float64}}, NamedTuple{(:ensemblealg, :diffeq_options), Tuple{EnsembleThreads, NamedTuple{(:abstol, :reltol, :alg), Tuple{Float64, Float64, OrdinaryDiffEq.CompositeAlgorithm{Tuple{Vern7{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, Rodas5{1, true, LinearSolve.LUFactorization{LinearAlgebra.RowMaximum}, typeof(OrdinaryDiffEq.DEFAULT_PRECS), Val{:forward}, true, nothing}}, OrdinaryDiffEq.AutoSwitch{Vern7{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, Rodas5{1, true, LinearSolve.LUFactorization{LinearAlgebra.RowMaximum}, typeof(OrdinaryDiffEq.DEFAULT_PRECS), Val{:forward}, true, nothing}, Rational{Int64}, Int64}}}}}}, Nothing})
    @ Pumas /build/_work/PumasSystemImages/PumasSystemImages/julia_depot/packages/Pumas/9AGx1/src/estimation/diagnostics.jl:1419

I’m looking into it. Well reply again when I find out what’s going on. Thanks for your patience!

1 Like

Thanks a lot @patrick.

This is definitely a bug. You can work around it in your case, because you’re not using the covariate outside of @random. So simply remove the @covariate block and you should be fine. For example:

pkmodel = @emmodel begin
       #@covariates logwt
       @random begin
               Tlag ~ 1 | LogNormal
               ka ~ 1 | LogNormal
               Vc ~ 1 + logwt | LogNormal
               CL ~ 1 | LogNormal
           end
           @dosecontrol begin
               lags  = (Depot=Tlag,)
           end
           @dynamics begin
               Depot'   = -ka*Depot
               Central' =  ka*Depot - (CL/Vc)*Central
           end
           @post begin
               cp = Central/Vc
           end
           @error begin
               dv ~ CombinedNormal(cp)
           end
       end
 pop = [Subject(id=i, events=DosageRegimen(20), covariates=(logwt=1,)) for i = 1:10]
simobs(pkmodel, pop, init_params(pkmodel);obstimes=[0,1,2,3])
2 Likes