Logit Normal distribution for PK parameters

Hello,

I am trying to impose LogitNormal distribution for the bio availability parameter to constrain it between 0 and 1. The following is a sample code that I am trying:


mod = @model begin
        @param   begin
            tvbioav   ∈ RealDomain()
            tvKTV     ∈ RealDomain(lower = 0.00001)
            ecmo      ∈ RealDomain()
            circuit   ∈ RealDomain() 
            cl        ∈ RealDomain(lower = 0.0001)
            v         ∈ RealDomain(lower = 0.0001)
            Ω₁        ∈ RealDomain()
            Ω₂        ∈ RealDomain()
            σ_prop    ∈ RealDomain(lower = 0.0001)
            σ_add ∈ RealDomain(lower = 0.0001)
        end
        @random begin
            η₁ ~ Normal(0,sqrt(Ω₁))
            η₂ ~ Normal(0,sqrt(Ω₂))
        end
        @covariates WT AGE_D ISMALE SCR GFR AGEYRS TYPE_MODELING IS_BLEEDING IS_CIRCUIT_CHANGE ECMO_DAYS Occassions IS_CIRCUIT_CHANGE_UPDATE IS_BLEEDING_UPDATE AGE_GROUP
        @dosecontrol begin
                LGTF = tvbioav + η₂[1]
                bioav = (Central =  exp(LGTF)/(1+exp(LGTF)),)
        end
        @pre begin
            KTV    = tvKTV*exp(η₁[1])*(ECMO_DAYS/6)^ecmo
            CL     = 3.28 *(1-exp(-KTV*t))*(WT/50)^cl*circuit^IS_CIRCUIT_CHANGE
            Vc     = 8.83 *(WT/50)^v
      
        end
        @dynamics  begin 
            Central' = -(CL/Vc)*Central
        end
        @derived begin
            CP = @. Central / Vc
            CONC = @. Normal(CP, sqrt(CP^2*σ_prop+ σ_add))
        end
end
    

However I am getting the following error

julia> modfit = fit(mod, estimation, param, Pumas.FOCEI())
Iter     Function value   Gradient norm 
     0     1.696307e+04     6.595755e+03
 * time: 2.5033950805664062e-5
┌ Warning: dt <= dtmin. Aborting. There is either an error in your model specification or the true solution is unstable.
└ @ SciMLBase /builds/PumasAI/PumasSystemImages-jl/.julia/packages/SciMLBase/mndcy/src/integrator_interface.jl:345
┌ Warning: dt <= dtmin. Aborting. There is either an error in your model specification or the true solution is unstable.
└ @ SciMLBase /builds/PumasAI/PumasSystemImages-jl/.julia/packages/SciMLBase/mndcy/src/integrator_interface.jl:345
     1     1.574465e+04     1.179243e+05
 * time: 11.349922180175781
