Help with fitting population

Hi,
It’s been a long time -
I have a fitting error that I can’t get rid off -
I have gone through my data and I don’t see anything wrong with it - the model will simulate quite well, but when I try to fit to my dataset it breaks almost immediatly -
There is an error trying to access an Array at index 1 for a an Array of size 0, but I don’t see anything in the data that could explain that.

Could you point me at what an error like this may be pointing so I can investigate and try to fix?

Thanks,

Ale-

As always happy to share model and data if needed.

BoundsError: attempt to access 0-element Array{Float64,1} at index [1]

Stacktrace:
 [1] getindex at .\array.jl:728 [inlined]
 [2] #solve_tr_subproblem!#36(::Float64, ::Int64, ::typeof(Optim.solve_tr_subproblem!), ::Array{Float64,1}, ::Array{Float64,2}, ::Float64, ::Array{Float64,1}) at C:\Users\awolf-yadlin\.juliapro\JuliaPro_v1.2.0-2\packages\Optim\cJRng\src\multivariate\solvers\second_order\newton_trust_region.jl:105
 [3] solve_tr_subproblem! at C:\Users\awolf-yadlin\.juliapro\JuliaPro_v1.2.0-2\packages\Optim\cJRng\src\multivariate\solvers\second_order\newton_trust_region.jl:94 [inlined]
 [4] update_state!(::NLSolversBase.TwiceDifferentiable{Float64,Array{Float64,1},Array{Float64,2},Array{Float64,1}}, ::Optim.NewtonTrustRegionState{Array{Float64,1},Float64,Array{Float64,1}}, ::Optim.NewtonTrustRegion{Float64}) at C:\Users\awolf-yadlin\.juliapro\JuliaPro_v1.2.0-2\packages\Optim\cJRng\src\multivariate\solvers\second_order\newton_trust_region.jl:314
 [5] optimize(::NLSolversBase.TwiceDifferentiable{Float64,Array{Float64,1},Array{Float64,2},Array{Float64,1}}, ::Array{Float64,1}, ::Optim.NewtonTrustRegion{Float64}, ::Optim.Options{Float64,Nothing}, ::Optim.NewtonTrustRegionState{Array{Float64,1},Float64,Array{Float64,1}}) at C:\Users\awolf-yadlin\.juliapro\JuliaPro_v1.2.0-2\packages\Optim\cJRng\src\multivariate\optimize\optimize.jl:57
 [6] optimize at C:\Users\awolf-yadlin\.juliapro\JuliaPro_v1.2.0-2\packages\Optim\cJRng\src\multivariate\optimize\optimize.jl:33 [inlined]
 [7] #_orth_empirical_bayes!#145(::Base.Iterators.Pairs{Symbol,Any,Tuple{Symbol,Symbol},NamedTuple{(:maxiters, :alg),Tuple{Int64,Rodas5{0,false,DefaultLinSolve,DataType}}}}, ::typeof(Pumas._orth_empirical_bayes!), ::Array{Float64,1}, ::PumasModel{ParamSet{NamedTuple{(:θ, :Ω, :σ_prop),Tuple{VectorDomain{Array{Float64,1},Array{TransformVariables.Infinity{true},1},Array{Float64,1}},PDiagDomain{PDMats.PDiagMat{Float64,Array{Float64,1}}},RealDomain{Float64,TransformVariables.Infinity{true},Float64}}}},getfield(Main, Symbol("##437#444")),getfield(Main, Symbol("##438#445")),getfield(Main, Symbol("##439#446")),ODEProblem{Nothing,Tuple{Nothing,Nothing},false,Nothing,ODEFunction{false,getfield(Main, Symbol("##440#447")),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{,Tuple{}}},DiffEqBase.StandardODEProblem},getfield(Main, Symbol("##442#449")),getfield(Main, Symbol("##443#450"))}, ::Subject{NamedTuple{(:RO,),Tuple{Array{Union{Missing, Float64},1}}},NamedTuple{(:CLS, :V1S, :kshd),Tuple{Float64,Float64,Float64}},Array{Pumas.Event{Float64,Float64,Float64,Float64,Float64,Float64,Int64},1},Array{Float64,1}}, ::NamedTuple{(:θ, :Ω, :σ_prop),Tuple{Array{Float64,1},PDMats.PDiagMat{Float64,Array{Float64,1}},Float64}}, ::Pumas.FOCEI) at C:\Users\awolf-yadlin\.juliapro\JuliaPro_v1.2.0-2\packages\Pumas\Twdge\src\estimation\likelihoods.jl:248
 [8] mapfoldl_impl(::getfield(Pumas, Symbol("##219#225")){NamedTuple{(:θ, :Ω, :σ_prop),Tuple{Array{Float64,1},PDMats.PDiagMat{Float64,Array{Float64,1}},Float64}},Base.Iterators.Pairs{Symbol,Any,Tuple{Symbol,Symbol},NamedTuple{(:maxiters, :alg),Tuple{Int64,Rodas5{0,false,DefaultLinSolve,DataType}}}},PumasModel{ParamSet{NamedTuple{(:θ, :Ω, :σ_prop),Tuple{VectorDomain{Array{Float64,1},Array{TransformVariables.Infinity{true},1},Array{Float64,1}},PDiagDomain{PDMats.PDiagMat{Float64,Array{Float64,1}}},RealDomain{Float64,TransformVariables.Infinity{true},Float64}}}},getfield(Main, Symbol("##437#444")),getfield(Main, Symbol("##438#445")),getfield(Main, Symbol("##439#446")),ODEProblem{Nothing,Tuple{Nothing,Nothing},false,Nothing,ODEFunction{false,getfield(Main, Symbol("##440#447")),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{,Tuple{}}},DiffEqBase.StandardODEProblem},getfield(Main, Symbol("##442#449")),getfield(Main, Symbol("##443#450"))},Pumas.FOCEI,Tuple{}}, ::typeof(Base.add_sum), ::NamedTuple{(:init,),Tuple{Float64}}, ::Base.Iterators.Zip{Tuple{Array{Subject{NamedTuple{(:RO,),Tuple{Array{Union{Missing, Float64},1}}},NamedTuple{(:CLS, :V1S, :kshd),Tuple{Float64,Float64,Float64}},Array{Pumas.Event{Float64,Float64,Float64,Float64,Float64,Float64,Int64},1},Array{Float64,1}},1},Array{Array{Float64,1},1},Array{Array{Float64,1},1}}}, ::Tuple{Int64,Int64,Int64}) at .\none:0
 [9] mapfoldl_impl(::Function, ::Function, ::NamedTuple{,Tuple{}}, ::Base.Iterators.Zip{Tuple{Array{Subject{NamedTuple{(:RO,),Tuple{Array{Union{Missing, Float64},1}}},NamedTuple{(:CLS, :V1S, :kshd),Tuple{Float64,Float64,Float64}},Array{Pumas.Event{Float64,Float64,Float64,Float64,Float64,Float64,Int64},1},Array{Float64,1}},1},Array{Array{Float64,1},1},Array{Array{Float64,1},1}}}) at .\reduce.jl:61
 [10] #mapfoldl#188 at .\reduce.jl:72 [inlined]
 [11] mapfoldl at .\reduce.jl:72 [inlined]
 [12] #mapreduce#192 at .\reduce.jl:208 [inlined]
 [13] mapreduce at .\reduce.jl:208 [inlined]
 [14] sum(::Function, ::Base.Iterators.Zip{Tuple{Array{Subject{NamedTuple{(:RO,),Tuple{Array{Union{Missing, Float64},1}}},NamedTuple{(:CLS, :V1S, :kshd),Tuple{Float64,Float64,Float64}},Array{Pumas.Event{Float64,Float64,Float64,Float64,Float64,Float64,Int64},1},Array{Float64,1}},1},Array{Array{Float64,1},1},Array{Array{Float64,1},1}}}) at .\reduce.jl:403
 [15] (::getfield(Pumas, Symbol("##218#224")){Base.Iterators.Pairs{Symbol,Any,Tuple{Symbol,Symbol},NamedTuple{(:maxiters, :alg),Tuple{Int64,Rodas5{0,false,DefaultLinSolve,DataType}}}},PumasModel{ParamSet{NamedTuple{(:θ, :Ω, :σ_prop),Tuple{VectorDomain{Array{Float64,1},Array{TransformVariables.Infinity{true},1},Array{Float64,1}},PDiagDomain{PDMats.PDiagMat{Float64,Array{Float64,1}}},RealDomain{Float64,TransformVariables.Infinity{true},Float64}}}},getfield(Main, Symbol("##437#444")),getfield(Main, Symbol("##438#445")),getfield(Main, Symbol("##439#446")),ODEProblem{Nothing,Tuple{Nothing,Nothing},false,Nothing,ODEFunction{false,getfield(Main, Symbol("##440#447")),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{,Tuple{}}},DiffEqBase.StandardODEProblem},getfield(Main, Symbol("##442#449")),getfield(Main, Symbol("##443#450"))},Array{Subject{NamedTuple{(:RO,),Tuple{Array{Union{Missing, Float64},1}}},NamedTuple{(:CLS, :V1S, :kshd),Tuple{Float64,Float64,Float64}},Array{Pumas.Event{Float64,Float64,Float64,Float64,Float64,Float64,Int64},1},Array{Float64,1}},1},Pumas.FOCEI,Tuple{}})(::Float64, ::Array{Float64,1}, ::Array{Float64,1}) at C:\Users\awolf-yadlin\.juliapro\JuliaPro_v1.2.0-2\packages\Pumas\Twdge\src\estimation\likelihoods.jl:1074
 [16] (::getfield(NLSolversBase, Symbol("##61#62")){NLSolversBase.InplaceObjective{Nothing,getfield(Pumas, Symbol("##218#224")){Base.Iterators.Pairs{Symbol,Any,Tuple{Symbol,Symbol},NamedTuple{(:maxiters, :alg),Tuple{Int64,Rodas5{0,false,DefaultLinSolve,DataType}}}},PumasModel{ParamSet{NamedTuple{(:θ, :Ω, :σ_prop),Tuple{VectorDomain{Array{Float64,1},Array{TransformVariables.Infinity{true},1},Array{Float64,1}},PDiagDomain{PDMats.PDiagMat{Float64,Array{Float64,1}}},RealDomain{Float64,TransformVariables.Infinity{true},Float64}}}},getfield(Main, Symbol("##437#444")),getfield(Main, Symbol("##438#445")),getfield(Main, Symbol("##439#446")),ODEProblem{Nothing,Tuple{Nothing,Nothing},false,Nothing,ODEFunction{false,getfield(Main, Symbol("##440#447")),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{,Tuple{}}},DiffEqBase.StandardODEProblem},getfield(Main, Symbol("##442#449")),getfield(Main, Symbol("##443#450"))},Array{Subject{NamedTuple{(:RO,),Tuple{Array{Union{Missing, Float64},1}}},NamedTuple{(:CLS, :V1S, :kshd),Tuple{Float64,Float64,Float64}},Array{Pumas.Event{Float64,Float64,Float64,Float64,Float64,Float64,Int64},1},Array{Float64,1}},1},Pumas.FOCEI,Tuple{}},Nothing,Nothing,Nothing},Float64})(::Array{Float64,1}, ::Array{Float64,1}) at C:\Users\awolf-yadlin\.juliapro\JuliaPro_v1.2.0-2\packages\NLSolversBase\mGaJg\src\objective_types\incomplete.jl:45
 [17] value_gradient!!(::NLSolversBase.OnceDifferentiable{Float64,Array{Float64,1},Array{Float64,1}}, ::Array{Float64,1}) at C:\Users\awolf-yadlin\.juliapro\JuliaPro_v1.2.0-2\packages\NLSolversBase\mGaJg\src\interface.jl:82
 [18] initial_state(::Optim.BFGS{LineSearches.InitialStatic{Float64},LineSearches.BackTracking{Float64,Int64},getfield(Pumas, Symbol("##211#212")){NLSolversBase.OnceDifferentiable{Float64,Array{Float64,1},Array{Float64,1}},Array{Float64,1}},Nothing,Optim.Flat}, ::Optim.Options{Float64,getfield(Pumas, Symbol("##217#223"))}, ::NLSolversBase.OnceDifferentiable{Float64,Array{Float64,1},Array{Float64,1}}, ::Array{Float64,1}) at C:\Users\awolf-yadlin\.juliapro\JuliaPro_v1.2.0-2\packages\Optim\cJRng\src\multivariate\solvers\first_order\bfgs.jl:66
 [19] optimize(::NLSolversBase.OnceDifferentiable{Float64,Array{Float64,1},Array{Float64,1}}, ::Array{Float64,1}, ::Optim.BFGS{LineSearches.InitialStatic{Float64},LineSearches.BackTracking{Float64,Int64},getfield(Pumas, Symbol("##211#212")){NLSolversBase.OnceDifferentiable{Float64,Array{Float64,1},Array{Float64,1}},Array{Float64,1}},Nothing,Optim.Flat}, ::Optim.Options{Float64,getfield(Pumas, Symbol("##217#223"))}) at C:\Users\awolf-yadlin\.juliapro\JuliaPro_v1.2.0-2\packages\Optim\cJRng\src\multivariate\optimize\optimize.jl:33
 [20] (::Pumas.DefaultOptimizeFN{Nothing,NamedTuple{(:show_trace, :store_trace, :extended_trace, :g_tol, :allow_f_increases),Tuple{Bool,Bool,Bool,Float64,Bool}}})(::NLSolversBase.OnceDifferentiable{Float64,Array{Float64,1},Array{Float64,1}}, ::Array{Float64,1}, ::Function) at C:\Users\awolf-yadlin\.juliapro\JuliaPro_v1.2.0-2\packages\Pumas\Twdge\src\estimation\likelihoods.jl:983
 [21] #fit#214(::Pumas.DefaultOptimizeFN{Nothing,NamedTuple{(:show_trace, :store_trace, :extended_trace, :g_tol, :allow_f_increases),Tuple{Bool,Bool,Bool,Float64,Bool}}}, ::NamedTuple{,Tuple{}}, ::Base.Iterators.Pairs{Symbol,Any,Tuple{Symbol,Symbol},NamedTuple{(:maxiters, :alg),Tuple{Int64,Rodas5{0,false,DefaultLinSolve,DataType}}}}, ::typeof(fit), ::PumasModel{ParamSet{NamedTuple{(:θ, :Ω, :σ_prop),Tuple{VectorDomain{Array{Float64,1},Array{TransformVariables.Infinity{true},1},Array{Float64,1}},PDiagDomain{PDMats.PDiagMat{Float64,Array{Float64,1}}},RealDomain{Float64,TransformVariables.Infinity{true},Float64}}}},getfield(Main, Symbol("##437#444")),getfield(Main, Symbol("##438#445")),getfield(Main, Symbol("##439#446")),ODEProblem{Nothing,Tuple{Nothing,Nothing},false,Nothing,ODEFunction{false,getfield(Main, Symbol("##440#447")),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{,Tuple{}}},DiffEqBase.StandardODEProblem},getfield(Main, Symbol("##442#449")),getfield(Main, Symbol("##443#450"))}, ::Array{Subject{NamedTuple{(:RO,),Tuple{Array{Union{Missing, Float64},1}}},NamedTuple{(:CLS, :V1S, :kshd),Tuple{Float64,Float64,Float64}},Array{Pumas.Event{Float64,Float64,Float64,Float64,Float64,Float64,Int64},1},Array{Float64,1}},1}, ::NamedTuple{(:θ, :Ω, :σ_prop),Tuple{Array{Float64,1},PDMats.PDiagMat{Float64,Array{Float64,1}},Float64}}, ::Pumas.FOCEI) at C:\Users\awolf-yadlin\.juliapro\JuliaPro_v1.2.0-2\packages\Pumas\Twdge\src\estimation\likelihoods.jl:1097
 [22] (::getfield(StatsBase, Symbol("#kw##fit")))(::NamedTuple{(:maxiters, :alg),Tuple{Int64,Rodas5{0,false,DefaultLinSolve,DataType}}}, ::typeof(fit), ::PumasModel{ParamSet{NamedTuple{(:θ, :Ω, :σ_prop),Tuple{VectorDomain{Array{Float64,1},Array{TransformVariables.Infinity{true},1},Array{Float64,1}},PDiagDomain{PDMats.PDiagMat{Float64,Array{Float64,1}}},RealDomain{Float64,TransformVariables.Infinity{true},Float64}}}},getfield(Main, Symbol("##437#444")),getfield(Main, Symbol("##438#445")),getfield(Main, Symbol("##439#446")),ODEProblem{Nothing,Tuple{Nothing,Nothing},false,Nothing,ODEFunction{false,getfield(Main, Symbol("##440#447")),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{,Tuple{}}},DiffEqBase.StandardODEProblem},getfield(Main, Symbol("##442#449")),getfield(Main, Symbol("##443#450"))}, ::Array{Subject{NamedTuple{(:RO,),Tuple{Array{Union{Missing, Float64},1}}},NamedTuple{(:CLS, :V1S, :kshd),Tuple{Float64,Float64,Float64}},Array{Pumas.Event{Float64,Float64,Float64,Float64,Float64,Float64,Int64},1},Array{Float64,1}},1}, ::NamedTuple{(:θ, :Ω, :σ_prop),Tuple{Array{Float64,1},PDMats.PDiagMat{Float64,Array{Float64,1}},Float64}}, ::Pumas.FOCEI) at .\none:0
 [23] top-level scope at util.jl:156
 [24] top-level scope at In[281]:2

