I’ve been working on a fitting where there are some measurements before dosing, but not at the exact dosing time -
time tad rate amt Drug
Float64 Float64 Float64⍰ Float64⍰ Float64⍰
0.0 0.0 missing missing 12
0.1 0.0 1000 100.0 missing
0.5 0.4 missing missing 1000
1.0 0.9 missing missing 980
evid is 1 where amt is not missing, 0 otherwise.
I define my julia dataset as:
dfP=read_pumas(df9 ,id=:Subject, evid=:evid, time=:Time, amt=:Dosemg, rate=:rate, dvs=[:Drug])
In the model
@derived begin
a1 = A1
Conc_Mean = C1
Drug ~ @. Normal(Conc_Mean, sqrt(Conc_Mean^2*σ_prop))
However when I run the estimation my model fails:
param=init_param(Model)
# res3 = fit(Model,dfP,param,Pumas.FOCEI())
res2= fit(Model,dfP,param,Pumas.NaivePooled())
I wonder if this is because of my missing value in :Drug, which is my dependent variable or if something else is going on?
If the former - is there a way for the estimator to inpute the value?
┌ Warning: First function call produced NaNs. Exiting.
└ @ OrdinaryDiffEq C:\Users\awolf-yadlin.juliapro\JuliaPro_v1.2.0-1\packages\OrdinaryDiffEq\UsWa2\src\initdt.jl:135
┌ Warning: Automatic dt set the starting dt as NaN, causing instability.
└ @ OrdinaryDiffEq C:\Users\awolf-yadlin.juliapro\JuliaPro_v1.2.0-1\packages\OrdinaryDiffEq\UsWa2\src\solve.jl:403
┌ Warning: First function call produced NaNs. Exiting.
└ @ OrdinaryDiffEq C:\Users\awolf-yadlin.juliapro\JuliaPro_v1.2.0-1\packages\OrdinaryDiffEq\UsWa2\src\initdt.jl:135
type NamedTuple has no field dv
Stacktrace:
[1] getproperty(::Any, ::Symbol) at .\Base.jl:20
[2] (::getfield(Pumas, Symbol("##462#464")))(::Subject{NamedTuple{(:Drug,),Tuple{Array{Union{Missing, Float64},1}}},Nothing,Array{Pumas.Event{Float64,Float64,Float64,Float64,Float64,Float64,Int64},1},Array{Float64,1}}) at C:\Users\awolf-yadlin.juliapro\JuliaPro_v1.2.0-1\packages\Pumas\6uorK\src\estimation\show.jl:15
[3] _mapreduce(::getfield(Pumas, Symbol("##462#464")), ::typeof(Base.add_sum), ::IndexLinear, ::Array{Subject{NamedTuple{(:Drug,),Tuple{Array{Union{Missing, Float64},1}}},Nothing,Array{Pumas.Event{Float64,Float64,Float64,Float64,Float64,Float64,Int64},1},Array{Float64,1}},1}) at .\reduce.jl:317
[4] _mapreduce_dim(::Function, ::Function, ::NamedTuple{,Tuple{}}, ::Array{Subject{NamedTuple{(:Drug,),Tuple{Array{Union{Missing, Float64},1}}},Nothing,Array{Pumas.Event{Float64,Float64,Float64,Float64,Float64,Float64,Int64},1},Array{Float64,1}},1}, ::Colon) at .\reducedim.jl:312
[5] #mapreduce#555 at .\reducedim.jl:307 [inlined]
[6] mapreduce at .\reducedim.jl:307 [inlined]
[7] _sum(::Function, ::Array{Subject{NamedTuple{(:Drug,),Tuple{Array{Union{Missing, Float64},1}}},Nothing,Array{Pumas.Event{Float64,Float64,Float64,Float64,Float64,Float64,Int64},1},Array{Float64,1}},1}, ::Colon) at .\reducedim.jl:657
[8] #sum#559 at .\reducedim.jl:653 [inlined]
[9] sum at .\reducedim.jl:653 [inlined]
[10] _print_fit_header(::IOContext{Base.GenericIOBuffer{Array{UInt8,1}}}, ::Pumas.FittedPumasModel{PumasModel{ParamSet{NamedTuple{(:θ, :σ_prop),Tuple{VectorDomain{Array{Float64,1},Array{TransformVariables.Infinity{true},1},Array{Float64,1}},RealDomain{Float64,Int64,Float64}}}},getfield(Main, Symbol("##1107#1114")),getfield(Main, Symbol("##1108#1115")),getfield(Main, Symbol("##1109#1116")),ODEProblem{Nothing,Tuple{Nothing,Nothing},false,Nothing,ODEFunction{false,getfield(Main, Symbol("##1110#1117")),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{,Tuple{}}},DiffEqBase.StandardODEProblem},getfield(Main, Symbol("##1112#1119")),getfield(Main, Symbol("##1113#1120"))},Array{Subject{NamedTuple{(:Drug,),Tuple{Array{Union{Missing, Float64},1}}},Nothing,Array{Pumas.Event{Float64,Float64,Float64,Float64,Float64,Float64,Int64},1},Array{Float64,1}},1},Optim.MultivariateOptimizationResults{Optim.BFGS{LineSearches.InitialStatic{Float64},LineSearches.BackTracking{Float64,Int64},getfield(Pumas, Symbol("##200#201")){NLSolversBase.OnceDifferentiable{Float64,Array{Float64,1},Array{Float64,1}},Array{Float64,1}},Nothing,Optim.Flat},Float64,Array{Float64,1},Float64,Float64,Array{Optim.OptimizationState{Float64,Optim.BFGS{LineSearches.InitialStatic{Float64},LineSearches.BackTracking{Float64,Int64},getfield(Pumas, Symbol("##200#201")){NLSolversBase.OnceDifferentiable{Float64,Array{Float64,1},Array{Float64,1}},Array{Float64,1}},Nothing,Optim.Flat}},1},Bool},Pumas.NaivePooled,Array{Array{Any,1},1},Tuple{},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{,Tuple{}}},TransformVariables.TransformTuple{NamedTuple{(:θ, :σ_prop),Tuple{Pumas.ElementArrayTransform{TransformVariables.ShiftedExp{true,Float64},1},TransformVariables.ScaledShiftedLogistic{Float64}}}}}) at C:\Users\awolf-yadlin.juliapro\JuliaPro_v1.2.0-1\packages\Pumas\6uorK\src\estimation\show.jl:14
[11] show(::IOContext{Base.GenericIOBuffer{Array{UInt8,1}}}, ::MIME{Symbol(“text/plain”)}, ::Pumas.FittedPumasModel{PumasModel{ParamSet{NamedTuple{(:θ, :σ_prop),Tuple{VectorDomain{Array{Float64,1},Array{TransformVariables.Infinity{true},1},Array{Float64,1}},RealDomain{Float64,Int64,Float64}}}},getfield(Main, Symbol("##1107#1114")),getfield(Main, Symbol("##1108#1115")),getfield(Main, Symbol("##1109#1116")),ODEProblem{Nothing,Tuple{Nothing,Nothing},false,Nothing,ODEFunction{false,getfield(Main, Symbol("##1110#1117")),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{,Tuple{}}},DiffEqBase.StandardODEProblem},getfield(Main, Symbol("##1112#1119")),getfield(Main, Symbol("##1113#1120"))},Array{Subject{NamedTuple{(:Drug,),Tuple{Array{Union{Missing, Float64},1}}},Nothing,Array{Pumas.Event{Float64,Float64,Float64,Float64,Float64,Float64,Int64},1},Array{Float64,1}},1},Optim.MultivariateOptimizationResults{Optim.BFGS{LineSearches.InitialStatic{Float64},LineSearches.BackTracking{Float64,Int64},getfield(Pumas, Symbol("##200#201")){NLSolversBase.OnceDifferentiable{Float64,Array{Float64,1},Array{Float64,1}},Array{Float64,1}},Nothing,Optim.Flat},Float64,Array{Float64,1},Float64,Float64,Array{Optim.OptimizationState{Float64,Optim.BFGS{LineSearches.InitialStatic{Float64},LineSearches.BackTracking{Float64,Int64},getfield(Pumas, Symbol("##200#201")){NLSolversBase.OnceDifferentiable{Float64,Array{Float64,1},Array{Float64,1}},Array{Float64,1}},Nothing,Optim.Flat}},1},Bool},Pumas.NaivePooled,Array{Array{Any,1},1},Tuple{},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{,Tuple{}}},TransformVariables.TransformTuple{NamedTuple{(:θ, :σ_prop),Tuple{Pumas.ElementArrayTransform{TransformVariables.ShiftedExp{true,Float64},1},TransformVariables.ScaledShiftedLogistic{Float64}}}}}) at C:\Users\awolf-yadlin.juliapro\JuliaPro_v1.2.0-1\packages\Pumas\6uorK\src\estimation\show.jl:23
[12] limitstringmime(::MIME{Symbol(“text/plain”)}, ::Pumas.FittedPumasModel{PumasModel{ParamSet{NamedTuple{(:θ, :σ_prop),Tuple{VectorDomain{Array{Float64,1},Array{TransformVariables.Infinity{true},1},Array{Float64,1}},RealDomain{Float64,Int64,Float64}}}},getfield(Main, Symbol("##1107#1114")),getfield(Main, Symbol("##1108#1115")),getfield(Main, Symbol("##1109#1116")),ODEProblem{Nothing,Tuple{Nothing,Nothing},false,Nothing,ODEFunction{false,getfield(Main, Symbol("##1110#1117")),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{,Tuple{}}},DiffEqBase.StandardODEProblem},getfield(Main, Symbol("##1112#1119")),getfield(Main, Symbol("##1113#1120"))},Array{Subject{NamedTuple{(:Drug,),Tuple{Array{Union{Missing, Float64},1}}},Nothing,Array{Pumas.Event{Float64,Float64,Float64,Float64,Float64,Float64,Int64},1},Array{Float64,1}},1},Optim.MultivariateOptimizationResults{Optim.BFGS{LineSearches.InitialStatic{Float64},LineSearches.BackTracking{Float64,Int64},getfield(Pumas, Symbol("##200#201")){NLSolversBase.OnceDifferentiable{Float64,Array{Float64,1},Array{Float64,1}},Array{Float64,1}},Nothing,Optim.Flat},Float64,Array{Float64,1},Float64,Float64,Array{Optim.OptimizationState{Float64,Optim.BFGS{LineSearches.InitialStatic{Float64},LineSearches.BackTracking{Float64,Int64},getfield(Pumas, Symbol("##200#201")){NLSolversBase.OnceDifferentiable{Float64,Array{Float64,1},Array{Float64,1}},Array{Float64,1}},Nothing,Optim.Flat}},1},Bool},Pumas.NaivePooled,Array{Array{Any,1},1},Tuple{},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{,Tuple{}}},TransformVariables.TransformTuple{NamedTuple{(:θ, :σ_prop),Tuple{Pumas.ElementArrayTransform{TransformVariables.ShiftedExp{true,Float64},1},TransformVariables.ScaledShiftedLogistic{Float64}}}}}) at C:\Users\awolf-yadlin.juliapro\JuliaPro_v1.2.0-1\packages\IJulia\fRegO\src\inline.jl:37
[13] display_mimestring(::MIME{Symbol(“text/plain”)}, ::Pumas.FittedPumasModel{PumasModel{ParamSet{NamedTuple{(:θ, :σ_prop),Tuple{VectorDomain{Array{Float64,1},Array{TransformVariables.Infinity{true},1},Array{Float64,1}},RealDomain{Float64,Int64,Float64}}}},getfield(Main, Symbol("##1107#1114")),getfield(Main, Symbol("##1108#1115")),getfield(Main, Symbol("##1109#1116")),ODEProblem{Nothing,Tuple{Nothing,Nothing},false,Nothing,ODEFunction{false,getfield(Main, Symbol("##1110#1117")),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{,Tuple{}}},DiffEqBase.StandardODEProblem},getfield(Main, Symbol("##1112#1119")),getfield(Main, Symbol("##1113#1120"))},Array{Subject{NamedTuple{(:Drug,),Tuple{Array{Union{Missing, Float64},1}}},Nothing,Array{Pumas.Event{Float64,Float64,Float64,Float64,Float64,Float64,Int64},1},Array{Float64,1}},1},Optim.MultivariateOptimizationResults{Optim.BFGS{LineSearches.InitialStatic{Float64},LineSearches.BackTracking{Float64,Int64},getfield(Pumas, Symbol("##200#201")){NLSolversBase.OnceDifferentiable{Float64,Array{Float64,1},Array{Float64,1}},Array{Float64,1}},Nothing,Optim.Flat},Float64,Array{Float64,1},Float64,Float64,Array{Optim.OptimizationState{Float64,Optim.BFGS{LineSearches.InitialStatic{Float64},LineSearches.BackTracking{Float64,Int64},getfield(Pumas, Symbol("##200#201")){NLSolversBase.OnceDifferentiable{Float64,Array{Float64,1},Array{Float64,1}},Array{Float64,1}},Nothing,Optim.Flat}},1},Bool},Pumas.NaivePooled,Array{Array{Any,1},1},Tuple{},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{,Tuple{}}},TransformVariables.TransformTuple{NamedTuple{(:θ, :σ_prop),Tuple{Pumas.ElementArrayTransform{TransformVariables.ShiftedExp{true,Float64},1},TransformVariables.ScaledShiftedLogistic{Float64}}}}}) at C:\Users\awolf-yadlin.juliapro\JuliaPro_v1.2.0-1\packages\IJulia\fRegO\src\display.jl:67
[14] display_dict(::Pumas.FittedPumasModel{PumasModel{ParamSet{NamedTuple{(:θ, :σ_prop),Tuple{VectorDomain{Array{Float64,1},Array{TransformVariables.Infinity{true},1},Array{Float64,1}},RealDomain{Float64,Int64,Float64}}}},getfield(Main, Symbol("##1107#1114")),getfield(Main, Symbol("##1108#1115")),getfield(Main, Symbol("##1109#1116")),ODEProblem{Nothing,Tuple{Nothing,Nothing},false,Nothing,ODEFunction{false,getfield(Main, Symbol("##1110#1117")),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{,Tuple{}}},DiffEqBase.StandardODEProblem},getfield(Main, Symbol("##1112#1119")),getfield(Main, Symbol("##1113#1120"))},Array{Subject{NamedTuple{(:Drug,),Tuple{Array{Union{Missing, Float64},1}}},Nothing,Array{Pumas.Event{Float64,Float64,Float64,Float64,Float64,Float64,Int64},1},Array{Float64,1}},1},Optim.MultivariateOptimizationResults{Optim.BFGS{LineSearches.InitialStatic{Float64},LineSearches.BackTracking{Float64,Int64},getfield(Pumas, Symbol("##200#201")){NLSolversBase.OnceDifferentiable{Float64,Array{Float64,1},Array{Float64,1}},Array{Float64,1}},Nothing,Optim.Flat},Float64,Array{Float64,1},Float64,Float64,Array{Optim.OptimizationState{Float64,Optim.BFGS{LineSearches.InitialStatic{Float64},LineSearches.BackTracking{Float64,Int64},getfield(Pumas, Symbol("##200#201")){NLSolversBase.OnceDifferentiable{Float64,Array{Float64,1},Array{Float64,1}},Array{Float64,1}},Nothing,Optim.Flat}},1},Bool},Pumas.NaivePooled,Array{Array{Any,1},1},Tuple{},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{,Tuple{}}},TransformVariables.TransformTuple{NamedTuple{(:θ, :σ_prop),Tuple{Pumas.ElementArrayTransform{TransformVariables.ShiftedExp{true,Float64},1},TransformVariables.ScaledShiftedLogistic{Float64}}}}}) at C:\Users\awolf-yadlin.juliapro\JuliaPro_v1.2.0-1\packages\IJulia\fRegO\src\display.jl:96
[15] #invokelatest#1 at .\essentials.jl:790 [inlined]
[16] invokelatest at .\essentials.jl:789 [inlined]
[17] execute_request(::ZMQ.Socket, ::IJulia.Msg) at C:\Users\awolf-yadlin.juliapro\JuliaPro_v1.2.0-1\packages\IJulia\fRegO\src\execute_request.jl:112
[18] #invokelatest#1 at .\essentials.jl:790 [inlined]
[19] invokelatest at .\essentials.jl:789 [inlined]
[20] eventloop(::ZMQ.Socket) at C:\Users\awolf-yadlin.juliapro\JuliaPro_v1.2.0-1\packages\IJulia\fRegO\src\eventloop.jl:8
[21] (::getfield(IJulia, Symbol("##15#18")))() at .\task.jl:268