Hi,
I am running a simulation using resampled individual parameter sets from a two-stage estimation. My model code is below:
pilot_fast_2cmt_katlag_ehc = @model begin
@param begin
σ_prop ∈ RealDomain(lower=0.001)
σ_add ∈ RealDomain(lower=0.001)
end
@covariates iCl iVc iQ iVp iKa iLag iKpb iKgp ik0bile is_bile Form_C
@pre begin
Cl = iCl
Vc = iVc
Q = iQ
Vp = iVp
Ka = iKa
Kpb = iKpb
Kgp = iKgp
k0bile = (is_bile == 0) ? 0 : ik0bile
end
@dosecontrol begin
lags = (; Depot = iLag)
end
@dynamics begin
Depot' = - Ka*Depot
Central' = Ka*Depot - (Cl/Vc)*Central + (Q/Vp)*Peripheral - Kpb*Central + Kgp * Gut
Peripheral' = (Cl/Vc)*Central - (Q/Vp)*Peripheral
Bile' = Kpb*Central - k0bile
Gut' = k0bile - Kgp * Gut
end
@derived begin
cp = @. (Central/Vc)
Conc ~ @. Normal(cp, sqrt(σ_add^2+(cp*σ_prop)^2))
end
end
And when I run the simulation, I get this error message:
simobs(
pilot_fast_2cmt_katlag_ehc,
pop_fit_df.pop,
param_2cmt_ehc,
obstimes=[0.08,0.17,0.25,0.5,1.0,1.5,2.0,3.0,4.0,6.0,8.0,10.0,12.0,16.0,18.0,24.0]
#rng=rng
)
Error message:
ERROR: MethodError: no method matching zero(::Type{Array{Float64}})
Closest candidates are:
zero(::Union{Type{P}, P}) where P<:Period
@ Dates C:\Pumas-v2.4.1\Julia-1.9.2\share\julia\stdlib\v1.9\Dates\src\periods.jl:51
zero(::Union{AbstractAlgebra.Generic.LaurentSeriesFieldElem{T}, AbstractAlgebra.Generic.LaurentSeriesRingElem{T}} where T<:AbstractAlgebra.RingElement)
@ AbstractAlgebra C:\a\PumasSystemImages\PumasSystemImages\julia_depot\packages\AbstractAlgebra\FcxWh\src\generic\LaurentSeries.jl:466
zero(::Union{AbstractAlgebra.Generic.LaurentSeriesFieldElem{T}, AbstractAlgebra.Generic.LaurentSeriesRingElem{T}} where T<:AbstractAlgebra.RingElement, ::String; cached)
@ AbstractAlgebra C:\a\PumasSystemImages\PumasSystemImages\julia_depot\packages\AbstractAlgebra\FcxWh\src\generic\LaurentSeries.jl:480
...
Stacktrace:
[1] zeros(#unused#::Type{Array{Float64}}, dims::Tuple{Int64, Int64})
@ Base .\array.jl:585
[2] zeros(::Type{Array{Float64}}, ::Int64, ::Int64)
@ Base .\array.jl:580
[3] (::var"#821#831")(_param#2926::NamedTuple{(:σ_add, :σ_prop), Tuple{Float64, Float64}}, _random#2927::NamedTuple{(), Tuple{}}, _subject#2924::Subject{NamedTuple{(:Conc,), Tuple{Vector{Union{Missing, Float64}}}}, Pumas.ConstantCovar{NamedTuple{(:iCl, :iVc, :iQ, :iVp, :iKa, :iLag, :iKpb, :iKgp, :ik0bile, :is_bile, :Form_C), Tuple{Vector{Float64}, Vector{Float64}, Vector{Float64}, Vector{Float64}, Vector{Float64}, Vector{Float64}, Vector{Float64}, Vector{Float64}, Vector{Float64}, Vector{Int64}, Vector{String15}}}}, Vector{Pumas.Event{Float64, Float64, Float64, Float64, Float64, Float64, Int64}}, Vector{Float64}})
@ Main C:\a\PumasSystemImages\PumasSystemImages\julia_depot\packages\Pumas\VyE8h\src\dsl\model_macro.jl:822
[4] (::Pumas.TimeDispatcher{var"#821#831", var"#822#832"})(param::NamedTuple{(:σ_add, :σ_prop), Tuple{Float64, Float64}}, randeffs::NamedTuple{(), Tuple{}}, subject::Subject{NamedTuple{(:Conc,), Tuple{Vector{Union{Missing, Float64}}}}, Pumas.ConstantCovar{NamedTuple{(:iCl, :iVc, :iQ, :iVp, :iKa, :iLag, :iKpb, :iKgp, :ik0bile, :is_bile, :Form_C), Tuple{Vector{Float64}, Vector{Float64}, Vector{Float64}, Vector{Float64}, Vector{Float64}, Vector{Float64}, Vector{Float64}, Vector{Float64}, Vector{Float64}, Vector{Int64}, Vector{String15}}}}, Vector{Pumas.Event{Float64, Float64, Float64, Float64, Float64, Float64, Int64}}, Vector{Float64}}, #unused#::Pumas.ConstantCovar{NamedTuple{(:iCl, :iVc, :iQ, :iVp,
:iKa, :iLag, :iKpb, :iKgp, :ik0bile, :is_bile, :Form_C), Tuple{Vector{Float64}, Vector{Float64}, Vector{Float64}, Vector{Float64}, Vector{Float64}, Vector{Float64}, Vector{Float64}, Vector{Float64}, Vector{Float64}, Vector{Int64}, Vector{String15}}}})
@ Pumas C:\a\PumasSystemImages\PumasSystemImages\julia_depot\packages\Pumas\VyE8h\src\dsl\model_macro.jl:502
[5] (::Pumas.TimeDispatcher{var"#821#831", var"#822#832"})(param::NamedTuple{(:σ_add, :σ_prop), Tuple{Float64, Float64}}, randeffs::NamedTuple{(), Tuple{}}, subject::Subject{NamedTuple{(:Conc,), Tuple{Vector{Union{Missing, Float64}}}}, Pumas.ConstantCovar{NamedTuple{(:iCl, :iVc, :iQ, :iVp, :iKa, :iLag, :iKpb, :iKgp, :ik0bile, :is_bile, :Form_C), Tuple{Vector{Float64}, Vector{Float64}, Vector{Float64}, Vector{Float64}, Vector{Float64}, Vector{Float64}, Vector{Float64}, Vector{Float64}, Vector{Float64}, Vector{Int64}, Vector{String15}}}}, Vector{Pumas.Event{Float64, Float64, Float64, Float64, Float64, Float64, Int64}}, Vector{Float64}})
@ Pumas C:\a\PumasSystemImages\PumasSystemImages\julia_depot\packages\Pumas\VyE8h\src\dsl\model_macro.jl:499
[6] pre(model::PumasModel{(σ_prop = 1, σ_add = 1), 0, (:Depot, :Central, :Peripheral, :Bile, :Gut), ParamSet{NamedTuple{(:σ_prop, :σ_add), Tuple{RealDomain{Float64, TransformVariables.Infinity{true}, Float64}, RealDomain{Float64, TransformVariables.Infinity{true}, Float64}}}}, var"#820#830", Pumas.TimeDispatcher{var"#821#831", var"#822#832"}, Pumas.DCPChecker{Pumas.TimeDispatcher{var"#824#834", var"#825#835"}}, var"#827#837", Pumas.LinearODE, var"#828#838", var"#829#839", ModelingToolkit.ODESystem}, subject::Subject{NamedTuple{(:Conc,), Tuple{Vector{Union{Missing, Float64}}}}, Pumas.ConstantCovar{NamedTuple{(:iCl, :iVc, :iQ, :iVp, :iKa, :iLag, :iKpb, :iKgp, :ik0bile, :is_bile, :Form_C), Tuple{Vector{Float64}, Vector{Float64}, Vector{Float64}, Vector{Float64}, Vector{Float64}, Vector{Float64}, Vector{Float64}, Vector{Float64}, Vector{Float64}, Vector{Int64}, Vector{String15}}}}, Vector{Pumas.Event{Float64, Float64, Float64, Float64, Float64, Float64, Int64}}, Vector{Float64}}, param::NamedTuple{(:σ_add, :σ_prop), Tuple{Float64, Float64}}, randeffs::NamedTuple{(), Tuple{}})
@ Pumas C:\a\PumasSystemImages\PumasSystemImages\julia_depot\packages\Pumas\VyE8h\src\models\model_api.jl:2167
[7] simobs(::PumasModel{(σ_prop = 1, σ_add = 1), 0, (:Depot, :Central, :Peripheral, :Bile, :Gut), ParamSet{NamedTuple{(:σ_prop, :σ_add), Tuple{RealDomain{Float64, TransformVariables.Infinity{true}, Float64}, RealDomain{Float64, TransformVariables.Infinity{true}, Float64}}}}, var"#820#830", Pumas.TimeDispatcher{var"#821#831", var"#822#832"}, Pumas.DCPChecker{Pumas.TimeDispatcher{var"#824#834", var"#825#835"}}, var"#827#837", Pumas.LinearODE, var"#828#838", var"#829#839", ModelingToolkit.ODESystem}, ::Subject{NamedTuple{(:Conc,), Tuple{Vector{Union{Missing, Float64}}}}, Pumas.ConstantCovar{NamedTuple{(:iCl, :iVc, :iQ, :iVp, :iKa, :iLag, :iKpb, :iKgp, :ik0bile, :is_bile, :Form_C), Tuple{Vector{Float64}, Vector{Float64}, Vector{Float64}, Vector{Float64}, Vector{Float64}, Vector{Float64}, Vector{Float64}, Vector{Float64}, Vector{Float64}, Vector{Int64}, Vector{String15}}}}, Vector{Pumas.Event{Float64, Float64, Float64, Float64, Float64, Float64, Int64}}, Vector{Float64}}, ::NamedTuple{(:σ_add, :σ_prop), Tuple{Float64, Float64}}, ::Nothing; obstimes::Vector{Float64}, ensemblealg::EnsembleSerial, diffeq_options::NamedTuple{(:alg, :callback), Tuple{OrdinaryDiffEq.CompositeAlgorithm{Tuple{OrdinaryDiffEq.Tsit5{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, Rosenbrock23{1, true, LinearSolve.LUFactorization{LinearAlgebra.RowMaximum}, typeof(OrdinaryDiffEq.DEFAULT_PRECS), Val{:forward}, true, nothing}}, OrdinaryDiffEq.AutoSwitch{OrdinaryDiffEq.Tsit5{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, Rosenbrock23{1, true, LinearSolve.LUFactorization{LinearAlgebra.RowMaximum}, typeof(OrdinaryDiffEq.DEFAULT_PRECS), Val{:forward}, true, nothing}, Rational{Int64}, Int64}}, Nothing}}, rng::TaskLocalRNG, simulate_error::Val{true}, isfor_derived::Val{false}, return_model::Val{true})
@ Pumas C:\a\PumasSystemImages\PumasSystemImages\julia_depot\packages\Pumas\VyE8h\src\models\model_api.jl:1532
[8] #_simobs!#359
@ C:\a\PumasSystemImages\PumasSystemImages\julia_depot\packages\Pumas\VyE8h\src\models\model_api.jl:1829 [inlined]
[9] _simobs!
@ C:\a\PumasSystemImages\PumasSystemImages\julia_depot\packages\Pumas\VyE8h\src\models\model_api.jl:1810 [inlined]
[10] _simobs(::PumasModel{(σ_prop = 1, σ_add = 1), 0, (:Depot, :Central, :Peripheral, :Bile, :Gut), ParamSet{NamedTuple{(:σ_prop, :σ_add), Tuple{RealDomain{Float64, TransformVariables.Infinity{true}, Float64}, RealDomain{Float64, TransformVariables.Infinity{true}, Float64}}}}, var"#820#830", Pumas.TimeDispatcher{var"#821#831", var"#822#832"}, Pumas.DCPChecker{Pumas.TimeDispatcher{var"#824#834", var"#825#835"}}, var"#827#837", Pumas.LinearODE, var"#828#838", var"#829#839", ModelingToolkit.ODESystem}, ::Vector{Subject{NamedTuple{(:Conc,), Tuple{Vector{Union{Missing, Float64}}}}, Pumas.ConstantCovar{NamedTuple{(:iCl, :iVc, :iQ, :iVp, :iKa, :iLag, :iKpb, :iKgp, :ik0bile, :is_bile, :Form_C), Tuple{Vector{Float64}, Vector{Float64}, Vector{Float64}, Vector{Float64}, Vector{Float64}, Vector{Float64}, Vector{Float64}, Vector{Float64}, Vector{Float64}, Vector{Int64}, Vector{String15}}}}, Vector{Pumas.Event{Float64, Float64, Float64, Float64, Float64, Float64, Int64}}, Vector{Float64}}}, ::StaticArraysCore.SVector{1, NamedTuple{(:σ_add, :σ_prop), Tuple{Float64, Float64}}}, ::Nothing; rng::TaskLocalRNG, diffeq_options::NamedTuple{(), Tuple{}}, isfor_derived::Val{false}, simulate_error::Val{true}, obstimes::Vector{Float64}, ensemblealg::EnsembleSerial)
@ Pumas C:\a\PumasSystemImages\PumasSystemImages\julia_depot\packages\Pumas\VyE8h\src\models\model_api.jl:2112
[11] _simobs
@ C:\a\PumasSystemImages\PumasSystemImages\julia_depot\packages\Pumas\VyE8h\src\models\model_api.jl:2023 [inlined]
[12] #simobs#370
@ C:\a\PumasSystemImages\PumasSystemImages\julia_depot\packages\Pumas\VyE8h\src\models\model_api.jl:1991 [inlined]
[13] simobs
@ C:\a\PumasSystemImages\PumasSystemImages\julia_depot\packages\Pumas\VyE8h\src\models\model_api.jl:1966 [inlined]
[14] top-level scope
I am not able to understand what this error means. Any help deciphering it is appreciated. Thanks.