Ale

Can you please provide the model. I had same error before, when I change the domain for random effect it worked.

Hello Ale,

This issue should be fixed in the most recent version of Pumas so please try to upgrade your Pumas version with

] up Pumas

It might also be necessary to ask specifically for the latest version of Optim with

] add Optim@0.20

Finally, I can see that you are using Windows. If you get an Arpack related error after/during the update, you’ll have to either download the latest version of JuliaPro (1.2.0-2) or downgrade the version of Arpack with

] add Arpack@0.3.1
1 Like

Here is the model


Why = @model begin

    @param begin
      θ ∈ VectorDomain(4,lower=zeros(4).+0.01, 
                          init=[40000, 1E12, 10, 4.2])
      Ω ∈ PDiagDomain(init=[0.4, 0.4, 0.4, 0.04])
      σ_prop ∈ RealDomain(init=0.04, lower=0.0001)#, upper=1.0)
    end

    @random begin
      η ~ MvNormal(Ω)
    end

    @pre begin
        NAVG = 6.02214076E23
        CF = NAVG/10^9            #                                                         molecules/nmol                                                   
        kint        = 10#θ[3]     #                                                         1/d                                                                  
        kon_Sm      = 41.472      #                                 1/nMd kon_Sm
        kon_Bm      = 41.472      #                                 1/nMd kon_Bm  
        koff_Sm     = 1.6416      #                                  1/d   koff_Sm
        koff_Bm     = 1.6416      #                                  1/d   koff_Bm 
        kon_Ss      = 21.5136     #                                 1/nMd kon_Ss      
        kon_Bs      = 21.5136     #                                     1/nMd kon_Bs 
        koff_Ss     = 81.4752     #                                   1/d   koff_Ss
        koff_Bs     = 81.4752     #                                     1/d   koff_Bs 
        mB0         = θ[1]*exp(η[1])
        NCell       = θ[2]*exp(η[2])
        KgenBCMA    = θ[3]*exp(η[3])
        kelsBCMA    = θ[4]*exp(η[4])

    end
    
    @covariates begin
        CLS
        V1S
        kshd
    end

    @init begin
        mB  = mB0
        sB  = 100
        BLCKR = BLCKR0
    end

        
    @dynamics begin
        
        A1'  =  -CLS*C1 +
                -(kon_Sm*C1*mB*NCell/CF + kon_Ss*C1*sB*V1S) +
                koff_Sm*C1mB*NCell/CF + koff_Ss*C1sB*V1S #+
