# Converting variance-covariance matrix to LKJCholesky prior in Bayesian estimation

Hello, I am trying to perform Bayesian estimation.
Then, I would like to use an informative prior distribution for the variance-covariance matrix based on LKJCholesky.
However, I have been failed so far.

I would like to know what is the problem,
how to convert my variance-covariance matrix (Ω_1 and Ω_2) to LKJCholesky prior,
and how to adjust the amount of correlation based on this prior.

Here is the variance-covariance matrix:

``````Ω_1 =[0.114 0.080
0.080 0.081]
Ω_2 =[0.047 -0.013
-0.013 0.0056]
``````

Here is the model:

``````model_ = @model begin
desc        = "two compartment model with first-order absorption and Tlag"
end

@param begin
"Clearance (L/hr)"
tvcl_other   ~ LogNormal(log(7.97), 0.1)
tvcl_GF      ~ LogNormal(log(8.52), 0.1)
"Volume of Central Compartment (L)"
tvvc         ~ LogNormal(log(122.7), 0.1)
"Intercompartmental Clearance (L/hr)"
tvq          ~ LogNormal(log(10.1), 0.1)
"Volume of Peripheral Compartment (L)"
tvvp         ~ LogNormal(log(97.91), 0.1)
"Absorption Rate Constant (hr⁻¹)"
tvka         ~ LogNormal(log(2.15), 0.1)
"Lagtime (hr)"
tvlag        ~ LogNormal(log(0.22), 0.1)
"LBM exponent"
LBM_exp      ~ LogNormal(log(0.92), 0.1)
"BSV"
C_1       ~ LKJCholesky(2, 1.0)
Ω_1      ~ Constrained(
MvNormal(zeros(2), Diagonal([0.114, 0.081]));
lower=zeros(2),
upper=fill(Inf, 2),
init=ones(2)
)
C_2       ~ LKJCholesky(2, 1.0)
Ω_2      ~ Constrained(
MvNormal(zeros(2), Diagonal([0.047, 0.0056]));
lower=zeros(2),
upper=fill(Inf, 2),
init=ones(2)
)
"BOV"
ω²η       ~ InverseGamma(154.40134051923962, 154.30201062815695)
"Proportional RUV"
σ²_prop   ∈ RealDomain(lower=0.0001, init=0.06541313854823212)
end

@random begin
ηstd_1 ~ MvNormal(I(2))
ηstd_2 ~ MvNormal(I(2))
η_BOV   ~ MvNormal(3, sqrt(ω²η))
end

@covariates CrCL LBM OCC

@pre begin
η_1 = Diagonal(Ω_1) * (getchol(C_1).L * ηstd_1)
η_2 = Diagonal(Ω_2) * (getchol(C_2).L * ηstd_2)

CL          = (tvcl_other + (tvcl_GF * (CrCL/90))) * exp(η_1[1])
Vc          = tvvc * ((LBM/55)^LBM_exp) * exp(η_1[2])
Q           = tvq
Vp          = tvvp
Ka          = tvka * exp(η_2[1]) * exp(η_BOV[OCC])
Tlag        = tvlag * exp(η_2[2])
end

@dosecontrol begin
lags = (Depot = tvlag * exp(η_2[2]),)
end

@dynamics Depots1Central1Periph1

@derived begin
cp := @. (Central/Vc)
dv ~ @. Normal(cp, sqrt((cp^2) * (σ²_prop)))
end
end
``````

And, here is the error message:

