Optimization error message during fit

Hello Experts in Pumas,

I met the error below when during estimation, when I used the standard deviation directly to define the error model, like:
abs(Conc)*σ_prop

Error message:

BoundsError: attempt to access 0-element Array{Float64,1} at index [1]
getindex at array.jl:728 [inlined]
#solve_tr_subproblem!#36(::Float64, ::Int64, ::typeof(Optim.solve_tr_subproblem!), ::Array{Float64,1}, ::Array{Float64,2}, ::Float64, ::Array{Float64,1}) at newton_trust_region.jl:105
solve_tr_subproblem! at newton_trust_region.jl:94 [inlined]
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 newton_trust_region.jl:314
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 optimize.jl:57
optimize at optimize.jl:33 [inlined]
#_orth_empirical_bayes!#145(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{,Tuple{}}}, ::typeof(Pumas._orth_empirical_bayes!), ::Array{Float64,1}, ::PumasModel{ParamSet{NamedTuple{(:tvcl, :tvQ, :tvv, :tvvt, :Ω, :σ_prop),Tuple{RealDomain{Int64,TransformVariables.Infinity{true},Float64},RealDomain{Int64,TransformVariables.Infinity{true},Float64},RealDomain{Int64,TransformVariables.Infinity{true},Float64},RealDomain{Int64,TransformVariables.Infinity{true},Float64},PDiagDomain{PDMats.PDiagMat{Float64,Array{Float64,1}}},RealDomain{Int64,TransformVariables.Infinity{true},Float64}}}},getfield(Main, Symbol("##19#24")),getfield(Main, Symbol("##20#25")),getfield(Main, Symbol("##21#26")),Central1Periph1,getfield(Main, Symbol("##22#27")),getfield(Main, Symbol("##23#28"))}, ::Subject{NamedTuple{(:DV,),Tuple{Array{Union{Missing, Float64},1}}},NamedTuple{(:WT, :CRCLM_final, :ALB),Tuple{Float64,Float64,Float64}},Array{Pumas.Event{Float64,Float64,Float64,Float64,Float64,Float64,Int64},1},Array{Float64,1}}, ::NamedTuple{(:tvcl, :tvQ, :tvv, :tvvt, :Ω, :σ_prop),Tuple{Float64,Float64,Float64,Float64,PDMats.PDiagMat{Float64,Array{Float64,1}},Float64}}, ::Pumas.FOCEI) at likelihoods.jl:248
_orth_empirical_bayes! at likelihoods.jl:221 [inlined]
#219 at likelihoods.jl:1079 [inlined]
mapreduce_first(::getfield(Pumas, Symbol("##219#225")){NamedTuple{(:tvcl, :tvQ, :tvv, :tvvt, :Ω, :σ_prop),Tuple{Float64,Float64,Float64,Float64,PDMats.PDiagMat{Float64,Array{Float64,1}},Float64}},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{,Tuple{}}},PumasModel{ParamSet{NamedTuple{(:tvcl, :tvQ, :tvv, :tvvt, :Ω, :σ_prop),Tuple{RealDomain{Int64,TransformVariables.Infinity{true},Float64},RealDomain{Int64,TransformVariables.Infinity{true},Float64},RealDomain{Int64,TransformVariables.Infinity{true},Float64},RealDomain{Int64,TransformVariables.Infinity{true},Float64},PDiagDomain{PDMats.PDiagMat{Float64,Array{Float64,1}}},RealDomain{Int64,TransformVariables.Infinity{true},Float64}}}},getfield(Main, Symbol("##19#24")),getfield(Main, Symbol("##20#25")),getfield(Main, Symbol("##21#26")),Central1Periph1,getfield(Main, Symbol("##22#27")),getfield(Main, Symbol("##23#28"))},Pumas.FOCEI,Tuple{}}, ::Function, ::Tuple{Subject{NamedTuple{(:DV,),Tuple{Array{Union{Missing, Float64},1}}},NamedTuple{(:WT, :CRCLM_final, :ALB),Tuple{Float64,Float64,Float64}},Array{Pumas.Event{Float64,Float64,Float64,Float64,Float64,Float64,Int64},1},Array{Float64,1}},Array{Float64,1},Array{Float64,1}}) at reduce.jl:301
mapfoldl_impl(::Function, ::Function, ::NamedTuple{,Tuple{}}, ::Base.Iterators.Zip{Tuple{Array{Subject{NamedTuple{(:DV,),Tuple{Array{Union{Missing, Float64},1}}},NamedTuple{(:WT, :CRCLM_final, :ALB),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:60
#mapfoldl#188 at reduce.jl:72 [inlined]
mapfoldl at reduce.jl:72 [inlined]
#mapreduce#192 at reduce.jl:208 [inlined]
mapreduce at reduce.jl:208 [inlined]
sum(::Function, ::Base.Iterators.Zip{Tuple{Array{Subject{NamedTuple{(:DV,),Tuple{Array{Union{Missing, Float64},1}}},NamedTuple{(:WT, :CRCLM_final, :ALB),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
(::getfield(Pumas, Symbol("##218#224")){Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{,Tuple{}}},PumasModel{ParamSet{NamedTuple{(:tvcl, :tvQ, :tvv, :tvvt, :Ω, :σ_prop),Tuple{RealDomain{Int64,TransformVariables.Infinity{true},Float64},RealDomain{Int64,TransformVariables.Infinity{true},Float64},RealDomain{Int64,TransformVariables.Infinity{true},Float64},RealDomain{Int64,TransformVariables.Infinity{true},Float64},PDiagDomain{PDMats.PDiagMat{Float64,Array{Float64,1}}},RealDomain{Int64,TransformVariables.Infinity{true},Float64}}}},getfield(Main, Symbol("##19#24")),getfield(Main, Symbol("##20#25")),getfield(Main, Symbol("##21#26")),Central1Pe...

However, fortunately, the model can run through without errors if I use the variance to define the error model, like
sqrt(Conc^2)*sqrt(σ²_prop)

So, dear experts, I have two questions:

  1. Can anyone help me understand what the error means and how can I fix it?
  2. Is there any preferences in choosing either σ² or σ to define RUV for estimation?

Due to confidentiality, I couldn’t share the data or code here.
But any help is appreciated. Thank you!

This was an issue in prior versions of Pumas and Optim. Please try to update Pumas with

] up Pumas

You might also need to explicitly install the latest version of Optim with

] add Optim@0.20

I think it’s nicer to use the standard deviation in the proportional error model since you avoid the square root.

This was an issue in prior versions of Pumas and Optim. Please try to update Pumas with

@andreasnoack Thank you for your reply.

I updated the packages as you suggested, however, the error still occurs. Do you happen to know what can be the problem? Thank you.

My packages version is shown below:

[c52e3926] Atom v0.11.3
  [336ed68f] CSV v0.5.22
  [a93c6f00] DataFrames v0.20.0
  [1313f7d8] DataFramesMeta v0.5.0
  [7073ff75] IJulia v1.20.2
  [e5e0dc1b] Juno v0.7.2
  [429524aa] Optim v0.20.1
  [4f2c3c20] Pumas v0.9.0

Error message:

BoundsError: attempt to access 0-element Array{Float64,1} at index [1]
getindex at array.jl:728 [inlined]
#solve_tr_subproblem!#36(::Float64, ::Int64, ::typeof(Optim.solve_tr_subproblem!), ::Array{Float64,1}, ::Array{Float64,2}, ::Float64, ::Array{Float64,1}) at newton_trust_region.jl:105
solve_tr_subproblem! at newton_trust_region.jl:94 [inlined]
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 newton_trust_region.jl:314
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 optimize.jl:57
optimize at optimize.jl:33 [inlined]
#_orth_empirical_bayes!#145(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{,Tuple{}}}, ::typeof(Pumas._orth_empirical_bayes!), ::Array{Float64,1}, ::PumasModel{ParamSet{NamedTuple{(:tvcl, :tvQ, :tvv, :tvvt, :Ω, :σ_prop),Tuple{RealDomain{Int64,TransformVariables.Infinity{true},Float64},RealDomain{Int64,TransformVariables.Infinity{true},Float64},RealDomain{Int64,TransformVariables.Infinity{true},Float64},RealDomain{Int64,TransformVariables.Infinity{true},Float64},PDiagDomain{PDMats.PDiagMat{Float64,Array{Float64,1}}},RealDomain{Int64,TransformVariables.Infinity{true},Float64}}}},getfield(Main, Symbol("##69#74")),getfield(Main, Symbol("##70#75")),getfield(Main, Symbol("##71#76")),Central1Periph1,getfield(Main, Symbol("##72#77")),getfield(Main, Symbol("##73#78"))}, ::Subject{NamedTuple{(:DV,),Tuple{Array{Union{Missing, Float64},1}}},NamedTuple{(:WT, :CRCLM_final, :ALB),Tuple{Float64,Float64,Float64}},Array{Pumas.Event{Float64,Float64,Float64,Float64,Float64,Float64,Int64},1},Array{Float64,1}}, ::NamedTuple{(:tvcl, :tvQ, :tvv, :tvvt, :Ω, :σ_prop),Tuple{Float64,Float64,Float64,Float64,PDMats.PDiagMat{Float64,Array{Float64,1}},Float64}}, ::Pumas.FOCEI) at likelihoods.jl:248
_orth_empirical_bayes! at likelihoods.jl:221 [inlined]
#219 at likelihoods.jl:1079 [inlined]
mapreduce_first(::getfield(Pumas, Symbol("##219#225")){NamedTuple{(:tvcl, :tvQ, :tvv, :tvvt, :Ω, :σ_prop),Tuple{Float64,Float64,Float64,Float64,PDMats.PDiagMat{Float64,Array{Float64,1}},Float64}},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{,Tuple{}}},PumasModel{ParamSet{NamedTuple{(:tvcl, :tvQ, :tvv, :tvvt, :Ω, :σ_prop),Tuple{RealDomain{Int64,TransformVariables.Infinity{true},Float64},RealDomain{Int64,TransformVariables.Infinity{true},Float64},RealDomain{Int64,TransformVariables.Infinity{true},Float64},RealDomain{Int64,TransformVariables.Infinity{true},Float64},PDiagDomain{PDMats.PDiagMat{Float64,Array{Float64,1}}},RealDomain{Int64,TransformVariables.Infinity{true},Float64}}}},getfield(Main, Symbol("##69#74")),getfield(Main, Symbol("##70#75")),getfield(Main, Symbol("##71#76")),Central1Periph1,getfield(Main, Symbol("##72#77")),getfield(Main, Symbol("##73#78"))},Pumas.FOCEI,Tuple{}}, ::Function, ::Tuple{Subject{NamedTuple{(:DV,),Tuple{Array{Union{Missing, Float64},1}}},NamedTuple{(:WT, :CRCLM_final, :ALB),Tuple{Float64,Float64,Float64}},Array{Pumas.Event{Float64,Float64,Float64,Float64,Float64,Float64,Int64},1},Array{Float64,1}},Array{Float64,1},Array{Float64,1}}) at reduce.jl:301
mapfoldl_impl(::Function, ::Function, ::NamedTuple{,Tuple{}}, ::Base.Iterators.Zip{Tuple{Array{Subject{NamedTuple{(:DV,),Tuple{Array{Union{Missing, Float64},1}}},NamedTuple{(:WT, :CRCLM_final, :ALB),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:60
#mapfoldl#188 at reduce.jl:72 [inlined]
mapfoldl at reduce.jl:72 [inlined]
#mapreduce#192 at reduce.jl:208 [inlined]
mapreduce at reduce.jl:208 [inlined]
sum(::Function, ::Base.Iterators.Zip{Tuple{Array{Subject{NamedTuple{(:DV,),Tuple{Array{Union{Missing, Float64},1}}},NamedTuple{(:WT, :CRCLM_final, :ALB),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
(::getfield(Pumas, Symbol("##218#224")){Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{,Tuple{}}},PumasModel{ParamSet{NamedTuple{(:tvcl, :tvQ, :tvv, :tvvt, :Ω, :σ_prop),Tuple{RealDomain{Int64,TransformVariables.Infinity{true},Float64},RealDomain{Int64,TransformVariables.Infinity{true},Float64},RealDomain{Int64,TransformVariables.Infinity{true},Float64},RealDomain{Int64,TransformVariables.Infinity{true},Float64},PDiagDomain{PDMats.PDiagMat{Float64,Array{Float64,1}}},RealDomain{Int64,TransformVariables.Infinity{true},Float64}}}},getfield(Main, Symbol("##69#74")),getfield(Main, Symbol("##70#75")),getfield(Main, Symbol("##71#76")),Central1Pe...

(I’ve split the previous thread since your error wasn’t related to the previous discussion. Please ask new questions new in new threads instead of old threads.)

Did you restart Julia after updating the packages?

@andreasnoack It worked perfectly now. Thank you very much for your help!

Could I ask about another error message? I ran into it (below) when I tried to calculate RSE and CI, using infer() with stdev for proportional RUV model. Thanks a lot!

Error message

DomainError with -5.841153569346205e-6:
sqrt will only return a complex result if called with a complex argument. Try sqrt(Complex(x)).
throw_complex_domainerror(::Symbol, ::Float64) at math.jl:31
sqrt at math.jl:493 [inlined]
_broadcast_getindex_evalf at broadcast.jl:625 [inlined]
_broadcast_getindex at broadcast.jl:598 [inlined]
_getindex at broadcast.jl:621 [inlined]
_broadcast_getindex at broadcast.jl:597 [inlined]
getindex at broadcast.jl:558 [inlined]
macro expansion at broadcast.jl:888 [inlined]
macro expansion at simdloop.jl:77 [inlined]
copyto! at broadcast.jl:887 [inlined]
copyto! at broadcast.jl:842 [inlined]
copy at broadcast.jl:818 [inlined]
materialize at broadcast.jl:798 [inlined]
unwhiten(::PDMats.PDiagMat{Float64,Array{Float64,1}}, ::SubArray{ForwardDiff.Dual{ForwardDiff.Tag{getfield(Pumas, Symbol("##190#191")){Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{,Tuple{}}},PumasModel{ParamSet{NamedTuple{(:tvcl, :tvQ, :tvv, :tvvt, :Ω, :σ_prop),Tuple{RealDomain{Int64,TransformVariables.Infinity{true},Float64},RealDomain{Int64,TransformVariables.Infinity{true},Float64},RealDomain{Int64,TransformVariables.Infinity{true},Float64},RealDomain{Int64,TransformVariables.Infinity{true},Float64},PDiagDomain{PDMats.PDiagMat{Float64,Array{Float64,1}}},RealDomain{Float64,TransformVariables.Infinity{true},Float64}}}},getfield(Main, Symbol("##159#164")),getfield(Main, Symbol("##160#165")),getfield(Main, Symbol("##161#166")),Central1Periph1,getfield(Main, Symbol("##162#167")),getfield(Main, Symbol("##163#168"))},Subject{NamedTuple{(:DV,),Tuple{Array{Union{Missing, Float64},1}}},NamedTuple{(:WT, :CRCLM_final, :ALB),Tuple{Float64,Float64,Float64}},Array{Pumas.Event{Float64,Float64,Float64,Float64,Float64,Float64,Int64},1},Array{Float64,1}},NamedTuple{(:tvcl, :tvQ, :tvv, :tvvt, :Ω, :σ_prop),Tuple{Float64,Float64,Float64,Float64,PDMats.PDiagMat{Float64,Array{Float64,1}},Float64}},Tuple{}},Float64},Float64,4},1,Array{ForwardDiff.Dual{ForwardDiff.Tag{getfield(Pumas, Symbol("##190#191")){Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{,Tuple{}}},PumasModel{ParamSet{NamedTuple{(:tvcl, :tvQ, :tvv, :tvvt, :Ω, :σ_prop),Tuple{RealDomain{Int64,TransformVariables.Infinity{true},Float64},RealDomain{Int64,TransformVariables.Infinity{true},Float64},RealDomain{Int64,TransformVariables.Infinity{true},Float64},RealDomain{Int64,TransformVariables.Infinity{true},Float64},PDiagDomain{PDMats.PDiagMat{Float64,Array{Float64,1}}},RealDomain{Float64,TransformVariables.Infinity{true},Float64}}}},getfield(Main, Symbol("##159#164")),getfield(Main, Symbol("##160#165")),getfield(Main, Symbol("##161#166")),Central1Periph1,getfield(Main, Symbol("##162#167")),getfield(Main, Symbol("##163#168"))},Subject{NamedTuple{(:DV,),Tuple{Array{Union{Missing, Float64},1}}},NamedTuple{(:WT, :CRCLM_final, :ALB),Tuple{Float64,Float64,Float64}},Array{Pumas.Event{Float64,Float64,Float64,Float64,Float64,Float64,Int64},1},Array{Float64,1}},NamedTuple{(:tvcl, :tvQ, :tvv, :tvvt, :Ω, :σ_prop),Tuple{Float64,Float64,Float64,Float64,PDMats.PDiagMat{Float64,Array{Float64,1}},Float64}},Tuple{}},Float64},Float64,4},1},Tuple{UnitRange{Int64}},true}) at likelihoods.jl:2
transform_with at transforms.jl:295 [inlined]
_transform_tuple at aggregation.jl:161 [inlined]
transform_tuple at aggregation.jl:171 [inlined]
transform_with at aggregation.jl:223 [inlined]
transform(::TransformVariables.TransformTuple{NamedTuple{(:η,),Tuple{Pumas.MvNormalTransform{MvNormal{Float64,PDMats.PDiagMat{Float64,Array{Float64,1}},FillArrays.Zeros{Float64,1,Tuple{Base.OneTo{Int64}}}}}}}}, ::Array{ForwardDiff.Dual{ForwardDiff.Tag{getfield(Pumas, Symbol("##190#191")){Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{,Tuple{}}},PumasModel{ParamSet{NamedTuple{(:tvcl, :tvQ, :tvv, :tvvt, :Ω, :σ_prop),Tuple{RealDomain{Int64,TransformVariables.Infinity{true},Float64},RealDomain{Int64,TransformVariables.Infinity{true},Float64},RealDomain{Int64,TransformVariables.Infinity{true},Float64},RealDomain{Int64,TransformVariables.Infinity{true},Float64},PDiagDomain{PDMats.PDiagMat{Float64,Array{Float64,1}}},RealDomain{Float64,TransformVariables.Infinity{true},Float64}}}},getfield(Main, Symbol("##159#164")),getfield(Main, Symbol("##160#165")),getfield(Main, Symbol("##161#166")),Central1Periph1,getfield(Main, Symbol("##162#167")),getfield(Main, Symbol("##163#168"))},Subject{NamedTuple{(:DV,),Tuple{Array{Union{Missing, Float64},1}}},NamedTuple{(:WT, :CRCLM_final, :ALB),Tuple{Float64,Float64,Float64}},Array{Pumas.Event{Float64,Float64,Float64,Float64,Float64,Float64,Int64},1},Array{Float64,1}},NamedTuple{(:tvcl, :tvQ, :tvv, :tvvt, :Ω, :σ_prop),Tuple{Float64,Float64,Float64,Float64,PDMats.PDiagMat{Float64,Array{Float64,1}},Float64}},Tuple{}},Float64},Float64,4},1}) at generic.jl:196
(::getfield(Pumas, Symbol("##190#191")){Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{,Tuple{}}},PumasModel{ParamSet{NamedTuple{(:tvcl, :tvQ, :tvv, :tvvt, :Ω, :σ_prop),Tuple{RealDomain{Int64,Transfo...

Good to hear that you are now able to fit the model.

I think you are hitting the same case as Domain Error Message. Are the any of the parameter estimates that are tiny?

It looks like the is something missing from the bottom of the error message. Would you be able to share the complete error?

Could you please also try just to call vcov on the fitted model and report if you see any errors or warning?

I also ran into the same Domain Error Message. Andreas pointed me to check for the estimates; and they were near zero.
How i over came this error message
Some how in my model, Dose was zero (population -> Subject-> events -> Dose event -> dose amount = 0). I had sorted my data by Subject and Time in Pumas, yet my dose amount was zero.
So i ordered my data outside of the Pumas by Subject and Time, and ran the code, now i am able to get the estimates (that i intend) with no error message.

@andreasnoack Morning Andreas! Thanks for your reply.

The PK parameter estimates are not tiny. But I do have a very small omega value for Q, 1.561 x 10^-7. I will try to fix Q to see whether it would help.

Below is the error for infer(). Not sure whether it is complete or not. I copied the one next to my code. Thank you so much!

DomainError with -5.899351978714437e-6:
sqrt will only return a complex result if called with a complex argument. Try sqrt(Complex(x)).
throw_complex_domainerror(::Symbol, ::Float64) at math.jl:31
sqrt at math.jl:493 [inlined]
_broadcast_getindex_evalf at broadcast.jl:625 [inlined]
_broadcast_getindex at broadcast.jl:598 [inlined]
_getindex at broadcast.jl:621 [inlined]
_broadcast_getindex at broadcast.jl:597 [inlined]
getindex at broadcast.jl:558 [inlined]
macro expansion at broadcast.jl:888 [inlined]
macro expansion at simdloop.jl:77 [inlined]
copyto! at broadcast.jl:887 [inlined]
copyto! at broadcast.jl:842 [inlined]
copy at broadcast.jl:818 [inlined]
materialize at broadcast.jl:798 [inlined]
unwhiten(::PDMats.PDiagMat{Float64,Array{Float64,1}}, ::SubArray{ForwardDiff.Dual{ForwardDiff.Tag{getfield(Pumas, Symbol("##190#191")){Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{,Tuple{}}},PumasModel{ParamSet{NamedTuple{(:tvcl, :tvQ, :tvv, :tvvt, :Ω, :σ²_add, :σ²_prop),Tuple{RealDomain{Int64,TransformVariables.Infinity{true},Float64},RealDomain{Int64,TransformVariables.Infinity{true},Float64},RealDomain{Int64,TransformVariables.Infinity{true},Float64},RealDomain{Int64,TransformVariables.Infinity{true},Float64},PDiagDomain{PDMats.PDiagMat{Float64,Array{Float64,1}}},RealDomain{Float64,TransformVariables.Infinity{true},Float64},RealDomain{Float64,TransformVariables.Infinity{true},Float64}}}},getfield(Main, Symbol("##9#14")),getfield(Main, Symbol("##10#15")),getfield(Main, Symbol("##11#16")),Central1Periph1,getfield(Main, Symbol("##12#17")),getfield(Main, Symbol("##13#18"))},Subject{NamedTuple{(:DV,),Tuple{Array{Union{Missing, Float64},1}}},NamedTuple{(:WT, :CRCLM_final, :ALB),Tuple{Float64,Float64,Float64}},Array{Pumas.Event{Float64,Float64,Float64,Float64,Float64,Float64,Int64},1},Array{Float64,1}},NamedTuple{(:tvcl, :tvQ, :tvv, :tvvt, :Ω, :σ²_add, :σ²_prop),Tuple{Float64,Float64,Float64,Float64,PDMats.PDiagMat{Float64,Array{Float64,1}},Float64,Float64}},Tuple{}},Float64},Float64,4},1,Array{ForwardDiff.Dual{ForwardDiff.Tag{getfield(Pumas, Symbol("##190#191")){Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{,Tuple{}}},PumasModel{ParamSet{NamedTuple{(:tvcl, :tvQ, :tvv, :tvvt, :Ω, :σ²_add, :σ²_prop),Tuple{RealDomain{Int64,TransformVariables.Infinity{true},Float64},RealDomain{Int64,TransformVariables.Infinity{true},Float64},RealDomain{Int64,TransformVariables.Infinity{true},Float64},RealDomain{Int64,TransformVariables.Infinity{true},Float64},PDiagDomain{PDMats.PDiagMat{Float64,Array{Float64,1}}},RealDomain{Float64,TransformVariables.Infinity{true},Float64},RealDomain{Float64,TransformVariables.Infinity{true},Float64}}}},getfield(Main, Symbol("##9#14")),getfield(Main, Symbol("##10#15")),getfield(Main, Symbol("##11#16")),Central1Periph1,getfield(Main, Symbol("##12#17")),getfield(Main, Symbol("##13#18"))},Subject{NamedTuple{(:DV,),Tuple{Array{Union{Missing, Float64},1}}},NamedTuple{(:WT, :CRCLM_final, :ALB),Tuple{Float64,Float64,Float64}},Array{Pumas.Event{Float64,Float64,Float64,Float64,Float64,Float64,Int64},1},Array{Float64,1}},NamedTuple{(:tvcl, :tvQ, :tvv, :tvvt, :Ω, :σ²_add, :σ²_prop),Tuple{Float64,Float64,Float64,Float64,PDMats.PDiagMat{Float64,Array{Float64,1}},Float64,Float64}},Tuple{}},Float64},Float64,4},1},Tuple{UnitRange{Int64}},true}) at likelihoods.jl:2
transform_with at transforms.jl:295 [inlined]
_transform_tuple at aggregation.jl:161 [inlined]
transform_tuple at aggregation.jl:171 [inlined]
transform_with at aggregation.jl:223 [inlined]
transform(::TransformVariables.TransformTuple{NamedTuple{(:η,),Tuple{Pumas.MvNormalTransform{MvNormal{Float64,PDMats.PDiagMat{Float64,Array{Float64,1}},FillArrays.Zeros{Float64,1,Tuple{Base.OneTo{Int64}}}}}}}}, ::Array{ForwardDiff.Dual{ForwardDiff.Tag{getfield(Pumas, Symbol("##190#191")){Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{,Tuple{}}},PumasModel{ParamSet{NamedTuple{(:tvcl, :tvQ, :tvv, :tvvt, :Ω, :σ²_add, :σ²_prop),Tuple{RealDomain{Int64,TransformVariables.Infinity{true},Float64},RealDomain{Int64,TransformVariables.Infinity{true},Float64},RealDomain{Int64,TransformVariables.Infinity{true},Float64},RealDomain{Int64,TransformVariables.Infinity{true},Float64},PDiagDomain{PDMats.PDiagMat{Float64,Array{Float64,1}}},RealDomain{Float64,TransformVariables.Infinity{true},Float64},RealDomain{Float64,TransformVariables.Infinity{true},Float64}}}},getfield(Main, Symbol("##9#14")),getfield(Main, Symbol("##10#15")),getfield(Main, Symbol("##11#16")),Central1Periph1,getfield(Main, Symbol("##12#17")),getfield(Main, Symbol("##13#18"))},Subject{NamedTuple{(:DV,),Tuple{Array{Union{Missing, Float64},1}}},NamedTuple{(:WT, :CRCLM_final, :ALB),Tuple{Float64,Float64,Float64}},Array{Pumas.Event{Float64,Float64,Float64,Float64,Float64,Float64,Int64},1},Array{Float64,1}},NamedTuple{(:tvcl, :tvQ, :tvv, :tvvt, :Ω, :σ²_add, :σ²_prop),Tuple{Float64,Float64,Float64,Float64,PDMats.PDiagMat{Float64,Array{Float64,1}},Float64,Float64}},Tuple{...

Below is the error message from vcov().

DomainError with -5.899351978714437e-6:
sqrt will only return a complex result if called with a complex argument. Try sqrt(Complex(x)).
throw_complex_domainerror(::Symbol, ::Float64) at math.jl:31
sqrt at math.jl:493 [inlined]
_broadcast_getindex_evalf at broadcast.jl:625 [inlined]
_broadcast_getindex at broadcast.jl:598 [inlined]
_getindex at broadcast.jl:621 [inlined]
_broadcast_getindex at broadcast.jl:597 [inlined]
getindex at broadcast.jl:558 [inlined]
macro expansion at broadcast.jl:888 [inlined]
macro expansion at simdloop.jl:77 [inlined]
copyto! at broadcast.jl:887 [inlined]
copyto! at broadcast.jl:842 [inlined]
copy at broadcast.jl:818 [inlined]
materialize at broadcast.jl:798 [inlined]
unwhiten(::PDMats.PDiagMat{Float64,Array{Float64,1}}, ::SubArray{ForwardDiff.Dual{ForwardDiff.Tag{getfield(Pumas, Symbol("##190#191")){Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{,Tuple{}}},PumasModel{ParamSet{NamedTuple{(:tvcl, :tvQ, :tvv, :tvvt, :Ω, :σ²_add, :σ²_prop),Tuple{RealDomain{Int64,TransformVariables.Infinity{true},Float64},RealDomain{Int64,TransformVariables.Infinity{true},Float64},RealDomain{Int64,TransformVariables.Infinity{true},Float64},RealDomain{Int64,TransformVariables.Infinity{true},Float64},PDiagDomain{PDMats.PDiagMat{Float64,Array{Float64,1}}},RealDomain{Float64,TransformVariables.Infinity{true},Float64},RealDomain{Float64,TransformVariables.Infinity{true},Float64}}}},getfield(Main, Symbol("##9#14")),getfield(Main, Symbol("##10#15")),getfield(Main, Symbol("##11#16")),Central1Periph1,getfield(Main, Symbol("##12#17")),getfield(Main, Symbol("##13#18"))},Subject{NamedTuple{(:DV,),Tuple{Array{Union{Missing, Float64},1}}},NamedTuple{(:WT, :CRCLM_final, :ALB),Tuple{Float64,Float64,Float64}},Array{Pumas.Event{Float64,Float64,Float64,Float64,Float64,Float64,Int64},1},Array{Float64,1}},NamedTuple{(:tvcl, :tvQ, :tvv, :tvvt, :Ω, :σ²_add, :σ²_prop),Tuple{Float64,Float64,Float64,Float64,PDMats.PDiagMat{Float64,Array{Float64,1}},Float64,Float64}},Tuple{}},Float64},Float64,4},1,Array{ForwardDiff.Dual{ForwardDiff.Tag{getfield(Pumas, Symbol("##190#191")){Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{,Tuple{}}},PumasModel{ParamSet{NamedTuple{(:tvcl, :tvQ, :tvv, :tvvt, :Ω, :σ²_add, :σ²_prop),Tuple{RealDomain{Int64,TransformVariables.Infinity{true},Float64},RealDomain{Int64,TransformVariables.Infinity{true},Float64},RealDomain{Int64,TransformVariables.Infinity{true},Float64},RealDomain{Int64,TransformVariables.Infinity{true},Float64},PDiagDomain{PDMats.PDiagMat{Float64,Array{Float64,1}}},RealDomain{Float64,TransformVariables.Infinity{true},Float64},RealDomain{Float64,TransformVariables.Infinity{true},Float64}}}},getfield(Main, Symbol("##9#14")),getfield(Main, Symbol("##10#15")),getfield(Main, Symbol("##11#16")),Central1Periph1,getfield(Main, Symbol("##12#17")),getfield(Main, Symbol("##13#18"))},Subject{NamedTuple{(:DV,),Tuple{Array{Union{Missing, Float64},1}}},NamedTuple{(:WT, :CRCLM_final, :ALB),Tuple{Float64,Float64,Float64}},Array{Pumas.Event{Float64,Float64,Float64,Float64,Float64,Float64,Int64},1},Array{Float64,1}},NamedTuple{(:tvcl, :tvQ, :tvv, :tvvt, :Ω, :σ²_add, :σ²_prop),Tuple{Float64,Float64,Float64,Float64,PDMats.PDiagMat{Float64,Array{Float64,1}},Float64,Float64}},Tuple{}},Float64},Float64,4},1},Tuple{UnitRange{Int64}},true}) at likelihoods.jl:2
transform_with at transforms.jl:295 [inlined]
_transform_tuple at aggregation.jl:161 [inlined]
transform_tuple at aggregation.jl:171 [inlined]
transform_with at aggregation.jl:223 [inlined]
transform(::TransformVariables.TransformTuple{NamedTuple{(:η,),Tuple{Pumas.MvNormalTransform{MvNormal{Float64,PDMats.PDiagMat{Float64,Array{Float64,1}},FillArrays.Zeros{Float64,1,Tuple{Base.OneTo{Int64}}}}}}}}, ::Array{ForwardDiff.Dual{ForwardDiff.Tag{getfield(Pumas, Symbol("##190#191")){Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{,Tuple{}}},PumasModel{ParamSet{NamedTuple{(:tvcl, :tvQ, :tvv, :tvvt, :Ω, :σ²_add, :σ²_prop),Tuple{RealDomain{Int64,TransformVariables.Infinity{true},Float64},RealDomain{Int64,TransformVariables.Infinity{true},Float64},RealDomain{Int64,TransformVariables.Infinity{true},Float64},RealDomain{Int64,TransformVariables.Infinity{true},Float64},PDiagDomain{PDMats.PDiagMat{Float64,Array{Float64,1}}},RealDomain{Float64,TransformVariables.Infinity{true},Float64},RealDomain{Float64,TransformVariables.Infinity{true},Float64}}}},getfield(Main, Symbol("##9#14")),getfield(Main, Symbol("##10#15")),getfield(Main, Symbol("##11#16")),Central1Periph1,getfield(Main, Symbol("##12#17")),getfield(Main, Symbol("##13#18"))},Subject{NamedTuple{(:DV,),Tuple{Array{Union{Missing, Float64},1}}},NamedTuple{(:WT, :CRCLM_final, :ALB),Tuple{Float64,Float64,Float64}},Array{Pumas.Event{Float64,Float64,Float64,Float64,Float64,Float64,Int64},1},Array{Float64,1}},NamedTuple{(:tvcl, :tvQ, :tvv, :tvvt, :Ω, :σ²_add, :σ²_prop),Tuple{Float64,Float64,Float64,Float64,PDMats.PDiagMat{Float64,Array{Float64,1}},Float64,Float64}},Tuple{...

@Anitha Hi. Thank you so much for your help. I do find the omega value for intercompartment clearance Q is rather small, 1.561 x 10^-7. I will try to fix Q to see whether it would help. Thanks.

@Anitha, @andreasnoack I fixed Q, meaning no BSV estimated for Q, now the infer() works perfectly. Thank you very much for your wonderful help. Really appreciate it!