#                 (-kon_Bs*C1*BLCKR/CF + koff_Bs*BLCKRC1/CF)*V1S)*CF
            
        
        mB'  =  KgenBCMA*kshd*V1S/NCell - (kshd*V1S/NCell + kint*mB) - kon_Sm*C1*mB + koff_Sm*C1mB
        
        sB'  =  kshd*V1S/(CF) - kelsBCMA*sB - kon_Ss*C1*sB + koff_Ss*C1sB#(CLS/V1S)
            
#         BLCKR' =  KgenBLCKR - (CLB/V1S)*BLCKR +
#                 -kon_Bs*C1*BLCKR +
#                 koff_Bs*BLCKRC1
        

        C1mB' = kon_Sm*C1*mB - koff_Sm*C1mB +
                -(kshd*V1S/NCell + kint*C1mB)
            
        C1sB' = kon_Ss*C1*sB - koff_Ss*C1sB +
                -(CLS/V1S)*C1sB + kshd*V1S/CF
            
            
#         BLCKRC1' = kon_Bs*BLCKR*C1 - koff_Bs*BLCKRC1 +
#                 -(CLB/V1S)*BLCKRC1     
    end
    
    @vars begin
        CLB := CLS
        C1   :=  A1/V1S
#         kshed := kshd*V1S/(NCell)
        TotmB = mB + C1mB 