``````[ Info: Checking the initial parameter values.
Stacktrace:
[1] wait
[2] fetch
[3] __tmapreduce(f::Pumas.var"#707#708"{Float64, Pumas.ThreadedBayesLogDensity{PumasModel{(tvcl_other = 1, tvcl_GF = 1, tvvc = 1, tvq = 1, tvvp = 1, tvka = 1, tvlag = 1, LBM_exp = 1, C_1 = 1, Ω_1 = 2, C_2 = 1, Ω_2 = 2, ω²η = 1, σ²_prop = 1), 7, (:Depot, :Central, :Peripheral), ParamSet{NamedTuple{(:tvcl_other, :tvcl_GF, :tvvc, :tvq, :tvvp, :tvka, :tvlag, :LBM_exp, :C_1, :Ω_1, :C_2, :Ω_2, :ω²η, :σ²_prop), Tuple{LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LKJCholesky{Float64}, Constrained{DiagNormal, VectorDomain{Vector{Float64}, Vector{TransformVariables.Infinity{true}}, Vector{Float64}}}, LKJCholesky{Float64}, Constrained{DiagNormal, VectorDomain{Vector{Float64}, Vector{TransformVariables.Infinity{true}}, Vector{Float64}}}, InverseGamma{Float64}, RealDomain{Float64, TransformVariables.Infinity{true}, Float64}}}}, var"#23#32", Pumas.TimeDispatcher{var"#24#33", var"#25#34"}, Pumas.TimeDispatcher{var"#27#36", var"#28#37"}, var"#29#38", Depots1Central1Periph1, var"#30#39", var"#31#40", Nothing}, NamedTuple{(:tvcl_other, :tvcl_GF, :tvvc, :tvq, :tvvp, :tvka, :tvlag, :LBM_exp, :C_1, :Ω_1, :C_2, :Ω_2, :ω²η, :σ²_prop), Tuple{Float64, Float64, Float64, Float64, Float64, Float64, Float64, Float64, Matrix{Float64}, Vector{Float64}, Matrix{Float64}, Vector{Float64}, Float64, Float64}}, Vector{Subject{NamedTuple{(:dv,), Tuple{Vector{Union{Missing, Float64}}}}, Pumas.ConstantInterpolationStructArray{Vector{Float64}, NamedTuple{(:CrCL, :LBM, :OCC), Tuple{Vector{Float64}, Vector{Float64}, Vector{Int64}}}, Symbol}, Vector{Pumas.Event{Float64, Float64, Float64, Float64, Float64, Float64, Int64}}, Vector{Float64}}}, Vector{Vector{Float64}}, Vector{Vector{Float64}}, Vector{ForwardDiff.GradientConfig{ForwardDiff.Tag{Pumas.Tag, Float64}, Float64, 8, Vector{ForwardDiff.Dual{ForwardDiff.Tag{Pumas.Tag, Float64}, Float64, 8}}}}, Vector{DiffResults.MutableDiffResult{1, Float64, Tuple{Vector{Float64}}}}, NamedTuple{(), Tuple{}}}, Vector{Float64}, NamedTuple{(:tvcl_other, :tvcl_GF, :tvvc, :tvq, :tvvp, :tvka, :tvlag, :LBM_exp, :C_1, :Ω_1, :C_2, :Ω_2, :ω²η, :σ²_prop), Tuple{Float64, Float64, Float64, Float64, Float64, Float64, Float64, Float64, Pumas.CorrMat{Float64, PDMats.PDMat{Float64, Matrix{Float64}}}, Vector{Float64}, Pumas.CorrMat{Float64, PDMats.PDMat{Float64, Matrix{Float64}}}, Vector{Float64}, Float64, Float64}}}, op::typeof(+), tasks::Vector{Task}, len::Int64, init::Float64, src::Tuple{UnitRange{Int64}}, batchargs::Tuple{})
@ Pumas /build/_work/PumasSystemImages/PumasSystemImages/julia_depot/packages/Pumas/Td3Jp/src/estimation/bayes/logdensity.jl:418
[4] _tmapreduce
@ /build/_work/PumasSystemImages/PumasSystemImages/julia_depot/packages/Pumas/Td3Jp/src/estimation/bayes/logdensity.jl:440 [inlined]
@ Pumas /build/_work/PumasSystemImages/PumasSystemImages/julia_depot/packages/Pumas/Td3Jp/src/estimation/bayes/logdensity.jl:451
[6] _logdensity(b::Pumas.ThreadedBayesLogDensity{PumasModel{(tvcl_other = 1, tvcl_GF = 1, tvvc = 1, tvq = 1, tvvp = 1, tvka = 1, tvlag = 1, LBM_exp = 1, C_1 = 1, Ω_1 = 2, C_2 = 1, Ω_2 = 2, ω²η = 1, σ²_prop = 1), 7, (:Depot, :Central, :Peripheral), ParamSet{NamedTuple{(:tvcl_other, :tvcl_GF, :tvvc, :tvq, :tvvp, :tvka, :tvlag, :LBM_exp, :C_1, :Ω_1, :C_2, :Ω_2, :ω²η, :σ²_prop), Tuple{LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LKJCholesky{Float64}, Constrained{DiagNormal, VectorDomain{Vector{Float64}, Vector{TransformVariables.Infinity{true}}, Vector{Float64}}}, LKJCholesky{Float64}, Constrained{DiagNormal, VectorDomain{Vector{Float64}, Vector{TransformVariables.Infinity{true}}, Vector{Float64}}}, InverseGamma{Float64}, RealDomain{Float64, TransformVariables.Infinity{true}, Float64}}}}, var"#23#32", Pumas.TimeDispatcher{var"#24#33", var"#25#34"}, Pumas.TimeDispatcher{var"#27#36", var"#28#37"}, var"#29#38", Depots1Central1Periph1, var"#30#39", var"#31#40", Nothing}, NamedTuple{(:tvcl_other, :tvcl_GF, :tvvc, :tvq, :tvvp, :tvka, :tvlag, :LBM_exp, :C_1, :Ω_1, :C_2, :Ω_2, :ω²η, :σ²_prop), Tuple{Float64, Float64, Float64, Float64, Float64, Float64, Float64, Float64, Matrix{Float64}, Vector{Float64}, Matrix{Float64}, Vector{Float64}, Float64, Float64}}, Vector{Subject{NamedTuple{(:dv,), Tuple{Vector{Union{Missing, Float64}}}}, Pumas.ConstantInterpolationStructArray{Vector{Float64}, NamedTuple{(:CrCL, :LBM, :OCC), Tuple{Vector{Float64}, Vector{Float64}, Vector{Int64}}}, Symbol}, Vector{Pumas.Event{Float64, Float64, Float64, Float64, Float64, Float64, Int64}}, Vector{Float64}}}, Vector{Vector{Float64}}, Vector{Vector{Float64}}, Vector{ForwardDiff.GradientConfig{ForwardDiff.Tag{Pumas.Tag, Float64}, Float64, 8, Vector{ForwardDiff.Dual{ForwardDiff.Tag{Pumas.Tag, Float64}, Float64, 8}}}}, Vector{DiffResults.MutableDiffResult{1, Float64, Tuple{Vector{Float64}}}}, NamedTuple{(), Tuple{}}}, v::Vector{Float64})
@ Pumas /build/_work/PumasSystemImages/PumasSystemImages/julia_depot/packages/Pumas/Td3Jp/src/estimation/bayes/logdensity.jl:324
[7] _check_initial_values(bayes::Pumas.ThreadedBayesLogDensity{PumasModel{(tvcl_other = 1, tvcl_GF = 1, tvvc = 1, tvq = 1, tvvp = 1, tvka = 1, tvlag = 1, LBM_exp = 1, C_1 = 1, Ω_1 = 2, C_2 = 1, Ω_2 = 2, ω²η = 1, σ²_prop = 1), 7, (:Depot, :Central, :Peripheral), ParamSet{NamedTuple{(:tvcl_other, :tvcl_GF, :tvvc, :tvq, :tvvp, :tvka, :tvlag, :LBM_exp, :C_1, :Ω_1, :C_2, :Ω_2, :ω²η, :σ²_prop), Tuple{LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LKJCholesky{Float64}, Constrained{DiagNormal, VectorDomain{Vector{Float64}, Vector{TransformVariables.Infinity{true}}, Vector{Float64}}}, LKJCholesky{Float64}, Constrained{DiagNormal, VectorDomain{Vector{Float64}, Vector{TransformVariables.Infinity{true}}, Vector{Float64}}}, InverseGamma{Float64}, RealDomain{Float64, TransformVariables.Infinity{true}, Float64}}}}, var"#23#32", Pumas.TimeDispatcher{var"#24#33", var"#25#34"}, Pumas.TimeDispatcher{var"#27#36", var"#28#37"}, var"#29#38", Depots1Central1Periph1, var"#30#39", var"#31#40", Nothing}, NamedTuple{(:tvcl_other, :tvcl_GF, :tvvc, :tvq, :tvvp, :tvka, :tvlag, :LBM_exp, :C_1, :Ω_1, :C_2, :Ω_2, :ω²η, :σ²_prop), Tuple{Float64, Float64, Float64, Float64, Float64, Float64, Float64, Float64, Matrix{Float64}, Vector{Float64}, Matrix{Float64}, Vector{Float64}, Float64, Float64}}, Vector{Subject{NamedTuple{(:dv,), Tuple{Vector{Union{Missing, Float64}}}}, Pumas.ConstantInterpolationStructArray{Vector{Float64}, NamedTuple{(:CrCL, :LBM, :OCC), Tuple{Vector{Float64}, Vector{Float64}, Vector{Int64}}}, Symbol}, Vector{Pumas.Event{Float64, Float64, Float64, Float64, Float64, Float64, Int64}}, Vector{Float64}}}, Vector{Vector{Float64}}, Vector{Vector{Float64}}, Vector{ForwardDiff.GradientConfig{ForwardDiff.Tag{Pumas.Tag, Float64}, Float64, 8, Vector{ForwardDiff.Dual{ForwardDiff.Tag{Pumas.Tag, Float64}, Float64, 8}}}}, Vector{DiffResults.MutableDiffResult{1, Float64, Tuple{Vector{Float64}}}}, NamedTuple{(), Tuple{}}}, vparam_aug::Vector{Float64})
@ Pumas /build/_work/PumasSystemImages/PumasSystemImages/julia_depot/packages/Pumas/Td3Jp/src/estimation/bayes/nuts.jl:393
[8] pumas_sample(rngs::Vector{Xoshiro}, bayes::Vector{Pumas.ThreadedBayesLogDensity{PumasModel{(tvcl_other = 1, tvcl_GF = 1, tvvc = 1, tvq = 1, tvvp = 1, tvka = 1, tvlag = 1, LBM_exp = 1, C_1 = 1, Ω_1 = 2, C_2 = 1, Ω_2 = 2, ω²η = 1, σ²_prop = 1), 7, (:Depot, :Central, :Peripheral), ParamSet{NamedTuple{(:tvcl_other, :tvcl_GF, :tvvc, :tvq, :tvvp, :tvka, :tvlag, :LBM_exp, :C_1, :Ω_1, :C_2, :Ω_2, :ω²η, :σ²_prop), Tuple{LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LKJCholesky{Float64}, Constrained{DiagNormal, VectorDomain{Vector{Float64}, Vector{TransformVariables.Infinity{true}}, Vector{Float64}}}, LKJCholesky{Float64}, Constrained{DiagNormal, VectorDomain{Vector{Float64}, Vector{TransformVariables.Infinity{true}}, Vector{Float64}}}, InverseGamma{Float64}, RealDomain{Float64, TransformVariables.Infinity{true}, Float64}}}}, var"#23#32", Pumas.TimeDispatcher{var"#24#33", var"#25#34"}, Pumas.TimeDispatcher{var"#27#36", var"#28#37"}, var"#29#38", Depots1Central1Periph1, var"#30#39", var"#31#40", Nothing}, NamedTuple{(:tvcl_other, :tvcl_GF, :tvvc, :tvq, :tvvp, :tvka, :tvlag, :LBM_exp, :C_1, :Ω_1, :C_2, :Ω_2, :ω²η, :σ²_prop), Tuple{Float64, Float64, Float64, Float64, Float64, Float64, Float64, Float64, Matrix{Float64}, Vector{Float64}, Matrix{Float64}, Vector{Float64}, Float64, Float64}}, Vector{Subject{NamedTuple{(:dv,), Tuple{Vector{Union{Missing, Float64}}}}, Pumas.ConstantInterpolationStructArray{Vector{Float64}, NamedTuple{(:CrCL, :LBM, :OCC), Tuple{Vector{Float64}, Vector{Float64}, Vector{Int64}}}, Symbol}, Vector{Pumas.Event{Float64, Float64, Float64, Float64, Float64, Float64, Int64}}, Vector{Float64}}}, Vector{Vector{Float64}}, Vector{Vector{Float64}}, Vector{ForwardDiff.GradientConfig{ForwardDiff.Tag{Pumas.Tag, Float64}, Float64, 8, Vector{ForwardDiff.Dual{ForwardDiff.Tag{Pumas.Tag, Float64}, Float64, 8}}}}, Vector{DiffResults.MutableDiffResult{1, Float64, Tuple{Vector{Float64}}}}, NamedTuple{(), Tuple{}}}}, ::EnsembleThreads, nsamples::Int64, ess_per_chain::Int64, time_limit::Float64; ess_every::Int64, progress::Bool, balance_method::Symbol, update_progress_every::Int64, alg::AdvancedHMC.GeneralisedNoUTurn{Float64}, constantcoef::NamedTuple{(), Tuple{}}, kwargs::Base.Pairs{Symbol, Union{Nothing, Integer}, Tuple{Symbol, Symbol, Symbol}, NamedTuple{(:nadapts, :procs, :check_initial), Tuple{Int64, Nothing, Bool}}})
@ Pumas /build/_work/PumasSystemImages/PumasSystemImages/julia_depot/packages/Pumas/Td3Jp/src/estimation/bayes/nuts.jl:532
[9] _fit_mcmc(model::PumasModel{(tvcl_other = 1, tvcl_GF = 1, tvvc = 1, tvq = 1, tvvp = 1, tvka = 1, tvlag = 1, LBM_exp = 1, C_1 = 1, Ω_1 = 2, C_2 = 1, Ω_2 = 2, ω²η = 1, σ²_prop = 1), 7, (:Depot, :Central, :Peripheral), ParamSet{NamedTuple{(:tvcl_other, :tvcl_GF, :tvvc, :tvq, :tvvp, :tvka, :tvlag, :LBM_exp, :C_1, :Ω_1, :C_2, :Ω_2, :ω²η, :σ²_prop), Tuple{LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LKJCholesky{Float64}, Constrained{DiagNormal, VectorDomain{Vector{Float64}, Vector{TransformVariables.Infinity{true}}, Vector{Float64}}}, LKJCholesky{Float64}, Constrained{DiagNormal, VectorDomain{Vector{Float64}, Vector{TransformVariables.Infinity{true}}, Vector{Float64}}}, InverseGamma{Float64}, RealDomain{Float64, TransformVariables.Infinity{true}, Float64}}}}, var"#23#32", Pumas.TimeDispatcher{var"#24#33", var"#25#34"}, Pumas.TimeDispatcher{var"#27#36", var"#28#37"}, var"#29#38", Depots1Central1Periph1, var"#30#39", var"#31#40", Nothing}, data::Vector{Subject{NamedTuple{(:dv,), Tuple{Vector{Union{Missing, Float64}}}}, Pumas.ConstantInterpolationStructArray{Vector{Float64}, NamedTuple{(:CrCL, :LBM, :OCC), Tuple{Vector{Float64}, Vector{Float64}, Vector{Int64}}}, Symbol}, Vector{Pumas.Event{Float64, Float64, Float64, Float64, Float64, Float64, Int64}}, Vector{Float64}}}, param::NamedTuple{(:tvcl_other, :tvcl_GF, :tvvc, :tvq, :tvvp, :tvka, :tvlag, :LBM_exp, :C_1, :Ω_1, :C_2, :Ω_2, :ω²η, :σ²_prop), Tuple{Float64, Float64, Float64, Float64, Float64, Float64, Float64, Float64, Matrix{Float64}, Vector{Float64}, Matrix{Float64}, Vector{Float64}, Float64, Float64}}, callback_update_thread::Int64, callback_update_process::Int64, ensemblealg::EnsembleThreads, parallel_subjects::Bool, parallel_chains::Bool, alg::BayesMCMC{AdvancedHMC.GeneralisedNoUTurn{Float64}, Float64, Int64, Int64, Int64, Int64, Int64, Float64, EnsembleThreads, Bool, Bool, Bool, Bool, TaskLocalRNG, NamedTuple{(), Tuple{}}, Bool, Int64, NamedTuple{(), Tuple{}}})
@ Pumas /build/_work/PumasSystemImages/PumasSystemImages/julia_depot/packages/Pumas/Td3Jp/src/estimation/bayes/nuts.jl:336
[10] _fit(model::PumasModel{(tvcl_other = 1, tvcl_GF = 1, tvvc = 1, tvq = 1, tvvp = 1, tvka = 1, tvlag = 1, LBM_exp = 1, C_1 = 1, Ω_1 = 2, C_2 = 1, Ω_2 = 2, ω²η = 1, σ²_prop = 1), 7, (:Depot, :Central, :Peripheral), ParamSet{NamedTuple{(:tvcl_other, :tvcl_GF, :tvvc, :tvq, :tvvp, :tvka, :tvlag, :LBM_exp, :C_1, :Ω_1, :C_2, :Ω_2, :ω²η, :σ²_prop), Tuple{LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LKJCholesky{Float64}, Constrained{DiagNormal, VectorDomain{Vector{Float64}, Vector{TransformVariables.Infinity{true}}, Vector{Float64}}}, LKJCholesky{Float64}, Constrained{DiagNormal, VectorDomain{Vector{Float64}, Vector{TransformVariables.Infinity{true}}, Vector{Float64}}}, InverseGamma{Float64}, RealDomain{Float64, TransformVariables.Infinity{true}, Float64}}}}, var"#23#32", Pumas.TimeDispatcher{var"#24#33", var"#25#34"}, Pumas.TimeDispatcher{var"#27#36", var"#28#37"}, var"#29#38", Depots1Central1Periph1, var"#30#39", var"#31#40", Nothing}, data::Vector{Subject{NamedTuple{(:dv,), Tuple{Vector{Union{Missing, Float64}}}}, Pumas.ConstantInterpolationStructArray{Vector{Float64}, NamedTuple{(:CrCL, :LBM, :OCC), Tuple{Vector{Float64}, Vector{Float64}, Vector{Int64}}}, Symbol}, Vector{Pumas.Event{Float64, Float64, Float64, Float64, Float64, Float64, Int64}}, Vector{Float64}}}, param::NamedTuple{(:tvcl_other, :tvcl_GF, :tvvc, :tvq, :tvvp, :tvka, :tvlag, :LBM_exp, :C_1, :Ω_1, :C_2, :Ω_2, :ω²η, :σ²_prop), Tuple{Float64, Float64, Float64, Float64, Float64, Float64, Float64, Float64, Matrix{Float64}, Vector{Float64}, Matrix{Float64}, Vector{Float64}, Float64, Float64}}, alg::BayesMCMC{AdvancedHMC.GeneralisedNoUTurn{Float64}, Float64, Int64, Int64, Int64, Int64, Int64, Float64, EnsembleThreads, Bool, Bool, Bool, Bool, TaskLocalRNG, NamedTuple{(), Tuple{}}, Bool, Int64, NamedTuple{(), Tuple{}}})
@ Pumas /build/_work/PumasSystemImages/PumasSystemImages/julia_depot/packages/Pumas/Td3Jp/src/estimation/bayes/nuts.jl:230
[11] #fit#769
@ /build/_work/PumasSystemImages/PumasSystemImages/julia_depot/packages/Pumas/Td3Jp/src/estimation/bayes/nuts.jl:156 [inlined]
[12] fit(model::PumasModel{(tvcl_other = 1, tvcl_GF = 1, tvvc = 1, tvq = 1, tvvp = 1, tvka = 1, tvlag = 1, LBM_exp = 1, C_1 = 1, Ω_1 = 2, C_2 = 1, Ω_2 = 2, ω²η = 1, σ²_prop = 1), 7, (:Depot, :Central, :Peripheral), ParamSet{NamedTuple{(:tvcl_other, :tvcl_GF, :tvvc, :tvq, :tvvp, :tvka, :tvlag, :LBM_exp, :C_1, :Ω_1, :C_2, :Ω_2, :ω²η, :σ²_prop), Tuple{LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LKJCholesky{Float64}, Constrained{DiagNormal, VectorDomain{Vector{Float64}, Vector{TransformVariables.Infinity{true}}, Vector{Float64}}}, LKJCholesky{Float64}, Constrained{DiagNormal, VectorDomain{Vector{Float64}, Vector{TransformVariables.Infinity{true}}, Vector{Float64}}}, InverseGamma{Float64}, RealDomain{Float64, TransformVariables.Infinity{true}, Float64}}}}, var"#23#32", Pumas.TimeDispatcher{var"#24#33", var"#25#34"}, Pumas.TimeDispatcher{var"#27#36", var"#28#37"}, var"#29#38", Depots1Central1Periph1, var"#30#39", var"#31#40", Nothing}, data::Vector{Subject{NamedTuple{(:dv,), Tuple{Vector{Union{Missing, Float64}}}}, Pumas.ConstantInterpolationStructArray{Vector{Float64}, NamedTuple{(:CrCL, :LBM, :OCC), Tuple{Vector{Float64}, Vector{Float64}, Vector{Int64}}}, Symbol}, Vector{Pumas.Event{Float64, Float64, Float64, Float64, Float64, Float64, Int64}}, Vector{Float64}}}, param::NamedTuple{(:tvcl_other, :tvcl_GF, :tvvc, :tvq, :tvvp, :tvka, :tvlag, :LBM_exp, :C_1, :Ω_1, :C_2, :Ω_2, :ω²η, :σ²_prop), Tuple{Float64, Float64, Float64, Float64, Float64, Float64, Float64, Float64, Matrix{Float64}, Vector{Float64}, Matrix{Float64}, Vector{Float64}, Float64, Float64}}, alg::BayesMCMC{AdvancedHMC.GeneralisedNoUTurn{Float64}, Float64, Int64, Int64, Missing, Missing, Missing, Missing, Missing, Missing, Missing, Missing, Missing, Missing, Missing, Missing, Missing, NamedTuple{(), Tuple{}}})
@ Pumas /build/_work/PumasSystemImages/PumasSystemImages/julia_depot/packages/Pumas/Td3Jp/src/estimation/bayes/nuts.jl:155
[13] top-level scope
@ ~/data/code/Veliparib/Bayes_PK/src/Veliparib_27Apr23_LKJ.jl:163

nested task error: UndefVarError: η_2 not defined
Stacktrace:
[1] (::var"#28#37")(_param#476::NamedTuple{(:tvcl_other, :tvcl_GF, :tvvc, :tvq, :tvvp, :tvka, :tvlag, :LBM_exp, :C_1, :Ω_1, :C_2, :Ω_2, :ω²η, :σ²_prop), Tuple{Float64, Float64, Float64, Float64, Float64, Float64, Float64, Float64, Pumas.CorrMat{Float64, PDMats.PDMat{Float64, Matrix{Float64}}}, Vector{Float64}, Pumas.CorrMat{Float64, PDMats.PDMat{Float64, Matrix{Float64}}}, Vector{Float64}, Float64, Float64}}, _random#477::NamedTuple{(:ηstd_1, :ηstd_2, :η_BOV), Tuple{Vector{Float64}, Vector{Float64}, Vector{Float64}}}, _subject#474::Subject{NamedTuple{(:dv,), Tuple{Vector{Union{Missing, Float64}}}}, Pumas.ConstantInterpolationStructArray{Vector{Float64}, NamedTuple{(:CrCL, :LBM, :OCC), Tuple{Vector{Float64}, Vector{Float64}, Vector{Int64}}}, Symbol}, Vector{Pumas.Event{Float64, Float64, Float64, Float64, Float64, Float64, Int64}}, Vector{Float64}})
@ Main /build/_work/PumasSystemImages/PumasSystemImages/julia_depot/packages/Pumas/Td3Jp/src/dsl/model_macro.jl:788
[2] TimeDispatcher
@ /build/_work/PumasSystemImages/PumasSystemImages/julia_depot/packages/Pumas/Td3Jp/src/dsl/model_macro.jl:471 [inlined]
[3] TimeDispatcher
@ /build/_work/PumasSystemImages/PumasSystemImages/julia_depot/packages/Pumas/Td3Jp/src/dsl/model_macro.jl:465 [inlined]
[4] dcp(model::PumasModel{(tvcl_other = 1, tvcl_GF = 1, tvvc = 1, tvq = 1, tvvp = 1, tvka = 1, tvlag = 1, LBM_exp = 1, C_1 = 1, Ω_1 = 2, C_2 = 1, Ω_2 = 2, ω²η = 1, σ²_prop = 1), 7, (:Depot, :Central, :Peripheral), ParamSet{NamedTuple{(:tvcl_other, :tvcl_GF, :tvvc, :tvq, :tvvp, :tvka, :tvlag, :LBM_exp, :C_1, :Ω_1, :C_2, :Ω_2, :ω²η, :σ²_prop), Tuple{LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LKJCholesky{Float64}, Constrained{DiagNormal, VectorDomain{Vector{Float64}, Vector{TransformVariables.Infinity{true}}, Vector{Float64}}}, LKJCholesky{Float64}, Constrained{DiagNormal, VectorDomain{Vector{Float64}, Vector{TransformVariables.Infinity{true}}, Vector{Float64}}}, InverseGamma{Float64}, RealDomain{Float64, TransformVariables.Infinity{true}, Float64}}}}, var"#23#32", Pumas.TimeDispatcher{var"#24#33", var"#25#34"}, Pumas.TimeDispatcher{var"#27#36", var"#28#37"}, var"#29#38", Depots1Central1Periph1, var"#30#39", var"#31#40", Nothing}, subject::Subject{NamedTuple{(:dv,), Tuple{Vector{Union{Missing, Float64}}}}, Pumas.ConstantInterpolationStructArray{Vector{Float64}, NamedTuple{(:CrCL, :LBM, :OCC), Tuple{Vector{Float64}, Vector{Float64}, Vector{Int64}}}, Symbol}, Vector{Pumas.Event{Float64, Float64, Float64, Float64, Float64, Float64, Int64}}, Vector{Float64}}, param::NamedTuple{(:tvcl_other, :tvcl_GF, :tvvc, :tvq, :tvvp, :tvka, :tvlag, :LBM_exp, :C_1, :Ω_1, :C_2, :Ω_2, :ω²η, :σ²_prop), Tuple{Float64, Float64, Float64, Float64, Float64, Float64, Float64, Float64, Pumas.CorrMat{Float64, PDMats.PDMat{Float64, Matrix{Float64}}}, Vector{Float64}, Pumas.CorrMat{Float64, PDMats.PDMat{Float64, Matrix{Float64}}}, Vector{Float64}, Float64, Float64}}, randeffs::NamedTuple{(:ηstd_1, :ηstd_2, :η_BOV), Tuple{Vector{Float64}, Vector{Float64}, Vector{Float64}}})
@ Pumas /build/_work/PumasSystemImages/PumasSystemImages/julia_depot/packages/Pumas/Td3Jp/src/models/model_api.jl:2146
[5] #_derived#317
@ /build/_work/PumasSystemImages/PumasSystemImages/julia_depot/packages/Pumas/Td3Jp/src/models/model_api.jl:1257 [inlined]
[6] #conditional_nll#496
@ /build/_work/PumasSystemImages/PumasSystemImages/julia_depot/packages/Pumas/Td3Jp/src/estimation/likelihoods.jl:862 [inlined]
[7] _penalized_conditional_nll(model::PumasModel{(tvcl_other = 1, tvcl_GF = 1, tvvc = 1, tvq = 1, tvvp = 1, tvka = 1, tvlag = 1, LBM_exp = 1, C_1 = 1, Ω_1 = 2, C_2 = 1, Ω_2 = 2, ω²η = 1, σ²_prop = 1), 7, (:Depot, :Central, :Peripheral), ParamSet{NamedTuple{(:tvcl_other, :tvcl_GF, :tvvc, :tvq, :tvvp, :tvka, :tvlag, :LBM_exp, :C_1, :Ω_1, :C_2, :Ω_2, :ω²η, :σ²_prop), Tuple{LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LKJCholesky{Float64}, Constrained{DiagNormal, VectorDomain{Vector{Float64}, Vector{TransformVariables.Infinity{true}}, Vector{Float64}}}, LKJCholesky{Float64}, Constrained{DiagNormal, VectorDomain{Vector{Float64}, Vector{TransformVariables.Infinity{true}}, Vector{Float64}}}, InverseGamma{Float64}, RealDomain{Float64, TransformVariables.Infinity{true}, Float64}}}}, var"#23#32", Pumas.TimeDispatcher{var"#24#33", var"#25#34"}, Pumas.TimeDispatcher{var"#27#36", var"#28#37"}, var"#29#38", Depots1Central1Periph1, var"#30#39", var"#31#40", Nothing}, subject::Subject{NamedTuple{(:dv,), Tuple{Vector{Union{Missing, Float64}}}}, Pumas.ConstantInterpolationStructArray{Vector{Float64}, NamedTuple{(:CrCL, :LBM, :OCC), Tuple{Vector{Float64}, Vector{Float64}, Vector{Int64}}}, Symbol}, Vector{Pumas.Event{Float64, Float64, Float64, Float64, Float64, Float64, Int64}}, Vector{Float64}}, param::NamedTuple{(:tvcl_other, :tvcl_GF, :tvvc, :tvq, :tvvp, :tvka, :tvlag, :LBM_exp, :C_1, :Ω_1, :C_2, :Ω_2, :ω²η, :σ²_prop), Tuple{Float64, Float64, Float64, Float64, Float64, Float64, Float64, Float64, Pumas.CorrMat{Float64, PDMats.PDMat{Float64, Matrix{Float64}}}, Vector{Float64}, Pumas.CorrMat{Float64, PDMats.PDMat{Float64, Matrix{Float64}}}, Vector{Float64}, Float64, Float64}}, vrandeffsorth::SubArray{Float64, 1, Vector{Float64}, Tuple{UnitRange{Int64}}, true}, diffeq_options::NamedTuple{(), Tuple{}})
@ Pumas /build/_work/PumasSystemImages/PumasSystemImages/julia_depot/packages/Pumas/Td3Jp/src/estimation/likelihoods.jl:920
[8] (::Pumas.var"#707#708"{Float64, Pumas.ThreadedBayesLogDensity{PumasModel{(tvcl_other = 1, tvcl_GF = 1, tvvc = 1, tvq = 1, tvvp = 1, tvka = 1, tvlag = 1, LBM_exp = 1, C_1 = 1, Ω_1 = 2, C_2 = 1, Ω_2 = 2, ω²η = 1, σ²_prop = 1), 7, (:Depot, :Central, :Peripheral), ParamSet{NamedTuple{(:tvcl_other, :tvcl_GF, :tvvc, :tvq, :tvvp, :tvka, :tvlag, :LBM_exp, :C_1, :Ω_1, :C_2, :Ω_2, :ω²η, :σ²_prop), Tuple{LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LKJCholesky{Float64}, Constrained{DiagNormal, VectorDomain{Vector{Float64}, Vector{TransformVariables.Infinity{true}}, Vector{Float64}}}, LKJCholesky{Float64}, Constrained{DiagNormal, VectorDomain{Vector{Float64}, Vector{TransformVariables.Infinity{true}}, Vector{Float64}}}, InverseGamma{Float64}, RealDomain{Float64, TransformVariables.Infinity{true}, Float64}}}}, var"#23#32", Pumas.TimeDispatcher{var"#24#33", var"#25#34"}, Pumas.TimeDispatcher{var"#27#36", var"#28#37"}, var"#29#38", Depots1Central1Periph1, var"#30#39", var"#31#40", Nothing}, NamedTuple{(:tvcl_other, :tvcl_GF, :tvvc, :tvq, :tvvp, :tvka, :tvlag, :LBM_exp, :C_1, :Ω_1, :C_2, :Ω_2, :ω²η, :σ²_prop), Tuple{Float64, Float64, Float64, Float64, Float64, Float64, Float64, Float64, Matrix{Float64}, Vector{Float64}, Matrix{Float64}, Vector{Float64}, Float64, Float64}}, Vector{Subject{NamedTuple{(:dv,), Tuple{Vector{Union{Missing, Float64}}}}, Pumas.ConstantInterpolationStructArray{Vector{Float64}, NamedTuple{(:CrCL, :LBM, :OCC), Tuple{Vector{Float64}, Vector{Float64}, Vector{Int64}}}, Symbol}, Vector{Pumas.Event{Float64, Float64, Float64, Float64, Float64, Float64, Int64}}, Vector{Float64}}}, Vector{Vector{Float64}}, Vector{Vector{Float64}}, Vector{ForwardDiff.GradientConfig{ForwardDiff.Tag{Pumas.Tag, Float64}, Float64, 8, Vector{ForwardDiff.Dual{ForwardDiff.Tag{Pumas.Tag, Float64}, Float64, 8}}}}, Vector{DiffResults.MutableDiffResult{1, Float64, Tuple{Vector{Float64}}}}, NamedTuple{(), Tuple{}}}, Vector{Float64}, NamedTuple{(:tvcl_other, :tvcl_GF, :tvvc, :tvq, :tvvp, :tvka, :tvlag, :LBM_exp, :C_1, :Ω_1, :C_2, :Ω_2, :ω²η, :σ²_prop), Tuple{Float64, Float64, Float64, Float64, Float64, Float64, Float64, Float64, Pumas.CorrMat{Float64, PDMats.PDMat{Float64, Matrix{Float64}}}, Vector{Float64}, Pumas.CorrMat{Float64, PDMats.PDMat{Float64, Matrix{Float64}}}, Vector{Float64}, Float64, Float64}}})(i::Int64)
@ Pumas /build/_work/PumasSystemImages/PumasSystemImages/julia_depot/packages/Pumas/Td3Jp/src/estimation/bayes/logdensity.jl:332
[9] macro expansion
@ /build/_work/PumasSystemImages/PumasSystemImages/julia_depot/packages/Pumas/Td3Jp/src/estimation/bayes/logdensity.jl:432 [inlined]
[10] macro expansion
@ ./simdloop.jl:77 [inlined]
[11] batch_mapreduce
@ /build/_work/PumasSystemImages/PumasSystemImages/julia_depot/packages/Pumas/Td3Jp/src/estimation/bayes/logdensity.jl:430 [inlined]
[12] (::Pumas.var"#711#712"{Float64, UnitRange{Int64}, Pumas.var"#707#708"{Float64, Pumas.ThreadedBayesLogDensity{PumasModel{(tvcl_other = 1, tvcl_GF = 1, tvvc = 1, tvq = 1, tvvp = 1, tvka = 1, tvlag = 1, LBM_exp = 1, C_1 = 1, Ω_1 = 2, C_2 = 1, Ω_2 = 2, ω²η = 1, σ²_prop = 1), 7, (:Depot, :Central, :Peripheral), ParamSet{NamedTuple{(:tvcl_other, :tvcl_GF, :tvvc, :tvq, :tvvp, :tvka, :tvlag, :LBM_exp, :C_1, :Ω_1, :C_2, :Ω_2, :ω²η, :σ²_prop), Tuple{LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LKJCholesky{Float64}, Constrained{DiagNormal, VectorDomain{Vector{Float64}, Vector{TransformVariables.Infinity{true}}, Vector{Float64}}}, LKJCholesky{Float64}, Constrained{DiagNormal, VectorDomain{Vector{Float64}, Vector{TransformVariables.Infinity{true}}, Vector{Float64}}}, InverseGamma{Float64}, RealDomain{Float64, TransformVariables.Infinity{true}, Float64}}}}, var"#23#32", Pumas.TimeDispatcher{var"#24#33", var"#25#34"}, Pumas.TimeDispatcher{var"#27#36", var"#28#37"}, var"#29#38", Depots1Central1Periph1, var"#30#39", var"#31#40", Nothing}, NamedTuple{(:tvcl_other, :tvcl_GF, :tvvc, :tvq, :tvvp, :tvka, :tvlag, :LBM_exp, :C_1, :Ω_1, :C_2, :Ω_2, :ω²η, :σ²_prop), Tuple{Float64, Float64, Float64, Float64, Float64, Float64, Float64, Float64, Matrix{Float64}, Vector{Float64}, Matrix{Float64}, Vector{Float64}, Float64, Float64}}, Vector{Subject{NamedTuple{(:dv,), Tuple{Vector{Union{Missing, Float64}}}}, Pumas.ConstantInterpolationStructArray{Vector{Float64}, NamedTuple{(:CrCL, :LBM, :OCC), Tuple{Vector{Float64}, Vector{Float64}, Vector{Int64}}}, Symbol}, Vector{Pumas.Event{Float64, Float64, Float64, Float64, Float64, Float64, Int64}}, Vector{Float64}}}, Vector{Vector{Float64}}, Vector{Vector{Float64}}, Vector{ForwardDiff.GradientConfig{ForwardDiff.Tag{Pumas.Tag, Float64}, Float64, 8, Vector{ForwardDiff.Dual{ForwardDiff.Tag{Pumas.Tag, Float64}, Float64, 8}}}}, Vector{DiffResults.MutableDiffResult{1, Float64, Tuple{Vector{Float64}}}}, NamedTuple{(), Tuple{}}}, Vector{Float64}, NamedTuple{(:tvcl_other, :tvcl_GF, :tvvc, :tvq, :tvvp, :tvka, :tvlag, :LBM_exp, :C_1, :Ω_1, :C_2, :Ω_2, :ω²η, :σ²_prop), Tuple{Float64, Float64, Float64, Float64, Float64, Float64, Float64, Float64, Pumas.CorrMat{Float64, PDMats.PDMat{Float64, Matrix{Float64}}}, Vector{Float64}, Pumas.CorrMat{Float64, PDMats.PDMat{Float64, Matrix{Float64}}}, Vector{Float64}, Float64, Float64}}}, typeof(+), Tuple{UnitRange{Int64}}, Tuple{}})()
``````

What are the initial values that are you passing to `fit`?

Hello, @storopoli

I used the following values for my initial values:

``````params = (tvcl_other = 7.97,
tvcl_GF = 8.52,
tvvc = 122.7,
tvq = 10.1,
tvvp = 97.9,
tvka = 2.15,
tvlag = 0.22,
LBM_exp = 0.92,
C_1 = [1 0.83; 0.83 1],
C_2 = [1 -0.79; -0.79 1],
Ω_1 = [0.114, 0.081],
Ω_2 = [0.047, 0.0056],
ω²η = 1.0006437368552639,
σ²_prop = 0.06541313854823212,)
``````

However, I have found the cause of the problem elsewhere.

When I modified the lags in the dosecontrol block as shown below, rather than using `tvlag * exp(η_2[2])`,
the estimation proceeded successfully.
Modified lags: `lags = (Depot = tvlag * exp( (Diagonal(Ω_2) * (getchol(C_2).L * ηstd_2))[2] ) ,)`
So, is it impossible to use `exp(η_2[2])` within the lags when using the LKJ distribution?
It was not a problem when using the inverse Wishart distribution.

Separate from this, I still have an unresolved question.

1. ω value
I wonder if I use input whether SD or SD^2 for the diagonal element in ω?

I saw the following code in the tutorial
(https://tutorials.pumas.ai/html/bayesian/02-bayes_random_effects.html):
`ω ~ Constrained( MvNormal(zeros(2), Diagonal(0.4^2 * ones(2))); lower=zeros(2), upper=fill(Inf, 2), init=ones(2) )`
Is this correct, assuming a prior SD of 0.4?

When considering the results of this calculation (`η = Diagonal(ω) * (getchol(C).L * ηstd`)),
I’m wondering why the value 0.4^2 was used for the diagonal elements in ω instead of 0.4, given that the SD is 0.4.

I am still curious about how to adjust the strength of correlation.

When considering the arguments `d` and `eta` in the LKJCholesky function (`LKJCholesky(d, eta)`), there doesn’t seem to be a direct place to reflect the correlation value.
I am wondering if I want to make a strong informative prior, where to reflect the correlation value, such as 0.8 or -0.7.

What happens if you give a `float.(Matrix(I(2)))` initial value to all your `C` matrices?

squared

Just use a non-informative prior, like `LKJCholesky(d, 1.0)` or maybe `LKJCholesky(d, 2.0)` and let the MCMC sampler do his job.
If there’s signal in your data and your model has no major flaws, then it will converge to the true values of `C`.
These kind of priors don’t get in the way of the likelihood (signal in the data) when estimating the correlation matrix.

If you experience issues with these non-informative priors, then check section 3.10 of our new Bayesian Workflow pre-print [2304.04752] A Practitioner's Guide to Bayesian Inference in Pharmacometrics using Pumas

Thank you for your prompt response.
Many of my questions have been resolved.

As your advice, I set the initial values for both `C_1` and `C_2` to `float.(Matrix(I(2)))`.
However, I am still encountering the error message when `lags = (Depot = tvlag * exp(η_2[2]))`.
It seems to be the same error message.

``````[ Info: Checking the initial parameter values.
Stacktrace:
[1] wait
[2] fetch
[3] __tmapreduce(f::Pumas.var"#707#708"{Float64, Pumas.ThreadedBayesLogDensity{PumasModel{(tvcl_other = 1, tvcl_GF = 1, tvvc = 1, tvq = 1, tvvp = 1, tvka = 1, tvlag = 1, LBM_exp = 1, C_1 = 1, Ω_1 = 2, C_2 = 1, Ω_2 = 2, ω²η = 1, σ²_prop = 1), 7, (:Depot, :Central, :Peripheral), ParamSet{NamedTuple{(:tvcl_other, :tvcl_GF, :tvvc, :tvq, :tvvp, :tvka, :tvlag, :LBM_exp, :C_1, :Ω_1, :C_2, :Ω_2, :ω²η, :σ²_prop), Tuple{LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LKJCholesky{Float64}, Constrained{DiagNormal, VectorDomain{Vector{Float64}, Vector{TransformVariables.Infinity{true}}, Vector{Float64}}}, LKJCholesky{Float64}, Constrained{DiagNormal, VectorDomain{Vector{Float64}, Vector{TransformVariables.Infinity{true}}, Vector{Float64}}}, InverseGamma{Float64}, RealDomain{Float64, TransformVariables.Infinity{true}, Float64}}}}, var"#23#32", Pumas.TimeDispatcher{var"#24#33", var"#25#34"}, Pumas.TimeDispatcher{var"#27#36", var"#28#37"}, var"#29#38", Depots1Central1Periph1, var"#30#39", var"#31#40", Nothing}, NamedTuple{(:tvcl_other, :tvcl_GF, :tvvc, :tvq, :tvvp, :tvka, :tvlag, :LBM_exp, :C_1, :Ω_1, :C_2, :Ω_2, :ω²η, :σ²_prop), Tuple{Float64, Float64, Float64, Float64, Float64, Float64, Float64, Float64, Matrix{Float64}, Vector{Float64}, Matrix{Float64}, Vector{Float64}, Float64, Float64}}, Vector{Subject{NamedTuple{(:dv,), Tuple{Vector{Union{Missing, Float64}}}}, Pumas.ConstantInterpolationStructArray{Vector{Float64}, NamedTuple{(:CrCL, :LBM, :OCC), Tuple{Vector{Float64}, Vector{Float64}, Vector{Int64}}}, Symbol}, Vector{Pumas.Event{Float64, Float64, Float64, Float64, Float64, Float64, Int64}}, Vector{Float64}}}, Vector{Vector{Float64}}, Vector{Vector{Float64}}, Vector{ForwardDiff.GradientConfig{ForwardDiff.Tag{Pumas.Tag, Float64}, Float64, 8, Vector{ForwardDiff.Dual{ForwardDiff.Tag{Pumas.Tag, Float64}, Float64, 8}}}}, Vector{DiffResults.MutableDiffResult{1, Float64, Tuple{Vector{Float64}}}}, NamedTuple{(), Tuple{}}}, Vector{Float64}, NamedTuple{(:tvcl_other, :tvcl_GF, :tvvc, :tvq, :tvvp, :tvka, :tvlag, :LBM_exp, :C_1, :Ω_1, :C_2, :Ω_2, :ω²η, :σ²_prop), Tuple{Float64, Float64, Float64, Float64, Float64, Float64, Float64, Float64, Pumas.CorrMat{Float64, PDMats.PDMat{Float64, Matrix{Float64}}}, Vector{Float64}, Pumas.CorrMat{Float64, PDMats.PDMat{Float64, Matrix{Float64}}}, Vector{Float64}, Float64, Float64}}}, op::typeof(+), tasks::Vector{Task}, len::Int64, init::Float64, src::Tuple{UnitRange{Int64}}, batchargs::Tuple{})
@ Pumas /build/_work/PumasSystemImages/PumasSystemImages/julia_depot/packages/Pumas/Td3Jp/src/estimation/bayes/logdensity.jl:418
[4] _tmapreduce
@ /build/_work/PumasSystemImages/PumasSystemImages/julia_depot/packages/Pumas/Td3Jp/src/estimation/bayes/logdensity.jl:440 [inlined]
@ Pumas /build/_work/PumasSystemImages/PumasSystemImages/julia_depot/packages/Pumas/Td3Jp/src/estimation/bayes/logdensity.jl:451
[6] _logdensity(b::Pumas.ThreadedBayesLogDensity{PumasModel{(tvcl_other = 1, tvcl_GF = 1, tvvc = 1, tvq = 1, tvvp = 1, tvka = 1, tvlag = 1, LBM_exp = 1, C_1 = 1, Ω_1 = 2, C_2 = 1, Ω_2 = 2, ω²η = 1, σ²_prop = 1), 7, (:Depot, :Central, :Peripheral), ParamSet{NamedTuple{(:tvcl_other, :tvcl_GF, :tvvc, :tvq, :tvvp, :tvka, :tvlag, :LBM_exp, :C_1, :Ω_1, :C_2, :Ω_2, :ω²η, :σ²_prop), Tuple{LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LKJCholesky{Float64}, Constrained{DiagNormal, VectorDomain{Vector{Float64}, Vector{TransformVariables.Infinity{true}}, Vector{Float64}}}, LKJCholesky{Float64}, Constrained{DiagNormal, VectorDomain{Vector{Float64}, Vector{TransformVariables.Infinity{true}}, Vector{Float64}}}, InverseGamma{Float64}, RealDomain{Float64, TransformVariables.Infinity{true}, Float64}}}}, var"#23#32", Pumas.TimeDispatcher{var"#24#33", var"#25#34"}, Pumas.TimeDispatcher{var"#27#36", var"#28#37"}, var"#29#38", Depots1Central1Periph1, var"#30#39", var"#31#40", Nothing}, NamedTuple{(:tvcl_other, :tvcl_GF, :tvvc, :tvq, :tvvp, :tvka, :tvlag, :LBM_exp, :C_1, :Ω_1, :C_2, :Ω_2, :ω²η, :σ²_prop), Tuple{Float64, Float64, Float64, Float64, Float64, Float64, Float64, Float64, Matrix{Float64}, Vector{Float64}, Matrix{Float64}, Vector{Float64}, Float64, Float64}}, Vector{Subject{NamedTuple{(:dv,), Tuple{Vector{Union{Missing, Float64}}}}, Pumas.ConstantInterpolationStructArray{Vector{Float64}, NamedTuple{(:CrCL, :LBM, :OCC), Tuple{Vector{Float64}, Vector{Float64}, Vector{Int64}}}, Symbol}, Vector{Pumas.Event{Float64, Float64, Float64, Float64, Float64, Float64, Int64}}, Vector{Float64}}}, Vector{Vector{Float64}}, Vector{Vector{Float64}}, Vector{ForwardDiff.GradientConfig{ForwardDiff.Tag{Pumas.Tag, Float64}, Float64, 8, Vector{ForwardDiff.Dual{ForwardDiff.Tag{Pumas.Tag, Float64}, Float64, 8}}}}, Vector{DiffResults.MutableDiffResult{1, Float64, Tuple{Vector{Float64}}}}, NamedTuple{(), Tuple{}}}, v::Vector{Float64})
@ Pumas /build/_work/PumasSystemImages/PumasSystemImages/julia_depot/packages/Pumas/Td3Jp/src/estimation/bayes/logdensity.jl:324
[7] _check_initial_values(bayes::Pumas.ThreadedBayesLogDensity{PumasModel{(tvcl_other = 1, tvcl_GF = 1, tvvc = 1, tvq = 1, tvvp = 1, tvka = 1, tvlag = 1, LBM_exp = 1, C_1 = 1, Ω_1 = 2, C_2 = 1, Ω_2 = 2, ω²η = 1, σ²_prop = 1), 7, (:Depot, :Central, :Peripheral), ParamSet{NamedTuple{(:tvcl_other, :tvcl_GF, :tvvc, :tvq, :tvvp, :tvka, :tvlag, :LBM_exp, :C_1, :Ω_1, :C_2, :Ω_2, :ω²η, :σ²_prop), Tuple{LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LKJCholesky{Float64}, Constrained{DiagNormal, VectorDomain{Vector{Float64}, Vector{TransformVariables.Infinity{true}}, Vector{Float64}}}, LKJCholesky{Float64}, Constrained{DiagNormal, VectorDomain{Vector{Float64}, Vector{TransformVariables.Infinity{true}}, Vector{Float64}}}, InverseGamma{Float64}, RealDomain{Float64, TransformVariables.Infinity{true}, Float64}}}}, var"#23#32", Pumas.TimeDispatcher{var"#24#33", var"#25#34"}, Pumas.TimeDispatcher{var"#27#36", var"#28#37"}, var"#29#38", Depots1Central1Periph1, var"#30#39", var"#31#40", Nothing}, NamedTuple{(:tvcl_other, :tvcl_GF, :tvvc, :tvq, :tvvp, :tvka, :tvlag, :LBM_exp, :C_1, :Ω_1, :C_2, :Ω_2, :ω²η, :σ²_prop), Tuple{Float64, Float64, Float64, Float64, Float64, Float64, Float64, Float64, Matrix{Float64}, Vector{Float64}, Matrix{Float64}, Vector{Float64}, Float64, Float64}}, Vector{Subject{NamedTuple{(:dv,), Tuple{Vector{Union{Missing, Float64}}}}, Pumas.ConstantInterpolationStructArray{Vector{Float64}, NamedTuple{(:CrCL, :LBM, :OCC), Tuple{Vector{Float64}, Vector{Float64}, Vector{Int64}}}, Symbol}, Vector{Pumas.Event{Float64, Float64, Float64, Float64, Float64, Float64, Int64}}, Vector{Float64}}}, Vector{Vector{Float64}}, Vector{Vector{Float64}}, Vector{ForwardDiff.GradientConfig{ForwardDiff.Tag{Pumas.Tag, Float64}, Float64, 8, Vector{ForwardDiff.Dual{ForwardDiff.Tag{Pumas.Tag, Float64}, Float64, 8}}}}, Vector{DiffResults.MutableDiffResult{1, Float64, Tuple{Vector{Float64}}}}, NamedTuple{(), Tuple{}}}, vparam_aug::Vector{Float64})
@ Pumas /build/_work/PumasSystemImages/PumasSystemImages/julia_depot/packages/Pumas/Td3Jp/src/estimation/bayes/nuts.jl:393
[8] pumas_sample(rngs::Vector{Xoshiro}, bayes::Vector{Pumas.ThreadedBayesLogDensity{PumasModel{(tvcl_other = 1, tvcl_GF = 1, tvvc = 1, tvq = 1, tvvp = 1, tvka = 1, tvlag = 1, LBM_exp = 1, C_1 = 1, Ω_1 = 2, C_2 = 1, Ω_2 = 2, ω²η = 1, σ²_prop = 1), 7, (:Depot, :Central, :Peripheral), ParamSet{NamedTuple{(:tvcl_other, :tvcl_GF, :tvvc, :tvq, :tvvp, :tvka, :tvlag, :LBM_exp, :C_1, :Ω_1, :C_2, :Ω_2, :ω²η, :σ²_prop), Tuple{LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LKJCholesky{Float64}, Constrained{DiagNormal, VectorDomain{Vector{Float64}, Vector{TransformVariables.Infinity{true}}, Vector{Float64}}}, LKJCholesky{Float64}, Constrained{DiagNormal, VectorDomain{Vector{Float64}, Vector{TransformVariables.Infinity{true}}, Vector{Float64}}}, InverseGamma{Float64}, RealDomain{Float64, TransformVariables.Infinity{true}, Float64}}}}, var"#23#32", Pumas.TimeDispatcher{var"#24#33", var"#25#34"}, Pumas.TimeDispatcher{var"#27#36", var"#28#37"}, var"#29#38", Depots1Central1Periph1, var"#30#39", var"#31#40", Nothing}, NamedTuple{(:tvcl_other, :tvcl_GF, :tvvc, :tvq, :tvvp, :tvka, :tvlag, :LBM_exp, :C_1, :Ω_1, :C_2, :Ω_2, :ω²η, :σ²_prop), Tuple{Float64, Float64, Float64, Float64, Float64, Float64, Float64, Float64, Matrix{Float64}, Vector{Float64}, Matrix{Float64}, Vector{Float64}, Float64, Float64}}, Vector{Subject{NamedTuple{(:dv,), Tuple{Vector{Union{Missing, Float64}}}}, Pumas.ConstantInterpolationStructArray{Vector{Float64}, NamedTuple{(:CrCL, :LBM, :OCC), Tuple{Vector{Float64}, Vector{Float64}, Vector{Int64}}}, Symbol}, Vector{Pumas.Event{Float64, Float64, Float64, Float64, Float64, Float64, Int64}}, Vector{Float64}}}, Vector{Vector{Float64}}, Vector{Vector{Float64}}, Vector{ForwardDiff.GradientConfig{ForwardDiff.Tag{Pumas.Tag, Float64}, Float64, 8, Vector{ForwardDiff.Dual{ForwardDiff.Tag{Pumas.Tag, Float64}, Float64, 8}}}}, Vector{DiffResults.MutableDiffResult{1, Float64, Tuple{Vector{Float64}}}}, NamedTuple{(), Tuple{}}}}, ::EnsembleThreads, nsamples::Int64, ess_per_chain::Int64, time_limit::Float64; ess_every::Int64, progress::Bool, balance_method::Symbol, update_progress_every::Int64, alg::AdvancedHMC.GeneralisedNoUTurn{Float64}, constantcoef::NamedTuple{(), Tuple{}}, kwargs::Base.Pairs{Symbol, Union{Nothing, Integer}, Tuple{Symbol, Symbol, Symbol}, NamedTuple{(:nadapts, :procs, :check_initial), Tuple{Int64, Nothing, Bool}}})
@ Pumas /build/_work/PumasSystemImages/PumasSystemImages/julia_depot/packages/Pumas/Td3Jp/src/estimation/bayes/nuts.jl:532
[9] _fit_mcmc(model::PumasModel{(tvcl_other = 1, tvcl_GF = 1, tvvc = 1, tvq = 1, tvvp = 1, tvka = 1, tvlag = 1, LBM_exp = 1, C_1 = 1, Ω_1 = 2, C_2 = 1, Ω_2 = 2, ω²η = 1, σ²_prop = 1), 7, (:Depot, :Central, :Peripheral), ParamSet{NamedTuple{(:tvcl_other, :tvcl_GF, :tvvc, :tvq, :tvvp, :tvka, :tvlag, :LBM_exp, :C_1, :Ω_1, :C_2, :Ω_2, :ω²η, :σ²_prop), Tuple{LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LKJCholesky{Float64}, Constrained{DiagNormal, VectorDomain{Vector{Float64}, Vector{TransformVariables.Infinity{true}}, Vector{Float64}}}, LKJCholesky{Float64}, Constrained{DiagNormal, VectorDomain{Vector{Float64}, Vector{TransformVariables.Infinity{true}}, Vector{Float64}}}, InverseGamma{Float64}, RealDomain{Float64, TransformVariables.Infinity{true}, Float64}}}}, var"#23#32", Pumas.TimeDispatcher{var"#24#33", var"#25#34"}, Pumas.TimeDispatcher{var"#27#36", var"#28#37"}, var"#29#38", Depots1Central1Periph1, var"#30#39", var"#31#40", Nothing}, data::Vector{Subject{NamedTuple{(:dv,), Tuple{Vector{Union{Missing, Float64}}}}, Pumas.ConstantInterpolationStructArray{Vector{Float64}, NamedTuple{(:CrCL, :LBM, :OCC), Tuple{Vector{Float64}, Vector{Float64}, Vector{Int64}}}, Symbol}, Vector{Pumas.Event{Float64, Float64, Float64, Float64, Float64, Float64, Int64}}, Vector{Float64}}}, param::NamedTuple{(:tvcl_other, :tvcl_GF, :tvvc, :tvq, :tvvp, :tvka, :tvlag, :LBM_exp, :C_1, :Ω_1, :C_2, :Ω_2, :ω²η, :σ²_prop), Tuple{Float64, Float64, Float64, Float64, Float64, Float64, Float64, Float64, Matrix{Float64}, Vector{Float64}, Matrix{Float64}, Vector{Float64}, Float64, Float64}}, callback_update_thread::Int64, callback_update_process::Int64, ensemblealg::EnsembleThreads, parallel_subjects::Bool, parallel_chains::Bool, alg::BayesMCMC{AdvancedHMC.GeneralisedNoUTurn{Float64}, Float64, Int64, Int64, Int64, Int64, Int64, Float64, EnsembleThreads, Bool, Bool, Bool, Bool, TaskLocalRNG, NamedTuple{(), Tuple{}}, Bool, Int64, NamedTuple{(), Tuple{}}})
@ Pumas /build/_work/PumasSystemImages/PumasSystemImages/julia_depot/packages/Pumas/Td3Jp/src/estimation/bayes/nuts.jl:336
[10] _fit(model::PumasModel{(tvcl_other = 1, tvcl_GF = 1, tvvc = 1, tvq = 1, tvvp = 1, tvka = 1, tvlag = 1, LBM_exp = 1, C_1 = 1, Ω_1 = 2, C_2 = 1, Ω_2 = 2, ω²η = 1, σ²_prop = 1), 7, (:Depot, :Central, :Peripheral), ParamSet{NamedTuple{(:tvcl_other, :tvcl_GF, :tvvc, :tvq, :tvvp, :tvka, :tvlag, :LBM_exp, :C_1, :Ω_1, :C_2, :Ω_2, :ω²η, :σ²_prop), Tuple{LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LKJCholesky{Float64}, Constrained{DiagNormal, VectorDomain{Vector{Float64}, Vector{TransformVariables.Infinity{true}}, Vector{Float64}}}, LKJCholesky{Float64}, Constrained{DiagNormal, VectorDomain{Vector{Float64}, Vector{TransformVariables.Infinity{true}}, Vector{Float64}}}, InverseGamma{Float64}, RealDomain{Float64, TransformVariables.Infinity{true}, Float64}}}}, var"#23#32", Pumas.TimeDispatcher{var"#24#33", var"#25#34"}, Pumas.TimeDispatcher{var"#27#36", var"#28#37"}, var"#29#38", Depots1Central1Periph1, var"#30#39", var"#31#40", Nothing}, data::Vector{Subject{NamedTuple{(:dv,), Tuple{Vector{Union{Missing, Float64}}}}, Pumas.ConstantInterpolationStructArray{Vector{Float64}, NamedTuple{(:CrCL, :LBM, :OCC), Tuple{Vector{Float64}, Vector{Float64}, Vector{Int64}}}, Symbol}, Vector{Pumas.Event{Float64, Float64, Float64, Float64, Float64, Float64, Int64}}, Vector{Float64}}}, param::NamedTuple{(:tvcl_other, :tvcl_GF, :tvvc, :tvq, :tvvp, :tvka, :tvlag, :LBM_exp, :C_1, :Ω_1, :C_2, :Ω_2, :ω²η, :σ²_prop), Tuple{Float64, Float64, Float64, Float64, Float64, Float64, Float64, Float64, Matrix{Float64}, Vector{Float64}, Matrix{Float64}, Vector{Float64}, Float64, Float64}}, alg::BayesMCMC{AdvancedHMC.GeneralisedNoUTurn{Float64}, Float64, Int64, Int64, Int64, Int64, Int64, Float64, EnsembleThreads, Bool, Bool, Bool, Bool, TaskLocalRNG, NamedTuple{(), Tuple{}}, Bool, Int64, NamedTuple{(), Tuple{}}})
@ Pumas /build/_work/PumasSystemImages/PumasSystemImages/julia_depot/packages/Pumas/Td3Jp/src/estimation/bayes/nuts.jl:230
[11] #fit#769
@ /build/_work/PumasSystemImages/PumasSystemImages/julia_depot/packages/Pumas/Td3Jp/src/estimation/bayes/nuts.jl:156 [inlined]
[12] fit(model::PumasModel{(tvcl_other = 1, tvcl_GF = 1, tvvc = 1, tvq = 1, tvvp = 1, tvka = 1, tvlag = 1, LBM_exp = 1, C_1 = 1, Ω_1 = 2, C_2 = 1, Ω_2 = 2, ω²η = 1, σ²_prop = 1), 7, (:Depot, :Central, :Peripheral), ParamSet{NamedTuple{(:tvcl_other, :tvcl_GF, :tvvc, :tvq, :tvvp, :tvka, :tvlag, :LBM_exp, :C_1, :Ω_1, :C_2, :Ω_2, :ω²η, :σ²_prop), Tuple{LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LKJCholesky{Float64}, Constrained{DiagNormal, VectorDomain{Vector{Float64}, Vector{TransformVariables.Infinity{true}}, Vector{Float64}}}, LKJCholesky{Float64}, Constrained{DiagNormal, VectorDomain{Vector{Float64}, Vector{TransformVariables.Infinity{true}}, Vector{Float64}}}, InverseGamma{Float64}, RealDomain{Float64, TransformVariables.Infinity{true}, Float64}}}}, var"#23#32", Pumas.TimeDispatcher{var"#24#33", var"#25#34"}, Pumas.TimeDispatcher{var"#27#36", var"#28#37"}, var"#29#38", Depots1Central1Periph1, var"#30#39", var"#31#40", Nothing}, data::Vector{Subject{NamedTuple{(:dv,), Tuple{Vector{Union{Missing, Float64}}}}, Pumas.ConstantInterpolationStructArray{Vector{Float64}, NamedTuple{(:CrCL, :LBM, :OCC), Tuple{Vector{Float64}, Vector{Float64}, Vector{Int64}}}, Symbol}, Vector{Pumas.Event{Float64, Float64, Float64, Float64, Float64, Float64, Int64}}, Vector{Float64}}}, param::NamedTuple{(:tvcl_other, :tvcl_GF, :tvvc, :tvq, :tvvp, :tvka, :tvlag, :LBM_exp, :C_1, :C_2, :Ω_1, :Ω_2, :ω²η, :σ²_prop), Tuple{Float64, Float64, Float64, Float64, Float64, Float64, Float64, Float64, Matrix{Float64}, Matrix{Float64}, Vector{Float64}, Vector{Float64}, Float64, Float64}}, alg::BayesMCMC{AdvancedHMC.GeneralisedNoUTurn{Float64}, Float64, Int64, Int64, Missing, Missing, Missing, Missing, Missing, Missing, Missing, Missing, Missing, Missing, Missing, Missing, Missing, NamedTuple{(), Tuple{}}})
@ Pumas /build/_work/PumasSystemImages/PumasSystemImages/julia_depot/packages/Pumas/Td3Jp/src/estimation/bayes/nuts.jl:155
[13] top-level scope
@ ~/data/code/Veliparib/Bayes_PK/src/test_2.jl:164

nested task error: UndefVarError: η_2 not defined
Stacktrace:
[1] (::var"#28#37")(_param#472::NamedTuple{(:tvcl_other, :tvcl_GF, :tvvc, :tvq, :tvvp, :tvka, :tvlag, :LBM_exp, :C_1, :Ω_1, :C_2, :Ω_2, :ω²η, :σ²_prop), Tuple{Float64, Float64, Float64, Float64, Float64, Float64, Float64, Float64, Pumas.CorrMat{Float64, PDMats.PDMat{Float64, Matrix{Float64}}}, Vector{Float64}, Pumas.CorrMat{Float64, PDMats.PDMat{Float64, Matrix{Float64}}}, Vector{Float64}, Float64, Float64}}, _random#473::NamedTuple{(:ηstd_1, :ηstd_2, :η_BOV), Tuple{Vector{Float64}, Vector{Float64}, Vector{Float64}}}, _subject#470::Subject{NamedTuple{(:dv,), Tuple{Vector{Union{Missing, Float64}}}}, Pumas.ConstantInterpolationStructArray{Vector{Float64}, NamedTuple{(:CrCL, :LBM, :OCC), Tuple{Vector{Float64}, Vector{Float64}, Vector{Int64}}}, Symbol}, Vector{Pumas.Event{Float64, Float64, Float64, Float64, Float64, Float64, Int64}}, Vector{Float64}})
@ Main /build/_work/PumasSystemImages/PumasSystemImages/julia_depot/packages/Pumas/Td3Jp/src/dsl/model_macro.jl:788
[2] TimeDispatcher
@ /build/_work/PumasSystemImages/PumasSystemImages/julia_depot/packages/Pumas/Td3Jp/src/dsl/model_macro.jl:471 [inlined]
[3] TimeDispatcher
@ /build/_work/PumasSystemImages/PumasSystemImages/julia_depot/packages/Pumas/Td3Jp/src/dsl/model_macro.jl:465 [inlined]
[4] dcp(model::PumasModel{(tvcl_other = 1, tvcl_GF = 1, tvvc = 1, tvq = 1, tvvp = 1, tvka = 1, tvlag = 1, LBM_exp = 1, C_1 = 1, Ω_1 = 2, C_2 = 1, Ω_2 = 2, ω²η = 1, σ²_prop = 1), 7, (:Depot, :Central, :Peripheral), ParamSet{NamedTuple{(:tvcl_other, :tvcl_GF, :tvvc, :tvq, :tvvp, :tvka, :tvlag, :LBM_exp, :C_1, :Ω_1, :C_2, :Ω_2, :ω²η, :σ²_prop), Tuple{LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LKJCholesky{Float64}, Constrained{DiagNormal, VectorDomain{Vector{Float64}, Vector{TransformVariables.Infinity{true}}, Vector{Float64}}}, LKJCholesky{Float64}, Constrained{DiagNormal, VectorDomain{Vector{Float64}, Vector{TransformVariables.Infinity{true}}, Vector{Float64}}}, InverseGamma{Float64}, RealDomain{Float64, TransformVariables.Infinity{true}, Float64}}}}, var"#23#32", Pumas.TimeDispatcher{var"#24#33", var"#25#34"}, Pumas.TimeDispatcher{var"#27#36", var"#28#37"}, var"#29#38", Depots1Central1Periph1, var"#30#39", var"#31#40", Nothing}, subject::Subject{NamedTuple{(:dv,), Tuple{Vector{Union{Missing, Float64}}}}, Pumas.ConstantInterpolationStructArray{Vector{Float64}, NamedTuple{(:CrCL, :LBM, :OCC), Tuple{Vector{Float64}, Vector{Float64}, Vector{Int64}}}, Symbol}, Vector{Pumas.Event{Float64, Float64, Float64, Float64, Float64, Float64, Int64}}, Vector{Float64}}, param::NamedTuple{(:tvcl_other, :tvcl_GF, :tvvc, :tvq, :tvvp, :tvka, :tvlag, :LBM_exp, :C_1, :Ω_1, :C_2, :Ω_2, :ω²η, :σ²_prop), Tuple{Float64, Float64, Float64, Float64, Float64, Float64, Float64, Float64, Pumas.CorrMat{Float64, PDMats.PDMat{Float64, Matrix{Float64}}}, Vector{Float64}, Pumas.CorrMat{Float64, PDMats.PDMat{Float64, Matrix{Float64}}}, Vector{Float64}, Float64, Float64}}, randeffs::NamedTuple{(:ηstd_1, :ηstd_2, :η_BOV), Tuple{Vector{Float64}, Vector{Float64}, Vector{Float64}}})
@ Pumas /build/_work/PumasSystemImages/PumasSystemImages/julia_depot/packages/Pumas/Td3Jp/src/models/model_api.jl:2146
[5] #_derived#317
@ /build/_work/PumasSystemImages/PumasSystemImages/julia_depot/packages/Pumas/Td3Jp/src/models/model_api.jl:1257 [inlined]
[6] #conditional_nll#496
@ /build/_work/PumasSystemImages/PumasSystemImages/julia_depot/packages/Pumas/Td3Jp/src/estimation/likelihoods.jl:862 [inlined]
[7] _penalized_conditional_nll(model::PumasModel{(tvcl_other = 1, tvcl_GF = 1, tvvc = 1, tvq = 1, tvvp = 1, tvka = 1, tvlag = 1, LBM_exp = 1, C_1 = 1, Ω_1 = 2, C_2 = 1, Ω_2 = 2, ω²η = 1, σ²_prop = 1), 7, (:Depot, :Central, :Peripheral), ParamSet{NamedTuple{(:tvcl_other, :tvcl_GF, :tvvc, :tvq, :tvvp, :tvka, :tvlag, :LBM_exp, :C_1, :Ω_1, :C_2, :Ω_2, :ω²η, :σ²_prop), Tuple{LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LKJCholesky{Float64}, Constrained{DiagNormal, VectorDomain{Vector{Float64}, Vector{TransformVariables.Infinity{true}}, Vector{Float64}}}, LKJCholesky{Float64}, Constrained{DiagNormal, VectorDomain{Vector{Float64}, Vector{TransformVariables.Infinity{true}}, Vector{Float64}}}, InverseGamma{Float64}, RealDomain{Float64, TransformVariables.Infinity{true}, Float64}}}}, var"#23#32", Pumas.TimeDispatcher{var"#24#33", var"#25#34"}, Pumas.TimeDispatcher{var"#27#36", var"#28#37"}, var"#29#38", Depots1Central1Periph1, var"#30#39", var"#31#40", Nothing}, subject::Subject{NamedTuple{(:dv,), Tuple{Vector{Union{Missing, Float64}}}}, Pumas.ConstantInterpolationStructArray{Vector{Float64}, NamedTuple{(:CrCL, :LBM, :OCC), Tuple{Vector{Float64}, Vector{Float64}, Vector{Int64}}}, Symbol}, Vector{Pumas.Event{Float64, Float64, Float64, Float64, Float64, Float64, Int64}}, Vector{Float64}}, param::NamedTuple{(:tvcl_other, :tvcl_GF, :tvvc, :tvq, :tvvp, :tvka, :tvlag, :LBM_exp, :C_1, :Ω_1, :C_2, :Ω_2, :ω²η, :σ²_prop), Tuple{Float64, Float64, Float64, Float64, Float64, Float64, Float64, Float64, Pumas.CorrMat{Float64, PDMats.PDMat{Float64, Matrix{Float64}}}, Vector{Float64}, Pumas.CorrMat{Float64, PDMats.PDMat{Float64, Matrix{Float64}}}, Vector{Float64}, Float64, Float64}}, vrandeffsorth::SubArray{Float64, 1, Vector{Float64}, Tuple{UnitRange{Int64}}, true}, diffeq_options::NamedTuple{(), Tuple{}})
@ Pumas /build/_work/PumasSystemImages/PumasSystemImages/julia_depot/packages/Pumas/Td3Jp/src/estimation/likelihoods.jl:920
[8] (::Pumas.var"#707#708"{Float64, Pumas.ThreadedBayesLogDensity{PumasModel{(tvcl_other = 1, tvcl_GF = 1, tvvc = 1, tvq = 1, tvvp = 1, tvka = 1, tvlag = 1, LBM_exp = 1, C_1 = 1, Ω_1 = 2, C_2 = 1, Ω_2 = 2, ω²η = 1, σ²_prop = 1), 7, (:Depot, :Central, :Peripheral), ParamSet{NamedTuple{(:tvcl_other, :tvcl_GF, :tvvc, :tvq, :tvvp, :tvka, :tvlag, :LBM_exp, :C_1, :Ω_1, :C_2, :Ω_2, :ω²η, :σ²_prop), Tuple{LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LKJCholesky{Float64}, Constrained{DiagNormal, VectorDomain{Vector{Float64}, Vector{TransformVariables.Infinity{true}}, Vector{Float64}}}, LKJCholesky{Float64}, Constrained{DiagNormal, VectorDomain{Vector{Float64}, Vector{TransformVariables.Infinity{true}}, Vector{Float64}}}, InverseGamma{Float64}, RealDomain{Float64, TransformVariables.Infinity{true}, Float64}}}}, var"#23#32", Pumas.TimeDispatcher{var"#24#33", var"#25#34"}, Pumas.TimeDispatcher{var"#27#36", var"#28#37"}, var"#29#38", Depots1Central1Periph1, var"#30#39", var"#31#40", Nothing}, NamedTuple{(:tvcl_other, :tvcl_GF, :tvvc, :tvq, :tvvp, :tvka, :tvlag, :LBM_exp, :C_1, :Ω_1, :C_2, :Ω_2, :ω²η, :σ²_prop), Tuple{Float64, Float64, Float64, Float64, Float64, Float64, Float64, Float64, Matrix{Float64}, Vector{Float64}, Matrix{Float64}, Vector{Float64}, Float64, Float64}}, Vector{Subject{NamedTuple{(:dv,), Tuple{Vector{Union{Missing, Float64}}}}, Pumas.ConstantInterpolationStructArray{Vector{Float64}, NamedTuple{(:CrCL, :LBM, :OCC), Tuple{Vector{Float64}, Vector{Float64}, Vector{Int64}}}, Symbol}, Vector{Pumas.Event{Float64, Float64, Float64, Float64, Float64, Float64, Int64}}, Vector{Float64}}}, Vector{Vector{Float64}}, Vector{Vector{Float64}}, Vector{ForwardDiff.GradientConfig{ForwardDiff.Tag{Pumas.Tag, Float64}, Float64, 8, Vector{ForwardDiff.Dual{ForwardDiff.Tag{Pumas.Tag, Float64}, Float64, 8}}}}, Vector{DiffResults.MutableDiffResult{1, Float64, Tuple{Vector{Float64}}}}, NamedTuple{(), Tuple{}}}, Vector{Float64}, NamedTuple{(:tvcl_other, :tvcl_GF, :tvvc, :tvq, :tvvp, :tvka, :tvlag, :LBM_exp, :C_1, :Ω_1, :C_2, :Ω_2, :ω²η, :σ²_prop), Tuple{Float64, Float64, Float64, Float64, Float64, Float64, Float64, Float64, Pumas.CorrMat{Float64, PDMats.PDMat{Float64, Matrix{Float64}}}, Vector{Float64}, Pumas.CorrMat{Float64, PDMats.PDMat{Float64, Matrix{Float64}}}, Vector{Float64}, Float64, Float64}}})(i::Int64)
@ Pumas /build/_work/PumasSystemImages/PumasSystemImages/julia_depot/packages/Pumas/Td3Jp/src/estimation/bayes/logdensity.jl:332
[9] macro expansion
@ /build/_work/PumasSystemImages/PumasSystemImages/julia_depot/packages/Pumas/Td3Jp/src/estimation/bayes/logdensity.jl:432 [inlined]
[10] macro expansion
@ ./simdloop.jl:77 [inlined]
[11] batch_mapreduce
@ /build/_work/PumasSystemImages/PumasSystemImages/julia_depot/packages/Pumas/Td3Jp/src/estimation/bayes/logdensity.jl:430 [inlined]
[12] (::Pumas.var"#711#712"{Float64, UnitRange{Int64}, Pumas.var"#707#708"{Float64, Pumas.ThreadedBayesLogDensity{PumasModel{(tvcl_other = 1, tvcl_GF = 1, tvvc = 1, tvq = 1, tvvp = 1, tvka = 1, tvlag = 1, LBM_exp = 1, C_1 = 1, Ω_1 = 2, C_2 = 1, Ω_2 = 2, ω²η = 1, σ²_prop = 1), 7, (:Depot, :Central, :Peripheral), ParamSet{NamedTuple{(:tvcl_other, :tvcl_GF, :tvvc, :tvq, :tvvp, :tvka, :tvlag, :LBM_exp, :C_1, :Ω_1, :C_2, :Ω_2, :ω²η, :σ²_prop), Tuple{LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LogNormal{Float64}, LKJCholesky{Float64}, Constrained{DiagNormal, VectorDomain{Vector{Float64}, Vector{TransformVariables.Infinity{true}}, Vector{Float64}}}, LKJCholesky{Float64}, Constrained{DiagNormal, VectorDomain{Vector{Float64}, Vector{TransformVariables.Infinity{true}}, Vector{Float64}}}, InverseGamma{Float64}, RealDomain{Float64, TransformVariables.Infinity{true}, Float64}}}}, var"#23#32", Pumas.TimeDispatcher{var"#24#33", var"#25#34"}, Pumas.TimeDispatcher{var"#27#36", var"#28#37"}, var"#29#38", Depots1Central1Periph1, var"#30#39", var"#31#40", Nothing}, NamedTuple{(:tvcl_other, :tvcl_GF, :tvvc, :tvq, :tvvp, :tvka, :tvlag, :LBM_exp, :C_1, :Ω_1, :C_2, :Ω_2, :ω²η, :σ²_prop), Tuple{Float64, Float64, Float64, Float64, Float64, Float64, Float64, Float64, Matrix{Float64}, Vector{Float64}, Matrix{Float64}, Vector{Float64}, Float64, Float64}}, Vector{Subject{NamedTuple{(:dv,), Tuple{Vector{Union{Missing, Float64}}}}, Pumas.ConstantInterpolationStructArray{Vector{Float64}, NamedTuple{(:CrCL, :LBM, :OCC), Tuple{Vector{Float64}, Vector{Float64}, Vector{Int64}}}, Symbol}, Vector{Pumas.Event{Float64, Float64, Float64, Float64, Float64, Float64, Int64}}, Vector{Float64}}}, Vector{Vector{Float64}}, Vector{Vector{Float64}}, Vector{ForwardDiff.GradientConfig{ForwardDiff.Tag{Pumas.Tag, Float64}, Float64, 8, Vector{ForwardDiff.Dual{ForwardDiff.Tag{Pumas.Tag, Float64}, Float64, 8}}}}, Vector{DiffResults.MutableDiffResult{1, Float64, Tuple{Vector{Float64}}}}, NamedTuple{(), Tuple{}}}, Vector{Float64}, NamedTuple{(:tvcl_other, :tvcl_GF, :tvvc, :tvq, :tvvp, :tvka, :tvlag, :LBM_exp, :C_1, :Ω_1, :C_2, :Ω_2, :ω²η, :σ²_prop), Tuple{Float64, Float64, Float64, Float64, Float64, Float64, Float64, Float64, Pumas.CorrMat{Float64, PDMats.PDMat{Float64, Matrix{Float64}}}, Vector{Float64}, Pumas.CorrMat{Float64, PDMats.PDMat{Float64, Matrix{Float64}}}, Vector{Float64}, Float64, Float64}}}, typeof(+), Tuple{UnitRange{Int64}}, Tuple{}})()
``````

When `lags = (Depot = tvlag * exp((Diagonal(Ω_2) * (getchol(C_2).L * ηstd_2))[2]))`,
I was able to start the estimation without problems when setting both `C_1` and `C_2` to `float.(Matrix(I(2)))` as the initial values.

If you have any other suggestions, I would appreciate it.

Sorry for the late response here. Is there a simulated data set you can share to help debug this?

I think these need to be defined again in the `@dosecontrol` blocks. The `@dosecontrol` block does not see what’s inside the `@pre` block.

Nice to meet you, @mohamed82008

I don’t know how to upload a CSV file here.
So I’m providing you with the code to generate simulated data.
I apologize for the inconvenience.

``````using Random
using Pumas

################# 1. Define model  #################
model_ = @model begin
desc        = "two compartment model with first-order absorption and Tlag"
end

@param begin
"Absorption Rate Constant (hr⁻¹)"
tvka        ∈ RealDomain(lower=0.000001)
"Volume of Central Compartment (L)"
tvvc        ∈ RealDomain(lower=0.000001)
"Volume of Peripheral Compartment (L)"
tvvp        ∈ RealDomain(lower=0.000001)
"Clearance (L/hr)"
tvcl_other  ∈ RealDomain(lower=0.000001)
tvcl_GF     ∈ RealDomain(lower=0.000001)
"Intercompartmental Clearance (L/hr)"
tvq         ∈ RealDomain(lower=0.000001)
"LBM exponent"
LBM_exp     ∈ RealDomain(lower=0.000001)
"Lagtime (hr)"
tvlag       ∈ RealDomain(lower=0.000001)
"BSV and BOV"
Ω_1        ∈ PSDDomain(2)
Ω_2        ∈ PSDDomain(2)
ω²η      ∈ RealDomain(lower=0.000001)
"Proportional RUV"
σ²_prop   ∈ RealDomain(lower=0.000001)
end

@random begin
η_1         ~ MvNormal(Ω_1)
η_2         ~ MvNormal(Ω_2)
η_BOV       ~ MvNormal(3, sqrt(ω²η))
end

@covariates CrCL LBM OCC

@pre begin
CL          = (tvcl_other + (tvcl_GF * (CrCL/90))) * exp(η_1[1])
Vc          = tvvc * ((LBM/55)^LBM_exp) * exp(η_1[2])
Q           = tvq
Vp          = tvvp
Ka          = tvka * exp(η_2[1]) * exp(η_BOV[OCC])
Tlag        = tvlag * exp(η_2[2])
LBM_exp_out = LBM_exp
end

@dosecontrol begin
lags = (Depot = tvlag * exp(η_2[2]),)
end

@dynamics Depots1Central1Periph1

@derived begin
cp = @. (Central/Vc)
dv ~ @. Normal(cp, sqrt((cp^2) * (σ²_prop)))
end
end

################# 2. Define model parameters   #################
function cv_to_var(x)
Var_val = log((x/100)^2+1)
return Var_val
end

BSV_Ka_Var     = cv_to_var(21.9)
BSV_Tlag_Var   = cv_to_var(7.47)
BSV_CL_Var     = cv_to_var(34.7)
BSV_Vc_Var     = cv_to_var(29.0)
BOV_Ka_Var     = cv_to_var(131.53)
WSV_Pro_Var    = cv_to_var(26)
Cov_CL_Vc      = 0.83 * sqrt(BSV_CL_Var * BSV_Vc_Var)
Cov_Ka_Tlag    = -0.79 * sqrt(BSV_Ka_Var * BSV_Tlag_Var)

param = ( tvcl_other  = 7.97,
tvcl_GF     = 8.52,
tvvc        = 122.7,
tvq         = 10.1,
tvvp        = 97.91,
tvka        = 2.15,
tvlag       = 0.22,
LBM_exp     = 0.92,
Ω_1        = [BSV_CL_Var Cov_CL_Vc
Cov_CL_Vc BSV_Vc_Var],
Ω_2        = [BSV_Ka_Var Cov_Ka_Tlag
Cov_Ka_Tlag BSV_Tlag_Var],
ω²η      = BOV_Ka_Var,
σ²_prop   = WSV_Pro_Var)

################# 3. Define subject   #################
# Dose Regimem
group_n = 15
Dose = 80
ev  = DosageRegimen(Dose, ii=12, addl = 21*2 - 1, cmt = 1)

# Demographics
LBM = rand(truncated(Normal(53.6, 10.5), 33.67, 78.5), group_n)
CrCL = rand(truncated(Normal(90.5, 23.9), 32.1, 120), group_n)

# Time
time_obs = [24*7, 24*14, 24*21]
occ = [1,2,3]

# Population covariates
pop_with_covariates = map(
i -> Subject(;
id=i,
events = ev,
time = time_obs,
covariates_time = time_obs,
covariates=(
LBM = fill(LBM[i], length(time_obs)),
CrCL = fill(CrCL[i],length(time_obs)),
OCC = occ),
observations = (; dv=nothing),
),
1:group_n,
)

################# 4. Simulate #################
Random.seed!(1234)
sim_sub = simobs(model_, pop_with_covariates, param, obstimes=time_obs)
``````
1 Like

I understand what you said.
As mentioned earlier, I realized how the estimation works when modifying the dose control block.

Thank you for your interest in my issue.

1 Like