┌ Warning: dt <= dtmin. Aborting. There is either an error in your model specification or the true solution is unstable.
└ @ SciMLBase /builds/PumasAI/PumasSystemImages-jl/.julia/packages/SciMLBase/mndcy/src/integrator_interface.jl:345
┌ Warning: dt <= dtmin. Aborting. There is either an error in your model specification or the true solution is unstable.
└ @ SciMLBase /builds/PumasAI/PumasSystemImages-jl/.julia/packages/SciMLBase/mndcy/src/integrator_interface.jl:345
┌ Warning: dt <= dtmin. Aborting. There is either an error in your model specification or the true solution is unstable.
└ @ SciMLBase /builds/PumasAI/PumasSystemImages-jl/.julia/packages/SciMLBase/mndcy/src/integrator_interface.jl:345
┌ Warning: dt <= dtmin. Aborting. There is either an error in your model specification or the true solution is unstable.
└ @ SciMLBase /builds/PumasAI/PumasSystemImages-jl/.julia/packages/SciMLBase/mndcy/src/integrator_interface.jl:345
┌ Warning: First function call produced NaNs. Exiting.
└ @ OrdinaryDiffEq /builds/PumasAI/PumasSystemImages-jl/.julia/packages/OrdinaryDiffEq/OBX2P/src/initdt.jl:203
┌ Warning: Automatic dt set the starting dt as NaN, causing instability.
└ @ OrdinaryDiffEq /builds/PumasAI/PumasSystemImages-jl/.julia/packages/OrdinaryDiffEq/OBX2P/src/solve.jl:510
┌ Warning: NaN dt detected. Likely a NaN value in the state, parameters, or derivative value caused this outcome.
└ @ SciMLBase /builds/PumasAI/PumasSystemImages-jl/.julia/packages/SciMLBase/mndcy/src/integrator_interface.jl:325
┌ Warning: First function call produced NaNs. Exiting.
└ @ OrdinaryDiffEq /builds/PumasAI/PumasSystemImages-jl/.julia/packages/OrdinaryDiffEq/OBX2P/src/initdt.jl:203
┌ Warning: Automatic dt set the starting dt as NaN, causing instability.
└ @ OrdinaryDiffEq /builds/PumasAI/PumasSystemImages-jl/.julia/packages/OrdinaryDiffEq/OBX2P/src/solve.jl:510
┌ Warning: NaN dt detected. Likely a NaN value in the state, parameters, or derivative value caused this outcome.
└ @ SciMLBase /builds/PumasAI/PumasSystemImages-jl/.julia/packages/SciMLBase/mndcy/src/integrator_interface.jl:325
┌ Warning: dt <= dtmin. Aborting. There is either an error in your model specification or the true solution is unstable.
└ @ SciMLBase /builds/PumasAI/PumasSystemImages-jl/.julia/packages/SciMLBase/mndcy/src/integrator_interface.jl:345
┌ Warning: dt <= dtmin. Aborting. There is either an error in your model specification or the true solution is unstable.
└ @ SciMLBase /builds/PumasAI/PumasSystemImages-jl/.julia/packages/SciMLBase/mndcy/src/integrator_interface.jl:345
ERROR: TaskFailedException
Stacktrace:
  [1] wait
    @ ./task.jl:334 [inlined]
  [2] threading_run(func::Function)
    @ Base.Threads ./threadingconstructs.jl:38
  [3] macro expansion
    @ ./threadingconstructs.jl:97 [inlined]
  [4] _update_ebes_and_evaluate_marginal_nll_threads!(m::PumasModel{(tvbioav = 1, tvKTV = 1, ecmo = 1, circuit = 1, cl = 1, v = 1, Ω₁ = 1, Ω₂ = 1, σ_prop = 1, σ_add = 1), 2, (:Central,), ParamSet{NamedTuple{(:tvbioav, :tvKTV, :ecmo, :circuit, :cl, :v, :Ω₁, :Ω₂, :σ_prop, :σ_add), Tuple{RealDomain{TransformVariables.Infinity{false}, TransformVariables.Infinity{true}, Float64}, RealDomain{Float64, TransformVariables.Infinity{true}, Float64}, RealDomain{TransformVariables.Infinity{false}, TransformVariables.Infinity{true}, Float64}, RealDomain{TransformVariables.Infinity{false}, TransformVariables.Infinity{true}, Float64}, RealDomain{Float64, TransformVariables.Infinity{true}, Float64}, RealDomain{Float64, TransformVariables.Infinity{true}, Float64}, RealDomain{TransformVariables.Infinity{false}, TransformVariables.Infinity{true}, Float64}, RealDomain{TransformVariables.Infinity{false}, TransformVariables.Infinity{true}, Float64}, RealDomain{Float64, TransformVariables.Infinity{true}, Float64}, RealDomain{Float64, TransformVariables.Infinity{true}, Float64}}}}, var"#225#237", Pumas.TimeDispatcher{var"#226#238", var"#228#240"}, Pumas.TimeDispatcher{var"#230#242", var"#231#243"}, var"#232#244", ODEProblem{Nothing, Tuple{Nothing, Nothing}, false, Nothing, ODEFunction{false, ModelingToolkit.ODEFunctionClosure{var"#233#245", var"#234#246"}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, var"#235#247", var"#236#248", ModelingToolkit.ODESystem}, population::Vector{Subject{NamedTuple{(:CONC,), Tuple{Vector{Union{Missing, Float64}}}}, Pumas.ConstantInterpolationStructArray{Vector{Float64}, NamedTuple{(:logwt, :AGE_GROUP, :logecmo, :WT, :AGE_D, :ISMALE, :SCR, :GFR, :AGEYRS, :TYPE_MODELING, :IS_BLEEDING, :IS_CIRCUIT_CHANGE, :ECMO_DAYS, :Occassions, :IS_CIRCUIT_CHANGE_UPDATE, :IS_BLEEDING_UPDATE), Tuple{Vector{Float64}, Vector{String31}, Vector{Float64}, Vector{Float64}, Vector{Int64}, Vector{Int64}, Vector{Float64}, Vector{Int64}, Vector{Float64}, Vector{Int64}, Vector{Int64}, Vector{Int64}, Vector{Int64}, Vector{Int64}, Vector{Int64}, Vector{Int64}}}, Symbol}, Vector{Pumas.Event{Float64, Float64, Float64, Float64, Float64, Float64, Int64}}, Vector{Float64}}}, param::NamedTuple{(:tvbioav, :tvKTV, :ecmo, :circuit, :cl, :v, :Ω₁, :Ω₂, :σ_prop, :σ_add), NTuple{10, 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/MxXdQ/src/estimation/likelihoods.jl:3077
  [5] #581
    @ /builds/PumasAI/PumasSystemImages-jl/.julia/packages/Pumas/MxXdQ/src/estimation/likelihoods.jl:3699 [inlined]
  [6] (::NLSolversBase.var"#55#56"{NLSolversBase.InplaceObjective{Nothing, Pumas.var"#581#583"{PumasModel{(tvbioav = 1, tvKTV = 1, ecmo = 1, circuit = 1, cl = 1, v = 1, Ω₁ = 1, Ω₂ = 1, σ_prop = 1, σ_add = 1), 2, (:Central,), ParamSet{NamedTuple{(:tvbioav, :tvKTV, :ecmo, :circuit, :cl, :v, :Ω₁, :Ω₂, :σ_prop, :σ_add), Tuple{RealDomain{TransformVariables.Infinity{false}, TransformVariables.Infinity{true}, Float64}, RealDomain{Float64, TransformVariables.Infinity{true}, Float64}, RealDomain{TransformVariables.Infinity{false}, TransformVariables.Infinity{true}, Float64}, RealDomain{TransformVariables.Infinity{false}, TransformVariables.Infinity{true}, Float64}, RealDomain{Float64, TransformVariables.Infinity{true}, Float64}, RealDomain{Float64, TransformVariables.Infinity{true}, Float64}, RealDomain{TransformVariables.Infinity{false}, TransformVariables.Infinity{true}, Float64}, RealDomain{TransformVariables.Infinity{false}, TransformVariables.Infinity{true}, Float64}, RealDomain{Float64, TransformVariables.Infinity{true}, Float64}, RealDomain{Float64, TransformVariables.Infinity{true}, Float64}}}}, var"#225#237", Pumas.TimeDispatcher{var"#226#238", var"#228#240"}, Pumas.TimeDispatcher{var"#230#242", var"#231#243"}, var"#232#244", ODEProblem{Nothing, Tuple{Nothing, Nothing}, false, Nothing, ODEFunction{false, ModelingToolkit.ODEFunctionClosure{var"#233#245", var"#234#246"}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, var"#235#247", var"#236#248", ModelingToolkit.ODESystem}, Vector{Subject{NamedTuple{(:CONC,), Tuple{Vector{Union{Missing, Float64}}}}, Pumas.ConstantInterpolationStructArray{Vector{Float64}, NamedTuple{(:logwt, :AGE_GROUP, :logecmo, :WT, :AGE_D, :ISMALE, :SCR, :GFR, :AGEYRS, :TYPE_MODELING, :IS_BLEEDING, :IS_CIRCUIT_CHANGE, :ECMO_DAYS, :Occassions, :IS_CIRCUIT_CHANGE_UPDATE, :IS_BLEEDING_UPDATE), Tuple{Vector{Float64}, Vector{String31}, Vector{Float64}, Vector{Float64}, Vector{Int64}, Vector{Int64}, Vector{Float64}, Vector{Int64}, Vector{Float64}, Vector{Int64}, Vector{Int64}, Vector{Int64}, Vector{Int64}, Vector{Int64}, Vector{Int64}, Vector{Int64}}}, Symbol}, Vector{Pumas.Event{Float64, Float64, Float64, Float64, Float64, Float64, Int64}}, Vector{Float64}}}, Pumas.FOCE, EnsembleThreads, NamedTuple{(), Tuple{}}, TransformVariables.TransformTuple{NamedTuple{(:tvbioav, :tvKTV, :ecmo, :circuit, :cl, :v, :Ω₁, :Ω₂, :σ_prop, :σ_add), Tuple{TransformVariables.Identity, TransformVariables.ShiftedExp{true, Float64}, TransformVariables.Identity, TransformVariables.Identity, TransformVariables.ShiftedExp{true, Float64}, TransformVariables.ShiftedExp{true, Float64}, TransformVariables.Identity, TransformVariables.Identity, TransformVariables.ShiftedExp{true, Float64}, TransformVariables.ShiftedExp{true, Float64}}}}, Vector{Vector{Float64}}, Vector{Vector{Float64}}, Vector{Float64}}, Nothing, Nothing, Nothing}, Float64})(x::Vector{Float64})
    @ NLSolversBase /builds/PumasAI/PumasSystemImages-jl/.julia/packages/NLSolversBase/cfJrN/src/objective_types/incomplete.jl:44
  [7] value!!(obj::NLSolversBase.OnceDifferentiable{Float64, Vector{Float64}, Vector{Float64}}, x::Vector{Float64})
    @ NLSolversBase /builds/PumasAI/PumasSystemImages-jl/.julia/packages/NLSolversBase/cfJrN/src/interface.jl:9
  [8] value!(obj::NLSolversBase.OnceDifferentiable{Float64, Vector{Float64}, Vector{Float64}}, x::Vector{Float64})
    @ NLSolversBase /builds/PumasAI/PumasSystemImages-jl/.julia/packages/NLSolversBase/cfJrN/src/interface.jl:28
  [9] value!(obj::Optim.ManifoldObjective{NLSolversBase.OnceDifferentiable{Float64, Vector{Float64}, Vector{Float64}}}, x::Vector{Float64})
    @ Optim /builds/PumasAI/PumasSystemImages-jl/.julia/packages/Optim/rpjtl/src/Manifolds.jl:31
 [10] (::LineSearches.var"#ϕ#1"{Optim.ManifoldObjective{NLSolversBase.OnceDifferentiable{Float64, Vector{Float64}, Vector{Float64}}}, Vector{Float64}, Vector{Float64}, Vector{Float64}})(α::Float64)
    @ LineSearches /builds/PumasAI/PumasSystemImages-jl/.julia/packages/LineSearches/Ki4c5/src/LineSearches.jl:25
 [11] (::LineSearches.BackTracking{Float64, Int64})(ϕ::LineSearches.var"#ϕ#1"{Optim.ManifoldObjective{NLSolversBase.OnceDifferentiable{Float64, Vector{Float64}, Vector{Float64}}}, Vector{Float64}, Vector{Float64}, Vector{Float64}}, αinitial::Float64, ϕ_0::Float64, dϕ_0::Float64)
    @ LineSearches /builds/PumasAI/PumasSystemImages-jl/.julia/packages/LineSearches/Ki4c5/src/backtracking.jl:60
 [12] BackTracking
    @ /builds/PumasAI/PumasSystemImages-jl/.julia/packages/LineSearches/Ki4c5/src/backtracking.jl:33 [inlined]
 [13] BackTracking
    @ /builds/PumasAI/PumasSystemImages-jl/.julia/packages/LineSearches/Ki4c5/src/backtracking.jl:23 [inlined]
 [14] perform_linesearch!(state::Optim.BFGSState{Vector{Float64}, Matrix{Float64}, Float64, Vector{Float64}}, method::Optim.BFGS{LineSearches.InitialStatic{Float64}, LineSearches.BackTracking{Float64, Int64}, Nothing, Float64, Optim.Flat}, d::Optim.ManifoldObjective{NLSolversBase.OnceDifferentiable{Float64, Vector{Float64}, Vector{Float64}}})
    @ Optim /builds/PumasAI/PumasSystemImages-jl/.julia/packages/Optim/rpjtl/src/utilities/perform_linesearch.jl:59
 [15] update_state!(d::NLSolversBase.OnceDifferentiable{Float64, Vector{Float64}, Vector{Float64}}, state::Optim.BFGSState{Vector{Float64}, Matrix{Float64}, Float64, Vector{Float64}}, method::Optim.BFGS{LineSearches.InitialStatic{Float64}, LineSearches.BackTracking{Float64, Int64}, Nothing, Float64, Optim.Flat})
    @ Optim /builds/PumasAI/PumasSystemImages-jl/.julia/packages/Optim/rpjtl/src/multivariate/solvers/first_order/bfgs.jl:139
 [16] optimize(d::NLSolversBase.OnceDifferentiable{Float64, Vector{Float64}, Vector{Float64}}, initial_x::Vector{Float64}, method::Optim.BFGS{LineSearches.InitialStatic{Float64}, LineSearches.BackTracking{Float64, Int64}, Nothing, Float64, Optim.Flat}, options::Optim.Options{Float64, Pumas.var"#551#553"{Pumas.DefaultOptimizeFN{Nothing, NamedTuple{(:show_trace, :store_trace, :extended_trace, :g_tol, :allow_f_increases), Tuple{Bool, Bool, Bool, Float64, Bool}}}, Pumas.var"#582#584"{Pumas.FOCE, Bool, NLSolversBase.OnceDifferentiable{Float64, Vector{Float64}, Vector{Float64}}, TransformVariables.TransformTuple{NamedTuple{(:tvbioav, :tvKTV, :ecmo, :circuit, :cl, :v, :Ω₁, :Ω₂, :σ_prop, :σ_add), Tuple{TransformVariables.Identity, TransformVariables.ShiftedExp{true, Float64}, TransformVariables.Identity, TransformVariables.Identity, TransformVariables.ShiftedExp{true, Float64}, TransformVariables.ShiftedExp{true, Float64}, TransformVariables.Identity, TransformVariables.Identity, TransformVariables.ShiftedExp{true, Float64}, TransformVariables.ShiftedExp{true, Float64}}}}, Vector{Vector{Float64}}, Vector{Vector{Float64}}}}}, state::Optim.BFGSState{Vector{Float64}, Matrix{Float64}, Float64, Vector{Float64}})
    @ Optim /builds/PumasAI/PumasSystemImages-jl/.julia/packages/Optim/rpjtl/src/multivariate/optimize/optimize.jl:54
 [17] optimize
    @ /builds/PumasAI/PumasSystemImages-jl/.julia/packages/Optim/rpjtl/src/multivariate/optimize/optimize.jl:36 [inlined]
 [18] DefaultOptimizeFN
    @ /builds/PumasAI/PumasSystemImages-jl/.julia/packages/Pumas/MxXdQ/src/estimation/likelihoods.jl:2902 [inlined]
 [19] _fit(m::PumasModel{(tvbioav = 1, tvKTV = 1, ecmo = 1, circuit = 1, cl = 1, v = 1, Ω₁ = 1, Ω₂ = 1, σ_prop = 1, σ_add = 1), 2, (:Central,), ParamSet{NamedTuple{(:tvbioav, :tvKTV, :ecmo, :circuit, :cl, :v, :Ω₁, :Ω₂, :σ_prop, :σ_add), Tuple{RealDomain{TransformVariables.Infinity{false}, TransformVariables.Infinity{true}, Float64}, RealDomain{Float64, TransformVariables.Infinity{true}, Float64}, RealDomain{TransformVariables.Infinity{false}, TransformVariables.Infinity{true}, Float64}, RealDomain{TransformVariables.Infinity{false}, TransformVariables.Infinity{true}, Float64}, RealDomain{Float64, TransformVariables.Infinity{true}, Float64}, RealDomain{Float64, TransformVariables.Infinity{true}, Float64}, RealDomain{TransformVariables.Infinity{false}, TransformVariables.Infinity{true}, Float64}, RealDomain{TransformVariables.Infinity{false}, TransformVariables.Infinity{true}, Float64}, RealDomain{Float64, TransformVariables.Infinity{true}, Float64}, RealDomain{Float64, TransformVariables.Infinity{true}, Float64}}}}, var"#225#237", Pumas.TimeDispatcher{var"#226#238", var"#228#240"}, Pumas.TimeDispatcher{var"#230#242", var"#231#243"}, var"#232#244", ODEProblem{Nothing, Tuple{Nothing, Nothing}, false, Nothing, ODEFunction{false, ModelingToolkit.ODEFunctionClosure{var"#233#245", var"#234#246"}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, var"#235#247", var"#236#248", ModelingToolkit.ODESystem}, population::Vector{Subject{NamedTuple{(:CONC,), Tuple{Vector{Union{Missing, Float64}}}}, Pumas.ConstantInterpolationStructArray{Vector{Float64}, NamedTuple{(:logwt, :AGE_GROUP, :logecmo, :WT, :AGE_D, :ISMALE, :SCR, :GFR, :AGEYRS, :TYPE_MODELING, :IS_BLEEDING, :IS_CIRCUIT_CHANGE, :ECMO_DAYS, :Occassions, :IS_CIRCUIT_CHANGE_UPDATE, :IS_BLEEDING_UPDATE), Tuple{Vector{Float64}, Vector{String31}, Vector{Float64}, Vector{Float64}, Vector{Int64}, Vector{Int64}, Vector{Float64}, Vector{Int64}, Vector{Float64}, Vector{Int64}, Vector{Int64}, Vector{Int64}, Vector{Int64}, Vector{Int64}, Vector{Int64}, Vector{Int64}}}, Symbol}, Vector{Pumas.Event{Float64, Float64, Float64, Float64, Float64, Float64, Int64}}, Vector{Float64}}}, param::NamedTuple{(:tvbioav, :tvKTV, :ecmo, :circuit, :cl, :v, :Ω₁, :Ω₂, :σ_prop, :σ_add), Tuple{Int64, Float64, Float64, Int64, Float64, Int64, Int64, Int64, Float64, Int64}}, approx::Pumas.FOCE, ensemblealg::EnsembleThreads, optimize_fn::Pumas.DefaultOptimizeFN{Nothing, NamedTuple{(:show_trace, :store_trace, :extended_trace, :g_tol, :allow_f_increases), Tuple{Bool, Bool, Bool, Float64, Bool}}}, fixedparamset::ParamSet{NamedTuple{(:tvbioav, :tvKTV, :ecmo, :circuit, :cl, :v, :Ω₁, :Ω₂, :σ_prop, :σ_add), Tuple{RealDomain{TransformVariables.Infinity{false}, TransformVariables.Infinity{true}, Float64}, RealDomain{Float64, TransformVariables.Infinity{true}, Float64}, RealDomain{TransformVariables.Infinity{false}, TransformVariables.Infinity{true}, Float64}, RealDomain{TransformVariables.Infinity{false}, TransformVariables.Infinity{true}, Float64}, RealDomain{Float64, TransformVariables.Infinity{true}, Float64}, RealDomain{Float64, TransformVariables.Infinity{true}, Float64}, RealDomain{TransformVariables.Infinity{false}, TransformVariables.Infinity{true}, Float64}, RealDomain{TransformVariables.Infinity{false}, TransformVariables.Infinity{true}, Float64}, RealDomain{Float64, TransformVariables.Infinity{true}, Float64}, RealDomain{Float64, TransformVariables.Infinity{true}, Float64}}}}, fixedparam::NamedTuple{(:tvbioav, :tvKTV, :ecmo, :circuit, :cl, :v, :Ω₁, :Ω₂, :σ_prop, :σ_add), Tuple{Int64, Float64, Float64, Int64, Float64, Int64, Int64, Int64, Float64, Int64}}, checkidentification::Bool, diffeq_options::NamedTuple{(), Tuple{}})
    @ Pumas /builds/PumasAI/PumasSystemImages-jl/.julia/packages/Pumas/MxXdQ/src/estimation/likelihoods.jl:3785
 [20] __fit
    @ /builds/PumasAI/PumasSystemImages-jl/.julia/packages/Pumas/MxXdQ/src/estimation/likelihoods.jl:3574 [inlined]
 [21] fit(m::PumasModel{(tvbioav = 1, tvKTV = 1, ecmo = 1, circuit = 1, cl = 1, v = 1, Ω₁ = 1, Ω₂ = 1, σ_prop = 1, σ_add = 1), 2, (:Central,), ParamSet{NamedTuple{(:tvbioav, :tvKTV, :ecmo, :circuit, :cl, :v, :Ω₁, :Ω₂, :σ_prop, :σ_add), Tuple{RealDomain{TransformVariables.Infinity{false}, TransformVariables.Infinity{true}, Float64}, RealDomain{Float64, TransformVariables.Infinity{true}, Float64}, RealDomain{TransformVariables.Infinity{false}, TransformVariables.Infinity{true}, Float64}, RealDomain{TransformVariables.Infinity{false}, TransformVariables.Infinity{true}, Float64}, RealDomain{Float64, TransformVariables.Infinity{true}, Float64}, RealDomain{Float64, TransformVariables.Infinity{true}, Float64}, RealDomain{TransformVariables.Infinity{false}, TransformVariables.Infinity{true}, Float64}, RealDomain{TransformVariables.Infinity{false}, TransformVariables.Infinity{true}, Float64}, RealDomain{Float64, TransformVariables.Infinity{true}, Float64}, RealDomain{Float64, TransformVariables.Infinity{true}, Float64}}}}, var"#225#237", Pumas.TimeDispatcher{var"#226#238", var"#228#240"}, Pumas.TimeDispatcher{var"#230#242", var"#231#243"}, var"#232#244", ODEProblem{Nothing, Tuple{Nothing, Nothing}, false, Nothing, ODEFunction{false, ModelingToolkit.ODEFunctionClosure{var"#233#245", var"#234#246"}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, var"#235#247", var"#236#248", ModelingToolkit.ODESystem}, _population::Vector{Subject{NamedTuple{(:CONC,), Tuple{Vector{Union{Missing, Float64}}}}, Pumas.ConstantInterpolationStructArray{Vector{Float64}, NamedTuple{(:logwt, :AGE_GROUP, :logecmo, :WT, :AGE_D, :ISMALE, :SCR, :GFR, :AGEYRS, :TYPE_MODELING, :IS_BLEEDING, :IS_CIRCUIT_CHANGE, :ECMO_DAYS, :Occassions, :IS_CIRCUIT_CHANGE_UPDATE, :IS_BLEEDING_UPDATE), Tuple{Vector{Float64}, Vector{String31}, Vector{Float64}, Vector{Float64}, Vector{Int64}, Vector{Int64}, Vector{Float64}, Vector{Int64}, Vector{Float64}, Vector{Int64}, Vector{Int64}, Vector{Int64}, Vector{Int64}, Vector{Int64}, Vector{Int64}, Vector{Int64}}}, Symbol}, Vector{Pumas.Event{Float64, Float64, Float64, Float64, Float64, Float64, Int64}}, Vector{Float64}}}, param::NamedTuple{(:tvbioav, :tvKTV, :cl, :ecmo, :circuit, :v, :Ω₁, :Ω₂, :σ_prop, :σ_add), Tuple{Int64, Float64, Float64, Float64, Int64, Int64, Int64, Int64, Float64, Int64}}, approx::Pumas.FOCE; optimize_fn::Pumas.DefaultOptimizeFN{Nothing, NamedTuple{(:show_trace, :store_trace, :extended_trace, :g_tol, :allow_f_increases), Tuple{Bool, Bool, Bool, Float64, Bool}}}, constantcoef::NamedTuple{(), Tuple{}}, omegas::Tuple{}, ensemblealg::EnsembleThreads, checkidentification::Bool, diffeq_options::NamedTuple{(), Tuple{}})
    @ Pumas /builds/PumasAI/PumasSystemImages-jl/.julia/packages/Pumas/MxXdQ/src/estimation/likelihoods.jl:3542
 [22] fit(m::PumasModel{(tvbioav = 1, tvKTV = 1, ecmo = 1, circuit = 1, cl = 1, v = 1, Ω₁ = 1, Ω₂ = 1, σ_prop = 1, σ_add = 1), 2, (:Central,), ParamSet{NamedTuple{(:tvbioav, :tvKTV, :ecmo, :circuit, :cl, :v, :Ω₁, :Ω₂, :σ_prop, :σ_add), Tuple{RealDomain{TransformVariables.Infinity{false}, TransformVariables.Infinity{true}, Float64}, RealDomain{Float64, TransformVariables.Infinity{true}, Float64}, RealDomain{TransformVariables.Infinity{false}, TransformVariables.Infinity{true}, Float64}, RealDomain{TransformVariables.Infinity{false}, TransformVariables.Infinity{true}, Float64}, RealDomain{Float64, TransformVariables.Infinity{true}, Float64}, RealDomain{Float64, TransformVariables.Infinity{true}, Float64}, RealDomain{TransformVariables.Infinity{false}, TransformVariables.Infinity{true}, Float64}, RealDomain{TransformVariables.Infinity{false}, TransformVariables.Infinity{true}, Float64}, RealDomain{Float64, TransformVariables.Infinity{true}, Float64}, RealDomain{Float64, TransformVariables.Infinity{true}, Float64}}}}, var"#225#237", Pumas.TimeDispatcher{var"#226#238", var"#228#240"}, Pumas.TimeDispatcher{var"#230#242", var"#231#243"}, var"#232#244", ODEProblem{Nothing, Tuple{Nothing, Nothing}, false, Nothing, ODEFunction{false, ModelingToolkit.ODEFunctionClosure{var"#233#245", var"#234#246"}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, var"#235#247", var"#236#248", ModelingToolkit.ODESystem}, _population::Vector{Subject{NamedTuple{(:CONC,), Tuple{Vector{Union{Missing, Float64}}}}, Pumas.ConstantInterpolationStructArray{Vector{Float64}, NamedTuple{(:logwt, :AGE_GROUP, :logecmo, :WT, :AGE_D, :ISMALE, :SCR, :GFR, :AGEYRS, :TYPE_MODELING, :IS_BLEEDING, :IS_CIRCUIT_CHANGE, :ECMO_DAYS, :Occassions, :IS_CIRCUIT_CHANGE_UPDATE, :IS_BLEEDING_UPDATE), Tuple{Vector{Float64}, Vector{String31}, Vector{Float64}, Vector{Float64}, Vector{Int64}, Vector{Int64}, Vector{Float64}, Vector{Int64}, Vector{Float64}, Vector{Int64}, Vector{Int64}, Vector{Int64}, Vector{Int64}, Vector{Int64}, Vector{Int64}, Vector{Int64}}}, Symbol}, Vector{Pumas.Event{Float64, Float64, Float64, Float64, Float64, Float64, Int64}}, Vector{Float64}}}, param::NamedTuple{(:tvbioav, :tvKTV, :cl, :ecmo, :circuit, :v, :Ω₁, :Ω₂, :σ_prop, :σ_add), Tuple{Int64, Float64, Float64, Float64, Int64, Int64, Int64, Int64, Float64, Int64}}, approx::Pumas.FOCE)
    @ Pumas /builds/PumasAI/PumasSystemImages-jl/.julia/packages/Pumas/MxXdQ/src/estimation/likelihoods.jl:3521
 [23] top-level scope
    @ ~/data/code/UFH_ECMO_UTAH/UFH_UTAH/ECMO_UTAH_NEW.jl:210

    nested task error: Something went wrong. Integrator stepped past tstops but the algorithm was dtchangeable. Please report this error.
    Stacktrace:
      [1] error(s::String)
        @ Base ./error.jl:33

Is the way the model written not the right way ?

When you do:

exp(LGTF)/(1+exp(LGTF))

you introduce a lot of numerical issues. It is better to use the logistic function exported from Pumas.
It is numerically stabler than the naïve formula:

logistic(LGTF)

Another option would be to get rid of non-linear transformations and break free from Gaussian.
Remember that in Pumas you can use any distribution that you want.

A similar approach would be to use a Beta distribution for the ηBioav and don’t rely on non-linear transformations (out with the logistic):

@param begin
    θbioav ∈ RealDomain(lower=0.0, upper=1.0)
    ωbioav ∈ RealDomain(lower=0.0)
end
@random begin
    ηBioav ~ Beta(θbioav * ωbioav, (1 - θbioav) * ωbioav)
end
@dosecontrol begin
    bioav = (Central=ηBioav,)
end
1 Like

Hello, @storopoli

I am referring to your code for my model. I am wondering if ωbioav is a standard deviation or variance of θbioav. Could you please advise me? Thank you.

Neither standard deviation nor variance.

Check https://tutorials.pumas.ai/html/introduction/non_gaussian_random_effects.html for an in-depth explanation.

The interpretation is like the length of a Binomial distribution.

But you can get variance by:

\operatorname{Var}(F) = \frac{\mu(1 - \mu)}{n}

where \mu is θbioav and n is ωbioav.

Thank you so much for your kind explanation!

@storopoli Is there a way to get the actual etas from the icoefs with the beta distribution? I am bootstrapping etas from 2 separate data sets with different tvbioav to feed into a simulation, so I would also need the bioav = tvbioav*exp(etabioav) type form for the beta distribution.

if you do a DataFrame(inspect(fit_result)), that should get you everything you want.