#         mB = TotmB - C1mB 
        
        
    end
    
    
    @derived begin
#         TotmB            = mB + C1mB #+ BLCKRmB
        totmB = TotmB
        a1               = A1
        Conc_Mean        = C1
        Memb         = mB
        Sol          = sB
        MembComplex     = C1mB
        SolComplex     = C1sB
        TotSol       = SEABCMAsBCMA + SolBCMA 
#         BlockerBound     = BLCKRC1
#         Blocker          = BLCKR
#         Total_Blocker    = BLCKR .+ BLCKRC1
        ro = 100*(C1mB./TotmB)
        RO ~ @. Normal(ro, sqrt(ro^2*σ_prop)+eps())
        
    end
    
#     @observed begin
#         ConcMean
#         MembBCMA
#     end
end

Thanks

Did you try the suggestion Andreas made?

The problem is that the hessian in some EBE estimation contains NaNs. The current optimizer needs to solve a shifted eigenproblem for the Hessian, so a Hessian of NaNs is no good. Unfortunately, the handling of this has been problematic, but it’s a problem we knew about, and we hope it’s been fixed in the recent version of Pumas. (if you’re interested in more details, this is the fix https://github.com/JuliaNLSolvers/Optim.jl/pull/781)

I have been working on implementing a better version of this algorithm that does not depend on the eigensystem solution at all, and should be more robust. I hope this will make it into the next release.

Hi-

Thansk for the info and the link.
Yes I am about to try the solution Andreas suggested. I’ll let you know how ti goes.
Just out of curiosity, have you guys thought of implementing a Montecarlo style optimization to avoid issues with derivatives? I know it’s not so efficient, but it is easier to parallelize as it’s just exploration and could deal with issues like Hessian with NaNs.

Take care,

Ale

We use a trust region algorithm with the actual Hessian because the inner problem is relatively well-behaved (unless the fixed effects are way off), and we assume that the dominating cost is the solution of the model. A derivative free method is likely to solve the ODEs more times, but if you’re willing to pay the cost, it’s totally possible to use another optimizer, and we have several to choose from. The only problem is that we don’t expose a way to chose the inner optimizer, only the outer (for the fixed effects). Let me make sure that this feature is in the next version of Pumas, then you can try to find one that fits your use case. But something like simulated annealing or particle swarm (that we have ready) is going to be relatively expensive if you use it in the inner optimization - especially if you don’t parallelize it. But it’d say: let’s give it a try :slight_smile:

Still same error
I did download juliaPro12.0.2 yesterday - Do I still need to fix Arpack (I think 12.0.2 comes with 0.3.2)

MethodError: no method matching -(::Int64, ::Nothing)
Closest candidates are:
  -(::Union{Int128, Int16, Int32, Int64, Int8, UInt128, UInt16, UInt32, UInt64, UInt8}) at int.jl:51
  -(::T<:Union{Int128, Int16, Int32, Int64, Int8, UInt128, UInt16, UInt32, UInt64, UInt8}, !Matched::T<:Union{Int128, Int16, Int32, Int64, Int8, UInt128, UInt16, UInt32, UInt64, UInt8}) where T<:Union{Int128, Int16, Int32, Int64, Int8, UInt128, UInt16, UInt32, UInt64, UInt8} at int.jl:52
  -(::Integer, !Matched::Integer) at int.jl:871
  ...

Stacktrace:
 [1] 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}},PDiagDomain{PDMats.PDiagMat{Float64,Array{Float64,1}}},RealDomain{Float64,TransformVariables.Infinity{true},Float64}}}},getfield(Main, Symbol("##67#74")),getfield(Main, Symbol("##68#75")),getfield(Main, Symbol("##69#76")),ODEProblem{Nothing,Tuple{Nothing,Nothing},false,Nothing,ODEFunction{false,getfield(Main, Symbol("##70#77")),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{,Tuple{}}},DiffEqBase.StandardODEProblem},getfield(Main, Symbol("##72#79")),getfield(Main, Symbol("##73#80"))},Array{Subject{NamedTuple{(:RO,),Tuple{Array{Union{Missing, Float64},1}}},NamedTuple{(:CLS, :V1S, :kshd),Tuple{Float64,Float64,Float64}},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("##211#212")){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("##211#212")){NLSolversBase.OnceDifferentiable{Float64,Array{Float64,1},Array{Float64,1}},Array{Float64,1}},Nothing,Optim.Flat}},1},Bool},Pumas.FOCEI,Array{Array{Float64,1},1},Tuple{},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{,Tuple{}}},TransformVariables.TransformTuple{NamedTuple{(:θ, :Ω, :σ_prop),Tuple{Pumas.ElementArrayTransform{TransformVariables.ShiftedExp{true,Float64},1},Pumas.PDiagTransform,TransformVariables.ShiftedExp{true,Float64}}}}}) at C:\Users\awolf-yadlin\.juliapro\JuliaPro_v1.2.0-2\packages\Pumas\Twdge\src\estimation\show.jl:36
 [2] limitstringmime(::MIME{Symbol("text/plain")}, ::Pumas.FittedPumasModel{PumasModel{ParamSet{NamedTuple{(:θ, :Ω, :σ_prop),Tuple{VectorDomain{Array{Float64,1},Array{TransformVariables.Infinity{true},1},Array{Float64,1}},PDiagDomain{PDMats.PDiagMat{Float64,Array{Float64,1}}},RealDomain{Float64,TransformVariables.Infinity{true},Float64}}}},getfield(Main, Symbol("##67#74")),getfield(Main, Symbol("##68#75")),getfield(Main, Symbol("##69#76")),ODEProblem{Nothing,Tuple{Nothing,Nothing},false,Nothing,ODEFunction{false,getfield(Main, Symbol("##70#77")),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{,Tuple{}}},DiffEqBase.StandardODEProblem},getfield(Main, Symbol("##72#79")),getfield(Main, Symbol("##73#80"))},Array{Subject{NamedTuple{(:RO,),Tuple{Array{Union{Missing, Float64},1}}},NamedTuple{(:CLS, :V1S, :kshd),Tuple{Float64,Float64,Float64}},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("##211#212")){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("##211#212")){NLSolversBase.OnceDifferentiable{Float64,Array{Float64,1},Array{Float64,1}},Array{Float64,1}},Nothing,Optim.Flat}},1},Bool},Pumas.FOCEI,Array{Array{Float64,1},1},Tuple{},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{,Tuple{}}},TransformVariables.TransformTuple{NamedTuple{(:θ, :Ω, :σ_prop),Tuple{Pumas.ElementArrayTransform{TransformVariables.ShiftedExp{true,Float64},1},Pumas.PDiagTransform,TransformVariables.ShiftedExp{true,Float64}}}}}) at C:\Users\awolf-yadlin\.juliapro\JuliaPro_v1.2.0-2\packages\IJulia\F1GUo\src\inline.jl:43
 [3] 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}},PDiagDomain{PDMats.PDiagMat{Float64,Array{Float64,1}}},RealDomain{Float64,TransformVariables.Infinity{true},Float64}}}},getfield(Main, Symbol("##67#74")),getfield(Main, Symbol("##68#75")),getfield(Main, Symbol("##69#76")),ODEProblem{Nothing,Tuple{Nothing,Nothing},false,Nothing,ODEFunction{false,getfield(Main, Symbol("##70#77")),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{,Tuple{}}},DiffEqBase.StandardODEProblem},getfield(Main, Symbol("##72#79")),getfield(Main, Symbol("##73#80"))},Array{Subject{NamedTuple{(:RO,),Tuple{Array{Union{Missing, Float64},1}}},NamedTuple{(:CLS, :V1S, :kshd),Tuple{Float64,Float64,Float64}},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("##211#212")){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("##211#212")){NLSolversBase.OnceDifferentiable{Float64,Array{Float64,1},Array{Float64,1}},Array{Float64,1}},Nothing,Optim.Flat}},1},Bool},Pumas.FOCEI,Array{Array{Float64,1},1},Tuple{},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{,Tuple{}}},TransformVariables.TransformTuple{NamedTuple{(:θ, :Ω, :σ_prop),Tuple{Pumas.ElementArrayTransform{TransformVariables.ShiftedExp{true,Float64},1},Pumas.PDiagTransform,TransformVariables.ShiftedExp{true,Float64}}}}}) at C:\Users\awolf-yadlin\.juliapro\JuliaPro_v1.2.0-2\packages\IJulia\F1GUo\src\display.jl:67
 [4] display_dict(::Pumas.FittedPumasModel{PumasModel{ParamSet{NamedTuple{(:θ, :Ω, :σ_prop),Tuple{VectorDomain{Array{Float64,1},Array{TransformVariables.Infinity{true},1},Array{Float64,1}},PDiagDomain{PDMats.PDiagMat{Float64,Array{Float64,1}}},RealDomain{Float64,TransformVariables.Infinity{true},Float64}}}},getfield(Main, Symbol("##67#74")),getfield(Main, Symbol("##68#75")),getfield(Main, Symbol("##69#76")),ODEProblem{Nothing,Tuple{Nothing,Nothing},false,Nothing,ODEFunction{false,getfield(Main, Symbol("##70#77")),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{,Tuple{}}},DiffEqBase.StandardODEProblem},getfield(Main, Symbol("##72#79")),getfield(Main, Symbol("##73#80"))},Array{Subject{NamedTuple{(:RO,),Tuple{Array{Union{Missing, Float64},1}}},NamedTuple{(:CLS, :V1S, :kshd),Tuple{Float64,Float64,Float64}},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("##211#212")){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("##211#212")){NLSolversBase.OnceDifferentiable{Float64,Array{Float64,1},Array{Float64,1}},Array{Float64,1}},Nothing,Optim.Flat}},1},Bool},Pumas.FOCEI,Array{Array{Float64,1},1},Tuple{},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{,Tuple{}}},TransformVariables.TransformTuple{NamedTuple{(:θ, :Ω, :σ_prop),Tuple{Pumas.ElementArrayTransform{TransformVariables.ShiftedExp{true,Float64},1},Pumas.PDiagTransform,TransformVariables.ShiftedExp{true,Float64}}}}}) at C:\Users\awolf-yadlin\.juliapro\JuliaPro_v1.2.0-2\packages\IJulia\F1GUo\src\display.jl:96
 [5] #invokelatest#1 at .\essentials.jl:790 [inlined]
 [6] invokelatest at .\essentials.jl:789 [inlined]
 [7] execute_request(::ZMQ.Socket, ::IJulia.Msg) at C:\Users\awolf-yadlin\.juliapro\JuliaPro_v1.2.0-2\packages\IJulia\F1GUo\src\execute_request.jl:112
 [8] #invokelatest#1 at .\essentials.jl:790 [inlined]
 [9] invokelatest at .\essentials.jl:789 [inlined]
 [10] eventloop(::ZMQ.Socket) at C:\Users\awolf-yadlin\.juliapro\JuliaPro_v1.2.0-2\packages\IJulia\F1GUo\src\eventloop.jl:8
 [11] (::getfield(IJulia, Symbol("##15#18")))() at .\task.jl:268

