I am trying to fit a model, however it is throwing the following error. Unfortunately I cannot share the model code or the dataset, so I am presenting the problem to the best of my ability.
Error
julia> scr_fit1 = fit(model1, data4pd_rich_all, scr_params1, Pumas.FOCE())
ERROR: MethodError: no method matching unique_times_sorted(::Nothing, ::Float64)
Closest candidates are:
unique_times_sorted(::AbstractVector{E}, ::Any) where {T1, T2, E<:(Pumas.Event{T1, T2})} at /builds/PumasAI/PumasSystemImages-jl/.julia/packages/Pumas/PoEHP/src/simulate_methods/utils.jl:27
Stacktrace:
[1] _build_analytical_problem(prob::Pumas.LinearODE, u0::LabelledArrays.SLArray{Tuple{1}, ForwardDiff.Dual{ForwardDiff.Tag{Pumas.Tag1, Float64}, Float64, 2}, 1, 1, (:SCR,)}, tspan::Tuple{Float64, Float64}, events::Nothing, covariates::Pumas.ConstantInterpolationStructArray{Vector{Float64}, StructArrays.StructVector{NamedTuple{(:age_yrs_adm, :wt_kg, :ht_cms, :is_male, :neph_med, :vaso_med, :trough_conc), Tuple{Float64, Float64, Float64, Int64, Int64, Int64, Float64}}, NamedTuple{(:age_yrs_adm, :wt_kg, :ht_cms, :is_male, :neph_med, :vaso_med, :trough_conc), Tuple{FillArrays.Fill{Float64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Float64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Float64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Int64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Int64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Int64, 1, Tuple{Base.OneTo{Int64}}}, Vector{Float64}}}, Int64}, Symbol}, col::Pumas.Pre{Nothing, var"#311#327"{NamedTuple{(:tvKform, :tvKdeg, :Ω, :σ_add), Tuple{Float64, Float64, PDMats.PDiagMat{Float64, Vector{Float64}}, Float64}}, NamedTuple{(:η,), Tuple{Vector{ForwardDiff.Dual{ForwardDiff.Tag{Pumas.Tag1, Float64}, Float64, 2}}}}, Subject{NamedTuple{(:scr_mgdl,), Tuple{Vector{Union{Missing, Float64}}}}, Pumas.ConstantInterpolationStructArray{Vector{Float64}, StructArrays.StructVector{NamedTuple{(:age_yrs_adm, :wt_kg, :ht_cms, :is_male, :neph_med, :vaso_med, :trough_conc), Tuple{Float64, Float64, Float64, Int64, Int64, Int64, Float64}}, NamedTuple{(:age_yrs_adm, :wt_kg, :ht_cms, :is_male, :neph_med, :vaso_med, :trough_conc), Tuple{FillArrays.Fill{Float64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Float64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Float64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Int64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Int64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Int64, 1, Tuple{Base.OneTo{Int64}}}, Vector{Float64}}}, Int64}, Symbol}, Nothing, Vector{Float64}}}}, dcp::Pumas.Pre{Nothing, var"#313#329"{NamedTuple{(:tvKform, :tvKdeg, :Ω, :σ_add), Tuple{Float64, Float64, PDMats.PDiagMat{Float64, Vector{Float64}}, Float64}}, NamedTuple{(:η,), Tuple{Vector{ForwardDiff.Dual{ForwardDiff.Tag{Pumas.Tag1, Float64}, Float64, 2}}}}, Subject{NamedTuple{(:scr_mgdl,), Tuple{Vector{Union{Missing, Float64}}}}, Pumas.ConstantInterpolationStructArray{Vector{Float64}, StructArrays.StructVector{NamedTuple{(:age_yrs_adm, :wt_kg, :ht_cms, :is_male, :neph_med, :vaso_med, :trough_conc), Tuple{Float64, Float64, Float64, Int64, Int64, Int64, Float64}}, NamedTuple{(:age_yrs_adm, :wt_kg, :ht_cms, :is_male, :neph_med, :vaso_med, :trough_conc), Tuple{FillArrays.Fill{Float64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Float64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Float64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Int64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Int64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Int64, 1, Tuple{Base.OneTo{Int64}}}, Vector{Float64}}}, Int64}, Symbol}, Nothing, Vector{Float64}}}})
@ Pumas /builds/PumasAI/PumasSystemImages-jl/.julia/packages/Pumas/PoEHP/src/simulate_methods/analytical.jl:158
[2] _problem(prob::Pumas.LinearODE, u0::LabelledArrays.SLArray{Tuple{1}, ForwardDiff.Dual{ForwardDiff.Tag{Pumas.Tag1, Float64}, Float64, 2}, 1, 1, (:SCR,)}, tspan::Tuple{Float64, Float64}, subject::Subject{NamedTuple{(:scr_mgdl,), Tuple{Vector{Union{Missing, Float64}}}}, Pumas.ConstantInterpolationStructArray{Vector{Float64}, StructArrays.StructVector{NamedTuple{(:age_yrs_adm, :wt_kg, :ht_cms, :is_male, :neph_med, :vaso_med, :trough_conc), Tuple{Float64, Float64, Float64, Int64, Int64, Int64, Float64}}, NamedTuple{(:age_yrs_adm, :wt_kg, :ht_cms, :is_male, :neph_med, :vaso_med, :trough_conc), Tuple{FillArrays.Fill{Float64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Float64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Float64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Int64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Int64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Int64, 1, Tuple{Base.OneTo{Int64}}}, Vector{Float64}}}, Int64}, Symbol}, Nothing, Vector{Float64}}, col::Pumas.Pre{Nothing, var"#311#327"{NamedTuple{(:tvKform, :tvKdeg, :Ω, :σ_add), Tuple{Float64, Float64, PDMats.PDiagMat{Float64, Vector{Float64}}, Float64}}, NamedTuple{(:η,), Tuple{Vector{ForwardDiff.Dual{ForwardDiff.Tag{Pumas.Tag1, Float64}, Float64, 2}}}}, Subject{NamedTuple{(:scr_mgdl,), Tuple{Vector{Union{Missing, Float64}}}}, Pumas.ConstantInterpolationStructArray{Vector{Float64}, StructArrays.StructVector{NamedTuple{(:age_yrs_adm, :wt_kg, :ht_cms, :is_male, :neph_med, :vaso_med, :trough_conc), Tuple{Float64, Float64, Float64, Int64, Int64, Int64, Float64}}, NamedTuple{(:age_yrs_adm, :wt_kg, :ht_cms, :is_male, :neph_med, :vaso_med, :trough_conc), Tuple{FillArrays.Fill{Float64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Float64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Float64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Int64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Int64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Int64, 1, Tuple{Base.OneTo{Int64}}}, Vector{Float64}}}, Int64}, Symbol}, Nothing, Vector{Float64}}}}, dcp::Pumas.Pre{Nothing, var"#313#329"{NamedTuple{(:tvKform, :tvKdeg, :Ω, :σ_add), Tuple{Float64, Float64, PDMats.PDiagMat{Float64, Vector{Float64}}, Float64}}, NamedTuple{(:η,), Tuple{Vector{ForwardDiff.Dual{ForwardDiff.Tag{Pumas.Tag1, Float64}, Float64, 2}}}}, Subject{NamedTuple{(:scr_mgdl,), Tuple{Vector{Union{Missing, Float64}}}}, Pumas.ConstantInterpolationStructArray{Vector{Float64}, StructArrays.StructVector{NamedTuple{(:age_yrs_adm, :wt_kg, :ht_cms, :is_male, :neph_med, :vaso_med, :trough_conc), Tuple{Float64, Float64, Float64, Int64, Int64, Int64, Float64}}, NamedTuple{(:age_yrs_adm, :wt_kg, :ht_cms, :is_male, :neph_med, :vaso_med, :trough_conc), Tuple{FillArrays.Fill{Float64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Float64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Float64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Int64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Int64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Int64, 1, Tuple{Base.OneTo{Int64}}}, Vector{Float64}}}, Int64}, Symbol}, Nothing, Vector{Float64}}}}; diffeq_options::NamedTuple{(:abstol, :reltol, :alg, :saveat), Tuple{Float64, Float64, CompositeAlgorithm{Tuple{Vern7, Rodas5{0, true, DefaultLinSolve, Val{:forward}, true}}, AutoSwitch{Vern7, Rodas5{0, true, DefaultLinSolve, Val{:forward}, true}, Rational{Int64}, Int64}}, Vector{Float64}}})
@ Pumas /builds/PumasAI/PumasSystemImages-jl/.julia/packages/Pumas/PoEHP/src/simulate_methods/analytical.jl:41
[3] _problem(model::PumasModel{(tvKform = 1, tvKdeg = 1, Ω = 2, σ_add = 1), 2, ParamSet{NamedTuple{(:tvKform, :tvKdeg, :Ω, :σ_add), Tuple{RealDomain{Int64, TransformVariables.Infinity{true}, Int64}, RealDomain{Int64, TransformVariables.Infinity{true}, Int64}, PDiagDomain{PDMats.PDiagMat{Float64, Vector{Float64}}}, RealDomain{Float64, TransformVariables.Infinity{true}, Float64}}}}, var"#309#325", var"#310#326", var"#312#328", var"#314#330", Pumas.LinearODE, var"#315#331", var"#320#336", ModelingToolkit.ODESystem}, subject::Subject{NamedTuple{(:scr_mgdl,), Tuple{Vector{Union{Missing, Float64}}}}, Pumas.ConstantInterpolationStructArray{Vector{Float64}, StructArrays.StructVector{NamedTuple{(:age_yrs_adm, :wt_kg, :ht_cms, :is_male, :neph_med, :vaso_med, :trough_conc), Tuple{Float64, Float64, Float64, Int64, Int64, Int64, Float64}}, NamedTuple{(:age_yrs_adm, :wt_kg, :ht_cms, :is_male, :neph_med, :vaso_med, :trough_conc), Tuple{FillArrays.Fill{Float64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Float64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Float64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Int64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Int64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Int64, 1, Tuple{Base.OneTo{Int64}}}, Vector{Float64}}}, Int64}, Symbol}, Nothing, Vector{Float64}}, col::Pumas.Pre{Nothing, var"#311#327"{NamedTuple{(:tvKform, :tvKdeg, :Ω, :σ_add), Tuple{Float64, Float64, PDMats.PDiagMat{Float64, Vector{Float64}}, Float64}}, NamedTuple{(:η,), Tuple{Vector{ForwardDiff.Dual{ForwardDiff.Tag{Pumas.Tag1, Float64}, Float64, 2}}}}, Subject{NamedTuple{(:scr_mgdl,), Tuple{Vector{Union{Missing, Float64}}}}, Pumas.ConstantInterpolationStructArray{Vector{Float64}, StructArrays.StructVector{NamedTuple{(:age_yrs_adm, :wt_kg, :ht_cms, :is_male, :neph_med, :vaso_med, :trough_conc), Tuple{Float64, Float64, Float64, Int64, Int64, Int64, Float64}}, NamedTuple{(:age_yrs_adm, :wt_kg, :ht_cms, :is_male, :neph_med, :vaso_med, :trough_conc), Tuple{FillArrays.Fill{Float64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Float64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Float64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Int64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Int64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Int64, 1, Tuple{Base.OneTo{Int64}}}, Vector{Float64}}}, Int64}, Symbol}, Nothing, Vector{Float64}}}}, dcp::Pumas.Pre{Nothing, var"#313#329"{NamedTuple{(:tvKform, :tvKdeg, :Ω, :σ_add), Tuple{Float64, Float64, PDMats.PDiagMat{Float64, Vector{Float64}}, Float64}}, NamedTuple{(:η,), Tuple{Vector{ForwardDiff.Dual{ForwardDiff.Tag{Pumas.Tag1, Float64}, Float64, 2}}}}, Subject{NamedTuple{(:scr_mgdl,), Tuple{Vector{Union{Missing, Float64}}}}, Pumas.ConstantInterpolationStructArray{Vector{Float64}, StructArrays.StructVector{NamedTuple{(:age_yrs_adm, :wt_kg, :ht_cms, :is_male, :neph_med, :vaso_med, :trough_conc), Tuple{Float64, Float64, Float64, Int64, Int64, Int64, Float64}}, NamedTuple{(:age_yrs_adm, :wt_kg, :ht_cms, :is_male, :neph_med, :vaso_med, :trough_conc), Tuple{FillArrays.Fill{Float64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Float64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Float64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Int64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Int64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Int64, 1, Tuple{Base.OneTo{Int64}}}, Vector{Float64}}}, Int64}, Symbol}, Nothing, Vector{Float64}}}}; diffeq_options::NamedTuple{(:abstol, :reltol, :alg, :saveat), Tuple{Float64, Float64, CompositeAlgorithm{Tuple{Vern7, Rodas5{0, true, DefaultLinSolve, Val{:forward}, true}}, AutoSwitch{Vern7, Rodas5{0, true, DefaultLinSolve, Val{:forward}, true}, Rational{Int64}, Int64}}, Vector{Float64}}})
@ Pumas /builds/PumasAI/PumasSystemImages-jl/.julia/packages/Pumas/PoEHP/src/models/model_api.jl:1000
[4] #_derived#266
@ /builds/PumasAI/PumasSystemImages-jl/.julia/packages/Pumas/PoEHP/src/models/model_api.jl:1046 [inlined]
[5] _derived_vηorth_gradient(m::PumasModel{(tvKform = 1, tvKdeg = 1, Ω = 2, σ_add = 1), 2, ParamSet{NamedTuple{(:tvKform, :tvKdeg, :Ω, :σ_add), Tuple{RealDomain{Int64, TransformVariables.Infinity{true}, Int64}, RealDomain{Int64, TransformVariables.Infinity{true}, Int64}, PDiagDomain{PDMats.PDiagMat{Float64, Vector{Float64}}}, RealDomain{Float64, TransformVariables.Infinity{true}, Float64}}}}, var"#309#325", var"#310#326", var"#312#328", var"#314#330", Pumas.LinearODE, var"#315#331", var"#320#336", ModelingToolkit.ODESystem}, subject::Subject{NamedTuple{(:scr_mgdl,), Tuple{Vector{Union{Missing, Float64}}}}, Pumas.ConstantInterpolationStructArray{Vector{Float64}, StructArrays.StructVector{NamedTuple{(:age_yrs_adm, :wt_kg, :ht_cms, :is_male, :neph_med, :vaso_med, :trough_conc), Tuple{Float64, Float64, Float64, Int64, Int64, Int64, Float64}}, NamedTuple{(:age_yrs_adm, :wt_kg, :ht_cms, :is_male, :neph_med, :vaso_med, :trough_conc), Tuple{FillArrays.Fill{Float64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Float64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Float64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Int64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Int64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Int64, 1, Tuple{Base.OneTo{Int64}}}, Vector{Float64}}}, Int64}, Symbol}, Nothing, Vector{Float64}}, param::NamedTuple{(:tvKform, :tvKdeg, :Ω, :σ_add), Tuple{Float64, Float64, PDMats.PDiagMat{Float64, Vector{Float64}}, Float64}}, vrandeffsorth::Vector{Float64}, diffeq_options::NamedTuple{(), Tuple{}})
@ Pumas /builds/PumasAI/PumasSystemImages-jl/.julia/packages/Pumas/PoEHP/src/estimation/likelihoods.jl:2180
[6] _∂²l∂η²(m::PumasModel{(tvKform = 1, tvKdeg = 1, Ω = 2, σ_add = 1), 2, ParamSet{NamedTuple{(:tvKform, :tvKdeg, :Ω, :σ_add), Tuple{RealDomain{Int64, TransformVariables.Infinity{true}, Int64}, RealDomain{Int64, TransformVariables.Infinity{true}, Int64}, PDiagDomain{PDMats.PDiagMat{Float64, Vector{Float64}}}, RealDomain{Float64, TransformVariables.Infinity{true}, Float64}}}}, var"#309#325", var"#310#326", var"#312#328", var"#314#330", Pumas.LinearODE, var"#315#331", var"#320#336", ModelingToolkit.ODESystem}, subject::Subject{NamedTuple{(:scr_mgdl,), Tuple{Vector{Union{Missing, Float64}}}}, Pumas.ConstantInterpolationStructArray{Vector{Float64}, StructArrays.StructVector{NamedTuple{(:age_yrs_adm, :wt_kg, :ht_cms, :is_male, :neph_med, :vaso_med, :trough_conc), Tuple{Float64, Float64, Float64, Int64, Int64, Int64, Float64}}, NamedTuple{(:age_yrs_adm, :wt_kg, :ht_cms, :is_male, :neph_med, :vaso_med, :trough_conc), Tuple{FillArrays.Fill{Float64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Float64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Float64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Int64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Int64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Int64, 1, Tuple{Base.OneTo{Int64}}}, Vector{Float64}}}, Int64}, Symbol}, Nothing, Vector{Float64}}, param::NamedTuple{(:tvKform, :tvKdeg, :Ω, :σ_add), Tuple{Float64, Float64, PDMats.PDiagMat{Float64, Vector{Float64}}, Float64}}, vrandeffsorth::Vector{Float64}, approx::Pumas.FOCE, diffeq_options::NamedTuple{(), Tuple{}})
@ Pumas /builds/PumasAI/PumasSystemImages-jl/.julia/packages/Pumas/PoEHP/src/estimation/likelihoods.jl:2224
[7] (::Pumas.var"#_fgh!#410"{PumasModel{(tvKform = 1, tvKdeg = 1, Ω = 2, σ_add = 1), 2, ParamSet{NamedTuple{(:tvKform, :tvKdeg, :Ω, :σ_add), Tuple{RealDomain{Int64, TransformVariables.Infinity{true}, Int64}, RealDomain{Int64, TransformVariables.Infinity{true}, Int64}, PDiagDomain{PDMats.PDiagMat{Float64, Vector{Float64}}}, RealDomain{Float64, TransformVariables.Infinity{true}, Float64}}}}, var"#309#325", var"#310#326", var"#312#328", var"#314#330", Pumas.LinearODE, var"#315#331", var"#320#336", ModelingToolkit.ODESystem}, Subject{NamedTuple{(:scr_mgdl,), Tuple{Vector{Union{Missing, Float64}}}}, Pumas.ConstantInterpolationStructArray{Vector{Float64}, StructArrays.StructVector{NamedTuple{(:age_yrs_adm, :wt_kg, :ht_cms, :is_male, :neph_med, :vaso_med, :trough_conc), Tuple{Float64, Float64, Float64, Int64, Int64, Int64, Float64}}, NamedTuple{(:age_yrs_adm, :wt_kg, :ht_cms, :is_male, :neph_med, :vaso_med, :trough_conc), Tuple{FillArrays.Fill{Float64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Float64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Float64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Int64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Int64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Int64, 1, Tuple{Base.OneTo{Int64}}}, Vector{Float64}}}, Int64}, Symbol}, Nothing, Vector{Float64}}, NamedTuple{(:tvKform, :tvKdeg, :Ω, :σ_add), Tuple{Float64, Float64, PDMats.PDiagMat{Float64, Vector{Float64}}, Float64}}, Pumas.FOCE, NamedTuple{(), Tuple{}}, TransformVariables.TransformTuple{NamedTuple{(:η,), Tuple{Pumas.MvNormalTransform{ZeroMeanDiagNormal{Tuple{Base.OneTo{Int64}}}}}}}, ParamSet{NamedTuple{(:η,), Tuple{ZeroMeanDiagNormal{Tuple{Base.OneTo{Int64}}}}}}})(F::Float64, G::Vector{Float64}, H::Matrix{Float64}, x::Vector{Float64})
@ Pumas /builds/PumasAI/PumasSystemImages-jl/.julia/packages/Pumas/PoEHP/src/estimation/likelihoods.jl:812
[8] (::NLSolversBase.var"#98#104"{NLSolversBase.InplaceObjective{Nothing, Nothing, Pumas.var"#_fgh!#410"{PumasModel{(tvKform = 1, tvKdeg = 1, Ω = 2, σ_add = 1), 2, ParamSet{NamedTuple{(:tvKform, :tvKdeg, :Ω, :σ_add), Tuple{RealDomain{Int64, TransformVariables.Infinity{true}, Int64}, RealDomain{Int64, TransformVariables.Infinity{true}, Int64}, PDiagDomain{PDMats.PDiagMat{Float64, Vector{Float64}}}, RealDomain{Float64, TransformVariables.Infinity{true}, Float64}}}}, var"#309#325", var"#310#326", var"#312#328", var"#314#330", Pumas.LinearODE, var"#315#331", var"#320#336", ModelingToolkit.ODESystem}, Subject{NamedTuple{(:scr_mgdl,), Tuple{Vector{Union{Missing, Float64}}}}, Pumas.ConstantInterpolationStructArray{Vector{Float64}, StructArrays.StructVector{NamedTuple{(:age_yrs_adm, :wt_kg, :ht_cms, :is_male, :neph_med, :vaso_med, :trough_conc), Tuple{Float64, Float64, Float64, Int64, Int64, Int64, Float64}}, NamedTuple{(:age_yrs_adm, :wt_kg, :ht_cms, :is_male, :neph_med, :vaso_med, :trough_conc), Tuple{FillArrays.Fill{Float64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Float64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Float64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Int64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Int64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Int64, 1, Tuple{Base.OneTo{Int64}}}, Vector{Float64}}}, Int64}, Symbol}, Nothing, Vector{Float64}}, NamedTuple{(:tvKform, :tvKdeg, :Ω, :σ_add), Tuple{Float64, Float64, PDMats.PDiagMat{Float64, Vector{Float64}}, Float64}}, Pumas.FOCE, NamedTuple{(), Tuple{}}, TransformVariables.TransformTuple{NamedTuple{(:η,), Tuple{Pumas.MvNormalTransform{ZeroMeanDiagNormal{Tuple{Base.OneTo{Int64}}}}}}}, ParamSet{NamedTuple{(:η,), Tuple{ZeroMeanDiagNormal{Tuple{Base.OneTo{Int64}}}}}}}, Nothing, Nothing}, Float64})(G::Vector{Float64}, H::Matrix{Float64}, x::Vector{Float64})
@ NLSolversBase /builds/PumasAI/PumasSystemImages-jl/.julia/packages/NLSolversBase/cfJrN/src/objective_types/incomplete.jl:115
[9] value_gradient_hessian!!(obj::NLSolversBase.TwiceDifferentiable{Float64, Vector{Float64}, Matrix{Float64}, Vector{Float64}}, x::Vector{Float64})
@ NLSolversBase /builds/PumasAI/PumasSystemImages-jl/.julia/packages/NLSolversBase/cfJrN/src/objective_types/incomplete.jl:138
[10] initial_state(method::Optim.NewtonTrustRegion{Float64}, options::Optim.Options{Float64, Nothing}, d::NLSolversBase.TwiceDifferentiable{Float64, Vector{Float64}, Matrix{Float64}, Vector{Float64}}, initial_x::Vector{Float64})
@ Optim /builds/PumasAI/PumasSystemImages-jl/.julia/packages/Optim/6Lpjy/src/multivariate/solvers/second_order/newton_trust_region.jl:310
[11] optimize
@ /builds/PumasAI/PumasSystemImages-jl/.julia/packages/Optim/6Lpjy/src/multivariate/optimize/optimize.jl:36 [inlined]
[12] _orth_empirical_bayes!(vrandeffsorth::Vector{Float64}, m::PumasModel{(tvKform = 1, tvKdeg = 1, Ω = 2, σ_add = 1), 2, ParamSet{NamedTuple{(:tvKform, :tvKdeg, :Ω, :σ_add), Tuple{RealDomain{Int64, TransformVariables.Infinity{true}, Int64}, RealDomain{Int64, TransformVariables.Infinity{true}, Int64}, PDiagDomain{PDMats.PDiagMat{Float64, Vector{Float64}}}, RealDomain{Float64, TransformVariables.Infinity{true}, Float64}}}}, var"#309#325", var"#310#326", var"#312#328", var"#314#330", Pumas.LinearODE, var"#315#331", var"#320#336", ModelingToolkit.ODESystem}, subject::Subject{NamedTuple{(:scr_mgdl,), Tuple{Vector{Union{Missing, Float64}}}}, Pumas.ConstantInterpolationStructArray{Vector{Float64}, StructArrays.StructVector{NamedTuple{(:age_yrs_adm, :wt_kg, :ht_cms, :is_male, :neph_med, :vaso_med, :trough_conc), Tuple{Float64, Float64, Float64, Int64, Int64, Int64, Float64}}, NamedTuple{(:age_yrs_adm, :wt_kg, :ht_cms, :is_male, :neph_med, :vaso_med, :trough_conc), Tuple{FillArrays.Fill{Float64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Float64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Float64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Int64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Int64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Int64, 1, Tuple{Base.OneTo{Int64}}}, Vector{Float64}}}, Int64}, Symbol}, Nothing, Vector{Float64}}, param::NamedTuple{(:tvKform, :tvKdeg, :Ω, :σ_add), Tuple{Float64, Float64, PDMats.PDiagMat{Float64, Vector{Float64}}, Float64}}, approx::Pumas.FOCE, diffeq_options::NamedTuple{(), Tuple{}})
@ Pumas /builds/PumasAI/PumasSystemImages-jl/.julia/packages/Pumas/PoEHP/src/estimation/likelihoods.jl:839
[13] _update_ebes_and_evaluate_marginal_nll!(m::PumasModel{(tvKform = 1, tvKdeg = 1, Ω = 2, σ_add = 1), 2, ParamSet{NamedTuple{(:tvKform, :tvKdeg, :Ω, :σ_add), Tuple{RealDomain{Int64, TransformVariables.Infinity{true}, Int64}, RealDomain{Int64, TransformVariables.Infinity{true}, Int64}, PDiagDomain{PDMats.PDiagMat{Float64, Vector{Float64}}}, RealDomain{Float64, TransformVariables.Infinity{true}, Float64}}}}, var"#309#325", var"#310#326", var"#312#328", var"#314#330", Pumas.LinearODE, var"#315#331", var"#320#336", ModelingToolkit.ODESystem}, subject::Subject{NamedTuple{(:scr_mgdl,), Tuple{Vector{Union{Missing, Float64}}}}, Pumas.ConstantInterpolationStructArray{Vector{Float64}, StructArrays.StructVector{NamedTuple{(:age_yrs_adm, :wt_kg, :ht_cms, :is_male, :neph_med, :vaso_med, :trough_conc), Tuple{Float64, Float64, Float64, Int64, Int64, Int64, Float64}}, NamedTuple{(:age_yrs_adm, :wt_kg, :ht_cms, :is_male, :neph_med, :vaso_med, :trough_conc), Tuple{FillArrays.Fill{Float64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Float64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Float64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Int64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Int64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Int64, 1, Tuple{Base.OneTo{Int64}}}, Vector{Float64}}}, Int64}, Symbol}, Nothing, Vector{Float64}}, param::NamedTuple{(:tvKform, :tvKdeg, :Ω, :σ_add), Tuple{Float64, Float64, PDMats.PDiagMat{Float64, Vector{Float64}}, Float64}}, vrandeffsorth::Vector{Float64}, vrandeffsorth_tmp::Vector{Float64}, approx::Pumas.FOCE, diffeq_options::NamedTuple{(), Tuple{}})
@ Pumas /builds/PumasAI/PumasSystemImages-jl/.julia/packages/Pumas/PoEHP/src/estimation/likelihoods.jl:2665
[14] _update_ebes_and_evaluate_marginal_nll_threads!(m::PumasModel{(tvKform = 1, tvKdeg = 1, Ω = 2, σ_add = 1), 2, ParamSet{NamedTuple{(:tvKform, :tvKdeg, :Ω, :σ_add), Tuple{RealDomain{Int64, TransformVariables.Infinity{true}, Int64}, RealDomain{Int64, TransformVariables.Infinity{true}, Int64}, PDiagDomain{PDMats.PDiagMat{Float64, Vector{Float64}}}, RealDomain{Float64, TransformVariables.Infinity{true}, Float64}}}}, var"#309#325", var"#310#326", var"#312#328", var"#314#330", Pumas.LinearODE, var"#315#331", var"#320#336", ModelingToolkit.ODESystem}, population::Vector{Subject{NamedTuple{(:scr_mgdl,), Tuple{Vector{Union{Missing, Float64}}}}, Pumas.ConstantInterpolationStructArray{Vector{Float64}, StructArrays.StructVector{NamedTuple{(:age_yrs_adm, :wt_kg, :ht_cms, :is_male, :neph_med, :vaso_med, :trough_conc), Tuple{Float64, Float64, Float64, Int64, Int64, Int64, Float64}}, NamedTuple{(:age_yrs_adm, :wt_kg, :ht_cms, :is_male, :neph_med, :vaso_med, :trough_conc), Tuple{FillArrays.Fill{Float64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Float64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Float64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Int64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Int64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Int64, 1, Tuple{Base.OneTo{Int64}}}, Vector{Float64}}}, Int64}, Symbol}, Nothing, Vector{Float64}}}, param::NamedTuple{(:tvKform, :tvKdeg, :Ω, :σ_add), Tuple{Float64, Float64, PDMats.PDiagMat{Float64, Vector{Float64}}, Float64}}, vvrandeffs::Vector{Vector{Float64}}, vvrandeffs_tmp::Vector{Vector{Float64}}, approx::Pumas.FOCE, diffeq_options::NamedTuple{(), Tuple{}})
@ Pumas /builds/PumasAI/PumasSystemImages-jl/.julia/packages/Pumas/PoEHP/src/estimation/likelihoods.jl:2714
[15] (::Pumas.var"#521#523"{PumasModel{(tvKform = 1, tvKdeg = 1, Ω = 2, σ_add = 1), 2, ParamSet{NamedTuple{(:tvKform, :tvKdeg, :Ω, :σ_add), Tuple{RealDomain{Int64, TransformVariables.Infinity{true}, Int64}, RealDomain{Int64, TransformVariables.Infinity{true}, Int64}, PDiagDomain{PDMats.PDiagMat{Float64, Vector{Float64}}}, RealDomain{Float64, TransformVariables.Infinity{true}, Float64}}}}, var"#309#325", var"#310#326", var"#312#328", var"#314#330", Pumas.LinearODE, var"#315#331", var"#320#336", ModelingToolkit.ODESystem}, Vector{Subject{NamedTuple{(:scr_mgdl,), Tuple{Vector{Union{Missing, Float64}}}}, Pumas.ConstantInterpolationStructArray{Vector{Float64}, StructArrays.StructVector{NamedTuple{(:age_yrs_adm, :wt_kg, :ht_cms, :is_male, :neph_med, :vaso_med, :trough_conc), Tuple{Float64, Float64, Float64, Int64, Int64, Int64, Float64}}, NamedTuple{(:age_yrs_adm, :wt_kg, :ht_cms, :is_male, :neph_med, :vaso_med, :trough_conc), Tuple{FillArrays.Fill{Float64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Float64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Float64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Int64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Int64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Int64, 1, Tuple{Base.OneTo{Int64}}}, Vector{Float64}}}, Int64}, Symbol}, Nothing, Vector{Float64}}}, Pumas.FOCE, EnsembleThreads, NamedTuple{(), Tuple{}}, TransformVariables.TransformTuple{NamedTuple{(:tvKform, :tvKdeg, :Ω, :σ_add), Tuple{TransformVariables.ShiftedExp{true, Float64}, TransformVariables.ShiftedExp{true, Float64}, Pumas.PDiagTransform, TransformVariables.ShiftedExp{true, Float64}}}}, Vector{Vector{Float64}}, Vector{Vector{Float64}}, Vector{Float64}})(f::Float64, g::Vector{Float64}, _vparam::Vector{Float64})
After evaluating the dataset, I understood that the reason for error is due to reading in the dataset with a time varying covariate. I ran the following code by creating dummy data and saw that in the presence of a time varying covariate the read_pumas
function does not add a row at time=0 (Dummy data code result below). The fit does not error with the df_noerror
population but errors with df_error
Dummy data code
df1 = DataFrame(id = "subj1", time = 1:1:10,
dv = [0.81, 0.82, 0.92, 0.99, 1.04, 1.1, 0.94, 0.84, 0.92, 0.93],
age = 17.5, wt = 83.5,
cov1 = [4.42, 4.42, 4.42, 5.48, 6.48, 6.94, 6.1, 6.1, 6.1, 6.1])
df_noerror = read_pumas(df1, event_data=false, covariates = [:age, :wt])
DataFrame(df_noerror)
df_error = read_pumas(df1, event_data=false, covariates = [:age, :wt, :cov1])
DataFrame(df_error)
Dummy data code result
julia> df1 = DataFrame(id = "subj1", time = 1:1:10,
dv = [0.81, 0.82, 0.92, 0.99, 1.04, 1.1, 0.94, 0.84, 0.92, 0.93],
age = 17.5, wt = 83.5,
cov1 = [4.42, 4.42, 4.42, 5.48, 6.48, 6.94, 6.1, 6.1, 6.1, 6.1])
julia> df_noerror = read_pumas(df1, event_data=false, covariates = [:age, :wt])
DataFrame(df_noerror)
11×6 DataFrame
Row │ id time evid dv age wt
│ String Float64 Int64? Float64? Float64? Float64?
─────┼──────────────────────────────────────────────────────────
1 │ subj1 0.0 missing missing 17.5 83.5
2 │ subj1 1.0 0 0.81 17.5 83.5
3 │ subj1 2.0 0 0.82 17.5 83.5
4 │ subj1 3.0 0 0.92 17.5 83.5
5 │ subj1 4.0 0 0.99 17.5 83.5
6 │ subj1 5.0 0 1.04 17.5 83.5
7 │ subj1 6.0 0 1.1 17.5 83.5
8 │ subj1 7.0 0 0.94 17.5 83.5
9 │ subj1 8.0 0 0.84 17.5 83.5
10 │ subj1 9.0 0 0.92 17.5 83.5
11 │ subj1 10.0 0 0.93 17.5 83.5
julia> df_error = read_pumas(df1, event_data=false, covariates = [:age, :wt, :cov1])
DataFrame(df_error)
10×7 DataFrame
Row │ id time evid dv age wt cov1
│ String Float64 Int64? Float64? Float64? Float64? Float64?
─────┼─────────────────────────────────────────────────────────────────
1 │ subj1 1.0 0 0.81 17.5 83.5 4.42
2 │ subj1 2.0 0 0.82 17.5 83.5 4.42
3 │ subj1 3.0 0 0.92 17.5 83.5 4.42
4 │ subj1 4.0 0 0.99 17.5 83.5 5.48
5 │ subj1 5.0 0 1.04 17.5 83.5 6.48
6 │ subj1 6.0 0 1.1 17.5 83.5 6.94
7 │ subj1 7.0 0 0.94 17.5 83.5 6.1
8 │ subj1 8.0 0 0.84 17.5 83.5 6.1
9 │ subj1 9.0 0 0.92 17.5 83.5 6.1
10 │ subj1 10.0 0 0.93 17.5 83.5 6.1
Please let me know how to resolve this error. Thanks!