Please show the output of ] st

Status

C:\Users\awolf-yadlin\.juliapro\JuliaPro_v1.2.0-2\environments\v1.2\Project.toml
  [c52e3926] Atom v0.11.3
  [336ed68f] CSV v0.5.22
  [a93c6f00] DataFrames v0.20.0
  [7073ff75] IJulia v1.20.2
  [e5e0dc1b] Juno v0.7.2
  [429524aa] Optim v0.20.1
  [91a5bcdd] Plots v0.28.4
  [4f2c3c20] Pumas v0.9.0
  [b7b41870] PumasTutorials v0.0.1
  [60ddc479] StatPlots v0.9.2
  [f3b207a7] StatsPlots v0.13.0
  [1986cc42] Unitful v1.0.0
  [44d3d7a6] Weave v0.9.1
  [fdbf4ff8] XLSX v0.5.8
  [ade2ca70] Dates
  [37e2e46d] LinearAlgebra

Thanks,

Ale

No. This one is different.

Did you paste the complete stacktrace? If not please do, if you did then please try running your code in JuliaPro instead of IJulia since the latter might be messing up the stacktrace.

I’ll recheck the stack trace.
By running in juliaPro you mean from atom and not from jupyter notebook?
I downgraded Arpack to 0.3.1 and I am still getting errors. I am trying one more run and I’ll paste stacktrace.

Take care-

Ale

Hi Andreas -
Here is the full stack Trace from atom. I included some warnings cuase they say minimization succesful, but error continues. - Let me know if this helps. Or shoudl I run in some other way.

Thanks,

Ale

┌ Warning: Automatic dt set the starting dt as NaN, causing instability.
└ @ OrdinaryDiffEq C:\Users\awolf-yadlin\.juliapro\JuliaPro_v1.2.0-2\packages\OrdinaryDiffEq\nV9bA\src\solve.jl:430
┌ Warning: NaN dt detected. Likely a NaN value in the state, parameters, or derivative value caused this outcome.
└ @ DiffEqBase C:\Users\awolf-yadlin\.juliapro\JuliaPro_v1.2.0-2\packages\DiffEqBase\MuYi1\src\integrator_interface.jl:313
1313.594648 seconds (788.51 M allocations: 271.899 GiB, 12.03% gc time)
FittedPumasModel

Successful minimization:                true

Likelihood approximation:        Pumas.FOCEI
┌ Warning: First function call produced NaNs. Exiting.
└ @ OrdinaryDiffEq C:\Users\awolf-yadlin\.juliapro\JuliaPro_v1.2.0-2\packages\OrdinaryDiffEq\nV9bA\src\initdt.jl:135
┌ Warning: First function call produced NaNs. Exiting.
└ @ OrdinaryDiffEq C:\Users\awolf-yadlin\.juliapro\JuliaPro_v1.2.0-2\packages\OrdinaryDiffEq\nV9bA\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-2\packages\OrdinaryDiffEq\nV9bA\src\solve.jl:430
┌ Warning: Automatic dt set the starting dt as NaN, causing instability.
└ @ OrdinaryDiffEq C:\Users\awolf-yadlin\.juliapro\JuliaPro_v1.2.0-2\packages\OrdinaryDiffEq\nV9bA\src\solve.jl:430
┌ Warning: NaN dt detected. Likely a NaN value in the state, parameters, or derivative value caused this outcome.
└ @ DiffEqBase C:\Users\awolf-yadlin\.juliapro\JuliaPro_v1.2.0-2\packages\DiffEqBase\MuYi1\src\integrator_interface.jl:313
┌ Warning: NaN dt detected. Likely a NaN value in the state, parameters, or derivative value caused this outcome.
└ @ DiffEqBase C:\Users\awolf-yadlin\.juliapro\JuliaPro_v1.2.0-2\packages\DiffEqBase\MuYi1\src\integrator_interface.jl:313
┌ Warning: First function call produced NaNs. Exiting.
└ @ OrdinaryDiffEq C:\Users\awolf-yadlin\.juliapro\JuliaPro_v1.2.0-2\packages\OrdinaryDiffEq\nV9bA\src\initdt.jl:135
┌ Warning: First function call produced NaNs. Exiting.
└ @ OrdinaryDiffEq C:\Users\awolf-yadlin\.juliapro\JuliaPro_v1.2.0-2\packages\OrdinaryDiffEq\nV9bA\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-2\packages\OrdinaryDiffEq\nV9bA\src\solve.jl:430
┌ Warning: Automatic dt set the starting dt as NaN, causing instability.
└ @ OrdinaryDiffEq C:\Users\awolf-yadlin\.juliapro\JuliaPro_v1.2.0-2\packages\OrdinaryDiffEq\nV9bA\src\solve.jl:430
┌ Warning: NaN dt detected. Likely a NaN value in the state, parameters, or derivative value caused this outcome.
└ @ DiffEqBase C:\Users\awolf-yadlin\.juliapro\JuliaPro_v1.2.0-2\packages\DiffEqBase\MuYi1\src\integrator_interface.jl:313
┌ Warning: NaN dt detected. Likely a NaN value in the state, parameters, or derivative value caused this outcome.
└ @ DiffEqBase C:\Users\awolf-yadlin\.juliapro\JuliaPro_v1.2.0-2\packages\DiffEqBase\MuYi1\src\integrator_interface.jl:313
┌ Warning: First function call produced NaNs. Exiting.
└ @ OrdinaryDiffEq C:\Users\awolf-yadlin\.juliapro\JuliaPro_v1.2.0-2\packages\OrdinaryDiffEq\nV9bA\src\initdt.jl:135
┌ Warning: First function call produced NaNs. Exiting.
└ @ OrdinaryDiffEq C:\Users\awolf-yadlin\.juliapro\JuliaPro_v1.2.0-2\packages\OrdinaryDiffEq\nV9bA\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-2\packages\OrdinaryDiffEq\nV9bA\src\solve.jl:430
┌ Warning: Automatic dt set the starting dt as NaN, causing instability.
└ @ OrdinaryDiffEq C:\Users\awolf-yadlin\.juliapro\JuliaPro_v1.2.0-2\packages\OrdinaryDiffEq\nV9bA\src\solve.jl:430
┌ Warning: NaN dt detected. Likely a NaN value in the state, parameters, or derivative value caused this outcome.
└ @ DiffEqBase C:\Users\awolf-yadlin\.juliapro\JuliaPro_v1.2.0-2\packages\DiffEqBase\MuYi1\src\integrator_interface.jl:313
┌ Warning: NaN dt detected. Likely a NaN value in the state, parameters, or derivative value caused this outcome.
└ @ DiffEqBase C:\Users\awolf-yadlin\.juliapro\JuliaPro_v1.2.0-2\packages\DiffEqBase\MuYi1\src\integrator_interface.jl:313
Deviance:                                Inf┌ Warning: First function call produced NaNs. Exiting.
└ @ OrdinaryDiffEq C:\Users\awolf-yadlin\.juliapro\JuliaPro_v1.2.0-2\packages\OrdinaryDiffEq\nV9bA\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-2\packages\OrdinaryDiffEq\nV9bA\src\solve.jl:430
Total number of observation records:     156┌ Warning: NaN dt detected. Likely a NaN value in the state, parameters, or derivative value caused this outcome.
└ @ DiffEqBase C:\Users\awolf-yadlin\.juliapro\JuliaPro_v1.2.0-2\packages\DiffEqBase\MuYi1\src\integrator_interface.jl:313

┌ Warning: First function call produced NaNs. Exiting.
└ @ OrdinaryDiffEq C:\Users\awolf-yadlin\.juliapro\JuliaPro_v1.2.0-2\packages\OrdinaryDiffEq\nV9bA\src\initdt.jl:135
Number of active observation records:    156┌ Warning: Automatic dt set the starting dt as NaN, causing instability.
└ @ OrdinaryDiffEq C:\Users\awolf-yadlin\.juliapro\JuliaPro_v1.2.0-2\packages\OrdinaryDiffEq\nV9bA\src\solve.jl:430

┌ Warning: NaN dt detected. Likely a NaN value in the state, parameters, or derivative value caused this outcome.
└ @ DiffEqBase C:\Users\awolf-yadlin\.juliapro\JuliaPro_v1.2.0-2\packages\DiffEqBase\MuYi1\src\integrator_interface.jl:313
Number of subjects:                       16┌ Warning: First function call produced NaNs. Exiting.
└ @ OrdinaryDiffEq C:\Users\awolf-yadlin\.juliapro\JuliaPro_v1.2.0-2\packages\OrdinaryDiffEq\nV9bA\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-2\packages\OrdinaryDiffEq\nV9bA\src\solve.jl:430

┌ Warning: NaN dt detected. Likely a NaN value in the state, parameters, or derivative value caused this outcome.
└ @ DiffEqBase C:\Users\awolf-yadlin\.juliapro\JuliaPro_v1.2.0-2\packages\DiffEqBase\MuYi1\src\integrator_interface.jl:313
Error showing value of type Pumas.FittedPumasModel{PumasModel{ParamSet{NamedTuple{(:θ, :Ω, :σ_prop),Tuple{VectorDomain{Array{Float64,1},Array{TransformVariables.Infinity{true},1},Array{Float64,1}},PDiagDomain{PDMats.PDiagMat{Float64,Array{Float64,1}}},RealDomain{Float64,TransformVariables.Infinity{true},Float64}}}},getfield(Main, Symbol("##59#66")),getfield(Main, Symbol("##60#67")),getfield(Main, Symbol("##61#68")),ODEProblem{Nothing,Tuple{Nothing,Nothing},false,Nothing,ODEFunction{false,getfield(Main, Symbol("##62#69")),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{,Tuple{}}},DiffEqBase.StandardODEProblem},getfield(Main, Symbol("##64#71")),getfield(Main, Symbol("##65#72"))},Array{Subject{NamedTuple{(:RO,),Tuple{Array{Union{Missing, Float64},1}}},NamedTuple{(:CLS, :V1S, :kshd),Tuple{Float64,Float64,Float64}},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("##211#212")){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("##211#212")){NLSolversBase.OnceDifferentiable{Float64,Array{Float64,1},Array{Float64,1}},Array{Float64,1}},Nothing,Optim.Flat}},1},Bool},Pumas.FOCEI,Array{Array{Float64,1},1},Tuple{},Base.Iterators.Pairs{Symbol,Int64,Tuple{Symbol},NamedTuple{(:maxiters,),Tuple{Int64}}},TransformVariables.TransformTuple{NamedTuple{(:θ, :Ω, :σ_prop),Tuple{Pumas.ElementArrayTransform{TransformVariables.ShiftedExp{true,Float64},1},Pumas.PDiagTransform,TransformVariables.ShiftedExp{true,Float64}}}}}:
ERROR: MethodError: no method matching -(::Int64, ::Nothing)
Closest candidates are:
 -(::Union{Int128, Int16, Int32, Int64, Int8, UInt128, UInt16, UInt32, UInt64, UInt8}) at int.jl:51
 -(::T<:Union{Int128, Int16, Int32, Int64, Int8, UInt128, UInt16, UInt32, UInt64, UInt8}, ::T<:Union{Int128, Int16, Int32, Int64, Int8, UInt128, UInt16, UInt32, UInt64, UInt8}) where T<:Union{Int128, Int16, Int32, Int64, Int8, UInt128, UInt16, UInt32, UInt64, UInt8} at int.jl:52
 -(::Integer, ::Integer) at int.jl:871
 ...
Stacktrace:
[1] show(::IOContext{REPL.Terminals.TTYTerminal}, ::MIME{Symbol("text/plain")}, ::Pumas.FittedPumasModel{PumasModel{ParamSet{NamedTuple{(:θ, :Ω, :σ_prop),Tuple{VectorDomain{Array{Float64,1},Array{TransformVariables.Infinity{true},1},Array{Float64,1}},PDiagDomain{PDMats.PDiagMat{Float64,Array{Float64,1}}},RealDomain{Float64,TransformVariables.Infinity{true},Float64}}}},getfield(Main, Symbol("##59#66")),getfield(Main, Symbol("##60#67")),getfield(Main, Symbol("##61#68")),ODEProblem{Nothing,Tuple{Nothing,Nothing},false,Nothing,ODEFunction{false,getfield(Main, Symbol("##62#69")),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{,Tuple{}}},DiffEqBase.StandardODEProblem},getfield(Main, Symbol("##64#71")),getfield(Main, Symbol("##65#72"))},Array{Subject{NamedTuple{(:RO,),Tuple{Array{Union{Missing, Float64},1}}},NamedTuple{(:CLS, :V1S, :kshd),Tuple{Float64,Float64,Float64}},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("##211#212")){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("##211#212")){NLSolversBase.OnceDifferentiable{Float64,Array{Float64,1},Array{Float64,1}},Array{Float64,1}},Nothing,Optim.Flat}},1},Bool},Pumas.FOCEI,Array{Array{Float64,1},1},Tuple{},Base.Iterators.Pairs{Symbol,Int64,Tuple{Symbol},NamedTuple{(:maxiters,),Tuple{Int64}}},TransformVariables.TransformTuple{NamedTuple{(:θ, :Ω, :σ_prop),Tuple{Pumas.ElementArrayTransform{TransformVariables.ShiftedExp{true,Float64},1},Pumas.PDiagTransform,TransformVariables.ShiftedExp{true,Float64}}}}}) at C:\Users\awolf-yadlin\.juliapro\JuliaPro_v1.2.0-2\packages\Pumas\Twdge\src\estimation\show.jl:36
[2] display(::REPL.REPLDisplay, ::MIME{Symbol("text/plain")}, ::Any) at C:\Users\julia\AppData\Local\Julia-1.2.0\share\julia\stdlib\v1.2\REPL\src\REPL.jl:132
[3] display(::REPL.REPLDisplay, ::Any) at C:\Users\julia\AppData\Local\Julia-1.2.0\share\julia\stdlib\v1.2\REPL\src\REPL.jl:136
[4] display(::Any) at .\multimedia.jl:323
[5] #invokelatest#1 at .\essentials.jl:790 [inlined]
[6] invokelatest at .\essentials.jl:789 [inlined]
[7] print_response(::IO, ::Any, ::Bool, ::Bool, ::Any) at C:\Users\julia\AppData\Local\Julia-1.2.0\share\julia\stdlib\v1.2\REPL\src\REPL.jl:156
[8] print_response(::REPL.AbstractREPL, ::Any, ::Bool, ::Bool) at C:\Users\julia\AppData\Local\Julia-1.2.0\share\julia\stdlib\v1.2\REPL\src\REPL.jl:141
[9] (::getfield(REPL, Symbol("#do_respond#38")){Bool,getfield(Atom, Symbol("##176#177")),REPL.LineEditREPL,REPL.LineEdit.Prompt})(::Any, ::Any, ::Any) at C:\Users\julia\AppData\Local\Julia-1.2.0\share\julia\stdlib\v1.2\REPL\src\REPL.jl:718
[10] #invokelatest#1 at .\essentials.jl:790 [inlined]
[11] invokelatest at .\essentials.jl:789 [inlined]
[12] run_interface(::REPL.Terminals.TextTerminal, ::REPL.LineEdit.ModalInterface, ::REPL.LineEdit.MIState) at C:\Users\julia\AppData\Local\Julia-1.2.0\share\julia\stdlib\v1.2\REPL\src\LineEdit.jl:2306
[13] run_frontend(::REPL.LineEditREPL, ::REPL.REPLBackendRef) at C:\Users\julia\AppData\Local\Julia-1.2.0\share\julia\stdlib\v1.2\REPL\src\REPL.jl:1038
[14] run_repl(::REPL.AbstractREPL, ::Any) at C:\Users\julia\AppData\Local\Julia-1.2.0\share\julia\stdlib\v1.2\REPL\src\REPL.jl:201
[15] (::getfield(Base, Symbol("##737#739")){Bool,Bool,Bool,Bool})(::Module) at .\client.jl:390
[16] #invokelatest#1 at .\essentials.jl:790 [inlined]
[17] invokelatest at .\essentials.jl:789 [inlined]
[18] run_main_repl(::Bool, ::Bool, ::Bool, ::Bool, ::Bool) at .\client.jl:374
[19] exec_options(::Base.JLOptions) at .\client.jl:312
[20] _start() at .\client.jl:464

Thanks. It looks like IJulia is really messing up the output so the lines are mixed up. However, I think I can see what is going on. The model fit “completes” but displaying the solution fails. You can try adding a semicolon after the fit to suppress the output. I think it will get rid of the error message.

It’s not a fix, though, since the error is probably shown because there is something wrong with the “solution”. Could you please try to evaluate deviance in the starting values? Is the value finite?

How would I evaluate deviance in the starting values?

I’m happy to try.

Also- I checked the result of the option doing coef(res) and its all NaN.

I’ll try with the semi colon though.

Ale

deviance(model, data, initialcoef, Pumas.FOCEI())
1 Like

It returns Nan

param=(θ = [40000.0, 1.0e12, 10.0, 4.2], Ω = PDMats.PDiagMat{Float64,Array{Float64,1}}(4, [0.4, 0.4, 0.04, 0.04], [2.5, 2.5, 25.0, 25.0]), σ_prop = 0.04)

dev=deviance(Model,dfP,param, Pumas.FOCEI())

┌ Warning: First function call produced NaNs. Exiting.
└ @ OrdinaryDiffEq C:\Users\awolf-yadlin.juliapro\JuliaPro_v1.2.0-2\packages\OrdinaryDiffEq\nV9bA\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-2\packages\OrdinaryDiffEq\nV9bA\src\solve.jl:430
┌ Warning: NaN dt detected. Likely a NaN value in the state, parameters, or derivative value caused this outcome.
└ @ DiffEqBase C:\Users\awolf-yadlin.juliapro\JuliaPro_v1.2.0-2\packages\DiffEqBase\MuYi1\src\integrator_interface.jl:313
┌ Warning: First function call produced NaNs. Exiting.
└ @ OrdinaryDiffEq C:\Users\awolf-yadlin.juliapro\JuliaPro_v1.2.0-2\packages\OrdinaryDiffEq\nV9bA\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-2\packages\OrdinaryDiffEq\nV9bA\src\solve.jl:430
┌ Warning: NaN dt detected. Likely a NaN value in the state, parameters, or derivative value caused this outcome.
└ @ DiffEqBase C:\Users\awolf-yadlin.juliapro\JuliaPro_v1.2.0-2\packages\DiffEqBase\MuYi1\src\integrator_interface.jl:313
┌ Warning: First function call produced NaNs. Exiting.
└ @ OrdinaryDiffEq C:\Users\awolf-yadlin.juliapro\JuliaPro_v1.2.0-2\packages\OrdinaryDiffEq\nV9bA\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-2\packages\OrdinaryDiffEq\nV9bA\src\solve.jl:430
┌ Warning: NaN dt detected. Likely a NaN value in the state, parameters, or derivative value caused this outcome.
└ @ DiffEqBase C:\Users\awolf-yadlin.juliapro\JuliaPro_v1.2.0-2\packages\DiffEqBase\MuYi1\src\integrator_interface.jl:313

If I remove a subject (12 our of 16) I get a dev value of 1005. Id I keep subject 12. dev is NaN.
I can not see anydifferentce between this subject or others when I look at the data. Happy to share. model and data.

At least we now know why you got the other errors. If the stating value of the objective is NaN then the optimization will never be able to succeed. However, we should indeed improve the error message.

If you can share the exact model and data with me, I can take a look and try to narrow down why we end up producing NaNs. Please send it to noack@juliacomputing.com.

Sending model now.
Thanks,

A