Round Tripping Error

Hi I am trying to perform some re-fitting using a basic simulation and receiving an error. I would like to know how to resolve this. Thanks!

Code :
# Create subjects - dosing regimen + covariates
dose = DosageRegimen(100, time = 0)
choose_covariates() = (wt = rand(55:80), dose = 100)
subj_with_covariates = map(1:10) do i
    Subject(id = i,
            events = dose,
            covariates = choose_covariates(),
            observations = (conc = nothing,))
end

# Create model
FOabs = @model begin
    @param begin
        tvcl ∈ RealDomain(lower=0)
        tvvc ∈ RealDomain(lower=0)
        tvka ∈ RealDomain(lower=0)
        Ω    ∈ PDiagDomain(3) 
        σ_prop ∈ RealDomain(lower=0)
    end

    @random begin
        η ~ MvNormal(Ω)
    end

    @covariates wt

    @pre begin
        CL = tvcl*(wt/70)^0.75*exp(η[1])
        Vc = tvvc*(wt/70)*exp(η[2])
        Ka = tvka*exp(η[3])
    end

    @dynamics Depots1Central1

    @derived begin
        conc = @. Central/Vc
        dv   ~ @. Normal(conc, abs(conc) * σ_prop)
    end
end

# Model parameters for simulation
param = (tvcl = 5, tvvc = 20, tvka = 1,
         Ω = Diagonal([0.04, 0.04, 0.04]),
         σ_prop = 0.1)

# Perform simulations         
sims = simobs(FOabs, subj_with_covariates, param, obstimes = 0:.1:24)

# Convert simulations to a population 
pop = Subject.(sims)

# Re-fit
refit_1cmp = fit(FOabs, pop, param, Pumas.FOCE())
Error :
ERROR: LoadError: ArgumentError: Distribution is current not supported for the Pumas.FOCE() approximation. Please consider a different likelihood approximation.
Stacktrace:
  [1] _∂²l∂η²(dv_d::Vector{Float64}, obsdv::Vector{ForwardDiff.Dual{ForwardDiff.Tag{Pumas.var"#407#408"{PumasModel{ParamSet{NamedTuple{(:tvcl, :tvvc, :tvka, :Ω, :σ_prop), Tuple{RealDomain{Int64, TransformVariables.Infinity{true}, Int64}, RealDomain{Int64, TransformVariables.Infinity{true}, Int64}, RealDomain{Int64, TransformVariables.Infinity{true}, Int64}, PDiagDomain{PDMats.PDiagMat{Float64, Vector{Float64}}}, RealDomain{Int64, TransformVariables.Infinity{true}, Int64}}}}, var"#571#585", var"#572#586", var"#574#588", var"#576#590", Depots1Central1, var"#577#591", var"#581#595", Nothing}, Subject{NamedTuple{(:conc,), Tuple{Vector{Float64}}}, Pumas.ConstantCovar{NamedTuple{(:wt, :dose), Tuple{Int64, Int64}}}, Vector{Pumas.Event{Float64, Float64, Float64, Float64, Float64, Float64, Int64}}, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}}}, NamedTuple{(:tvcl, :tvvc, :tvka, :Ω, :σ_prop), Tuple{Float64, Float64, Float64, PDMats.PDiagMat{Float64, Vector{Float64}}, Float64}}, NamedTuple{(:obstimes,), Tuple{Nothing}}}, Float64}, Float64, 3}}, approx::Pumas.FOCE)
    @ Pumas /builds/PumasAI/PumasSystemImages-jl/.julia/packages/Pumas/HDuXQ/src/estimation/likelihoods.jl:1915
  [2] (::Pumas.var"#415#419"{Pumas.FOCE})(::Tuple{Vector{Float64}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{Pumas.var"#407#408"{PumasModel{ParamSet{NamedTuple{(:tvcl, :tvvc, :tvka, :Ω, :σ_prop), Tuple{RealDomain{Int64, TransformVariables.Infinity{true}, Int64}, RealDomain{Int64, TransformVariables.Infinity{true}, Int64}, RealDomain{Int64, TransformVariables.Infinity{true}, Int64}, PDiagDomain{PDMats.PDiagMat{Float64, Vector{Float64}}}, RealDomain{Int64, TransformVariables.Infinity{true}, Int64}}}}, var"#571#585", var"#572#586", var"#574#588", var"#576#590", Depots1Central1, var"#577#591", var"#581#595", Nothing}, Subject{NamedTuple{(:conc,), Tuple{Vector{Float64}}}, Pumas.ConstantCovar{NamedTuple{(:wt, :dose), Tuple{Int64, Int64}}}, Vector{Pumas.Event{Float64, Float64, Float64, Float64, Float64, Float64, Int64}}, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}}}, NamedTuple{(:tvcl, :tvvc, :tvka, :Ω, :σ_prop), Tuple{Float64, Float64, Float64, PDMats.PDiagMat{Float64, Vector{Float64}}, Float64}}, NamedTuple{(:obstimes,), Tuple{Nothing}}}, Float64}, Float64, 3}}})
    @ Pumas /builds/PumasAI/PumasSystemImages-jl/.julia/packages/Pumas/HDuXQ/src/estimation/likelihoods.jl:1692
  [3] map
    @ ./tuple.jl:213 [inlined]
  [4] map(::Function, ::NamedTuple{(:conc,), Tuple{Tuple{Vector{Float64}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{Pumas.var"#407#408"{PumasModel{ParamSet{NamedTuple{(:tvcl, :tvvc, :tvka, :Ω, :σ_prop), Tuple{RealDomain{Int64, TransformVariables.Infinity{true}, Int64}, RealDomain{Int64, TransformVariables.Infinity{true}, Int64}, RealDomain{Int64, TransformVariables.Infinity{true}, Int64}, PDiagDomain{PDMats.PDiagMat{Float64, Vector{Float64}}}, RealDomain{Int64, TransformVariables.Infinity{true}, Int64}}}}, var"#571#585", var"#572#586", var"#574#588", var"#576#590", Depots1Central1, var"#577#591", var"#581#595", Nothing}, Subject{NamedTuple{(:conc,), Tuple{Vector{Float64}}}, Pumas.ConstantCovar{NamedTuple{(:wt, :dose), Tuple{Int64, Int64}}}, Vector{Pumas.Event{Float64, Float64, Float64, Float64, Float64, Float64, Int64}}, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}}}, NamedTuple{(:tvcl, :tvvc, :tvka, :Ω, :σ_prop), Tuple{Float64, Float64, Float64, PDMats.PDiagMat{Float64, Vector{Float64}}, Float64}}, NamedTuple{(:obstimes,), Tuple{Nothing}}}, Float64}, Float64, 3}}}}})
    @ Base ./namedtuple.jl:197
  [5] _∂²l∂η²(m::PumasModel{ParamSet{NamedTuple{(:tvcl, :tvvc, :tvka, :Ω, :σ_prop), Tuple{RealDomain{Int64, TransformVariables.Infinity{true}, Int64}, RealDomain{Int64, TransformVariables.Infinity{true}, Int64}, RealDomain{Int64, TransformVariables.Infinity{true}, Int64}, PDiagDomain{PDMats.PDiagMat{Float64, Vector{Float64}}}, RealDomain{Int64, TransformVariables.Infinity{true}, Int64}}}}, var"#571#585", var"#572#586", var"#574#588", var"#576#590", Depots1Central1, var"#577#591", var"#581#595", Nothing}, subject::Subject{NamedTuple{(:conc,), Tuple{Vector{Float64}}}, Pumas.ConstantCovar{NamedTuple{(:wt, :dose), Tuple{Int64, Int64}}}, Vector{Pumas.Event{Float64, Float64, Float64, Float64, Float64, Float64, Int64}}, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}}}, param::NamedTuple{(:tvcl, :tvvc, :tvka, :Ω, :σ_prop), Tuple{Float64, Float64, Float64, PDMats.PDiagMat{Float64, Vector{Float64}}, Float64}}, vrandeffsorth::Vector{Float64}, approx::Pumas.FOCE, diffeq_options::NamedTuple{(), Tuple{}})
    @ Pumas /builds/PumasAI/PumasSystemImages-jl/.julia/packages/Pumas/HDuXQ/src/estimation/likelihoods.jl:1692
  [6] (::Pumas.var"#_fgh!#337"{PumasModel{ParamSet{NamedTuple{(:tvcl, :tvvc, :tvka, :Ω, :σ_prop), Tuple{RealDomain{Int64, TransformVariables.Infinity{true}, Int64}, RealDomain{Int64, TransformVariables.Infinity{true}, Int64}, RealDomain{Int64, TransformVariables.Infinity{true}, Int64}, PDiagDomain{PDMats.PDiagMat{Float64, Vector{Float64}}}, RealDomain{Int64, TransformVariables.Infinity{true}, Int64}}}}, var"#571#585", var"#572#586", var"#574#588", var"#576#590", Depots1Central1, var"#577#591", var"#581#595", Nothing}, Subject{NamedTuple{(:conc,), Tuple{Vector{Float64}}}, Pumas.ConstantCovar{NamedTuple{(:wt, :dose), Tuple{Int64, Int64}}}, Vector{Pumas.Event{Float64, Float64, Float64, Float64, Float64, Float64, Int64}}, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}}}, NamedTuple{(:tvcl, :tvvc, :tvka, :Ω, :σ_prop), Tuple{Float64, Float64, Float64, PDMats.PDiagMat{Float64, Vector{Float64}}, Float64}}, Pumas.FOCE, NamedTuple{(), Tuple{}}, TransformVariables.TransformTuple{NamedTuple{(:η,), Tuple{Pumas.MvNormalTransform{ZeroMeanDiagNormal{Tuple{Base.OneTo{Int64}}}}}}}, ParamSet{NamedTuple{(:η,), Tuple{ZeroMeanDiagNormal{Tuple{Base.OneTo{Int64}}}}}}})(F::Float64, G::Vector{Float64}, H::Matrix{Float64}, x::Vector{Float64})
    @ Pumas /builds/PumasAI/PumasSystemImages-jl/.julia/packages/Pumas/HDuXQ/src/estimation/likelihoods.jl:463
  [7] (::NLSolversBase.var"#98#104"{NLSolversBase.InplaceObjective{Nothing, Nothing, Pumas.var"#_fgh!#337"{PumasModel{ParamSet{NamedTuple{(:tvcl, :tvvc, :tvka, :Ω, :σ_prop), Tuple{RealDomain{Int64, TransformVariables.Infinity{true}, Int64}, RealDomain{Int64, TransformVariables.Infinity{true}, Int64}, RealDomain{Int64, TransformVariables.Infinity{true}, Int64}, PDiagDomain{PDMats.PDiagMat{Float64, Vector{Float64}}}, RealDomain{Int64, TransformVariables.Infinity{true}, Int64}}}}, var"#571#585", var"#572#586", var"#574#588", var"#576#590", Depots1Central1, var"#577#591", var"#581#595", Nothing}, Subject{NamedTuple{(:conc,), Tuple{Vector{Float64}}}, Pumas.ConstantCovar{NamedTuple{(:wt, :dose), Tuple{Int64, Int64}}}, Vector{Pumas.Event{Float64, Float64, Float64, Float64, Float64, Float64, Int64}}, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}}}, NamedTuple{(:tvcl, :tvvc, :tvka, :Ω, :σ_prop), Tuple{Float64, Float64, Float64, PDMats.PDiagMat{Float64, Vector{Float64}}, Float64}}, Pumas.FOCE, NamedTuple{(), Tuple{}}, TransformVariables.TransformTuple{NamedTuple{(:η,), Tuple{Pumas.MvNormalTransform{ZeroMeanDiagNormal{Tuple{Base.OneTo{Int64}}}}}}}, ParamSet{NamedTuple{(:η,), Tuple{ZeroMeanDiagNormal{Tuple{Base.OneTo{Int64}}}}}}}, Nothing, Nothing}, Float64})(G::Vector{Float64}, H::Matrix{Float64}, x::Vector{Float64})
    @ NLSolversBase /builds/PumasAI/PumasSystemImages-jl/.julia/packages/NLSolversBase/geyh3/src/objective_types/incomplete.jl:115
  [8] value_gradient_hessian!!(obj::NLSolversBase.TwiceDifferentiable{Float64, Vector{Float64}, Matrix{Float64}, Vector{Float64}}, x::Vector{Float64})
    @ NLSolversBase /builds/PumasAI/PumasSystemImages-jl/.julia/packages/NLSolversBase/geyh3/src/objective_types/incomplete.jl:138
  [9] initial_state(method::Optim.NewtonTrustRegion{Float64}, options::Optim.Options{Float64, Nothing}, d::NLSolversBase.TwiceDifferentiable{Float64, Vector{Float64}, Matrix{Float64}, Vector{Float64}}, initial_x::Vector{Float64})
    @ Optim /builds/PumasAI/PumasSystemImages-jl/.julia/packages/Optim/uwNqi/src/multivariate/solvers/second_order/newton_trust_region.jl:306
 [10] optimize
    @ /builds/PumasAI/PumasSystemImages-jl/.julia/packages/Optim/uwNqi/src/multivariate/optimize/optimize.jl:35 [inlined]
 [11] _orth_empirical_bayes!(vrandeffsorth::Vector{Float64}, m::PumasModel{ParamSet{NamedTuple{(:tvcl, :tvvc, :tvka, :Ω, :σ_prop), Tuple{RealDomain{Int64, TransformVariables.Infinity{true}, Int64}, RealDomain{Int64, TransformVariables.Infinity{true}, Int64}, RealDomain{Int64, TransformVariables.Infinity{true}, Int64}, PDiagDomain{PDMats.PDiagMat{Float64, Vector{Float64}}}, RealDomain{Int64, TransformVariables.Infinity{true}, Int64}}}}, var"#571#585", var"#572#586", var"#574#588", var"#576#590", Depots1Central1, var"#577#591", var"#581#595", Nothing}, subject::Subject{NamedTuple{(:conc,), Tuple{Vector{Float64}}}, Pumas.ConstantCovar{NamedTuple{(:wt, :dose), Tuple{Int64, Int64}}}, Vector{Pumas.Event{Float64, Float64, Float64, Float64, Float64, Float64, Int64}}, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}}}, param::NamedTuple{(:tvcl, :tvvc, :tvka, :Ω, :σ_prop), Tuple{Float64, Float64, Float64, PDMats.PDiagMat{Float64, Vector{Float64}}, Float64}}, approx::Pumas.FOCE, diffeq_options::NamedTuple{(), Tuple{}})
    @ Pumas /builds/PumasAI/PumasSystemImages-jl/.julia/packages/Pumas/HDuXQ/src/estimation/likelihoods.jl:487
 [12] _update_ebes_and_evaluate_marginal_nll!
    @ /builds/PumasAI/PumasSystemImages-jl/.julia/packages/Pumas/HDuXQ/src/estimation/likelihoods.jl:2054 [inlined]
 [13] _update_ebes_and_evaluate_marginal_nll_threads!(m::PumasModel{ParamSet{NamedTuple{(:tvcl, :tvvc, :tvka, :Ω, :σ_prop), Tuple{RealDomain{Int64, TransformVariables.Infinity{true}, Int64}, RealDomain{Int64, TransformVariables.Infinity{true}, Int64}, RealDomain{Int64, TransformVariables.Infinity{true}, Int64}, PDiagDomain{PDMats.PDiagMat{Float64, Vector{Float64}}}, RealDomain{Int64, TransformVariables.Infinity{true}, Int64}}}}, var"#571#585", var"#572#586", var"#574#588", var"#576#590", Depots1Central1, var"#577#591", var"#581#595", Nothing}, population::Vector{Subject{NamedTuple{(:conc,), Tuple{Vector{Float64}}}, Pumas.ConstantCovar{NamedTuple{(:wt, :dose), Tuple{Int64, Int64}}}, Vector{Pumas.Event{Float64, Float64, Float64, Float64, Float64, Float64, Int64}}, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}}}}, param::NamedTuple{(:tvcl, :tvvc, :tvka, :Ω, :σ_prop), Tuple{Float64, Float64, Float64, PDMats.PDiagMat{Float64, Vector{Float64}}, 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/HDuXQ/src/estimation/likelihoods.jl:2109
 [14] #440
    @ /builds/PumasAI/PumasSystemImages-jl/.julia/packages/Pumas/HDuXQ/src/estimation/likelihoods.jl:2497 [inlined]
 [15] (::NLSolversBase.var"#69#70"{NLSolversBase.InplaceObjective{Nothing, Pumas.var"#440#445"{PumasModel{ParamSet{NamedTuple{(:tvcl, :tvvc, :tvka, :Ω, :σ_prop), Tuple{RealDomain{Int64, TransformVariables.Infinity{true}, Int64}, RealDomain{Int64, TransformVariables.Infinity{true}, Int64}, RealDomain{Int64, TransformVariables.Infinity{true}, Int64}, PDiagDomain{PDMats.PDiagMat{Float64, Vector{Float64}}}, RealDomain{Int64, TransformVariables.Infinity{true}, Int64}}}}, var"#571#585", var"#572#586", var"#574#588", var"#576#590", Depots1Central1, var"#577#591", var"#581#595", Nothing}, Vector{Subject{NamedTuple{(:conc,), Tuple{Vector{Float64}}}, Pumas.ConstantCovar{NamedTuple{(:wt, :dose), Tuple{Int64, Int64}}}, Vector{Pumas.Event{Float64, Float64, Float64, Float64, Float64, Float64, Int64}}, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}}}}, Pumas.FOCE, EnsembleThreads, NamedTuple{(), Tuple{}}, TransformVariables.TransformTuple{NamedTuple{(:tvcl, :tvvc, :tvka, :Ω, :σ_prop), Tuple{TransformVariables.ShiftedExp{true, Int64}, TransformVariables.ShiftedExp{true, Int64}, TransformVariables.ShiftedExp{true, Int64}, Pumas.PDiagTransform, TransformVariables.ShiftedExp{true, Int64}}}}, Vector{Vector{Float64}}, Vector{Vector{Float64}}}, Nothing, Nothing, Nothing}, Float64})(G::Vector{Float64}, x::Vector{Float64})
    @ NLSolversBase /builds/PumasAI/PumasSystemImages-jl/.julia/packages/NLSolversBase/geyh3/src/objective_types/incomplete.jl:54
 [16] value_gradient!!(obj::NLSolversBase.OnceDifferentiable{Float64, Vector{Float64}, Vector{Float64}}, x::Vector{Float64})
    @ NLSolversBase /builds/PumasAI/PumasSystemImages-jl/.julia/packages/NLSolversBase/geyh3/src/interface.jl:82
 [17] initial_state(method::Optim.BFGS{LineSearches.InitialStatic{Float64}, LineSearches.BackTracking{Float64, Int64}, Nothing, Float64, Optim.Flat}, options::Optim.Options{Float64, Pumas.var"#425#427"{Pumas.DefaultOptimizeFN{Nothing, NamedTuple{(:show_trace, :store_trace, :extended_trace, :g_tol, :allow_f_increases), Tuple{Bool, Bool, Bool, Float64, Bool}}}, Pumas.var"#441#446"{Pumas.FOCE, Bool, NLSolversBase.OnceDifferentiable{Float64, Vector{Float64}, Vector{Float64}}, TransformVariables.TransformTuple{NamedTuple{(:tvcl, :tvvc, :tvka, :Ω, :σ_prop), Tuple{TransformVariables.ShiftedExp{true, Int64}, TransformVariables.ShiftedExp{true, Int64}, TransformVariables.ShiftedExp{true, Int64}, Pumas.PDiagTransform, TransformVariables.ShiftedExp{true, Int64}}}}}}}, d::NLSolversBase.OnceDifferentiable{Float64, Vector{Float64}, Vector{Float64}}, initial_x::Vector{Float64})
    @ Optim /builds/PumasAI/PumasSystemImages-jl/.julia/packages/Optim/uwNqi/src/multivariate/solvers/first_order/bfgs.jl:85
 [18] optimize
    @ /builds/PumasAI/PumasSystemImages-jl/.julia/packages/Optim/uwNqi/src/multivariate/optimize/optimize.jl:35 [inlined]
 [19] (::Pumas.DefaultOptimizeFN{Nothing, NamedTuple{(:show_trace, :store_trace, :extended_trace, :g_tol, :allow_f_increases), Tuple{Bool, Bool, Bool, Float64, Bool}}})(cost::NLSolversBase.OnceDifferentiable{Float64, Vector{Float64}, Vector{Float64}}, p::Vector{Float64}, callback::Pumas.var"#441#446"{Pumas.FOCE, Bool, NLSolversBase.OnceDifferentiable{Float64, Vector{Float64}, Vector{Float64}}, TransformVariables.TransformTuple{NamedTuple{(:tvcl, :tvvc, :tvka, :Ω, :σ_prop), Tuple{TransformVariables.ShiftedExp{true, Int64}, TransformVariables.ShiftedExp{true, Int64}, TransformVariables.ShiftedExp{true, Int64}, Pumas.PDiagTransform, TransformVariables.ShiftedExp{true, Int64}}}}})
    @ Pumas /builds/PumasAI/PumasSystemImages-jl/.julia/packages/Pumas/HDuXQ/src/estimation/likelihoods.jl:1973
 [20] _fit(m::PumasModel{ParamSet{NamedTuple{(:tvcl, :tvvc, :tvka, :Ω, :σ_prop), Tuple{RealDomain{Int64, TransformVariables.Infinity{true}, Int64}, RealDomain{Int64, TransformVariables.Infinity{true}, Int64}, RealDomain{Int64, TransformVariables.Infinity{true}, Int64}, PDiagDomain{PDMats.PDiagMat{Float64, Vector{Float64}}}, RealDomain{Int64, TransformVariables.Infinity{true}, Int64}}}}, var"#571#585", var"#572#586", var"#574#588", var"#576#590", Depots1Central1, var"#577#591", var"#581#595", Nothing}, population::Vector{Subject{NamedTuple{(:conc,), Tuple{Vector{Float64}}}, Pumas.ConstantCovar{NamedTuple{(:wt, :dose), Tuple{Int64, Int64}}}, Vector{Pumas.Event{Float64, Float64, Float64, Float64, Float64, Float64, Int64}}, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}}}}, param::NamedTuple{(:tvcl, :tvvc, :tvka, :Ω, :σ_prop), Tuple{Int64, Int64, Int64, Diagonal{Float64, Vector{Float64}}, Float64}}, 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{(:tvcl, :tvvc, :tvka, :Ω, :σ_prop), Tuple{RealDomain{Int64, TransformVariables.Infinity{true}, Int64}, RealDomain{Int64, TransformVariables.Infinity{true}, Int64}, RealDomain{Int64, TransformVariables.Infinity{true}, Int64}, PDiagDomain{PDMats.PDiagMat{Float64, Vector{Float64}}}, RealDomain{Int64, TransformVariables.Infinity{true}, Int64}}}}, fixedparam::NamedTuple{(:tvcl, :tvvc, :tvka, :Ω, :σ_prop), Tuple{Int64, Int64, Int64, Diagonal{Float64, Vector{Float64}}, Float64}}, checkidentification::Bool, diffeq_options::NamedTuple{(), Tuple{}})
    @ Pumas /builds/PumasAI/PumasSystemImages-jl/.julia/packages/Pumas/HDuXQ/src/estimation/likelihoods.jl:2548
 [21] fit(m::PumasModel{ParamSet{NamedTuple{(:tvcl, :tvvc, :tvka, :Ω, :σ_prop), Tuple{RealDomain{Int64, TransformVariables.Infinity{true}, Int64}, RealDomain{Int64, TransformVariables.Infinity{true}, Int64}, RealDomain{Int64, TransformVariables.Infinity{true}, Int64}, PDiagDomain{PDMats.PDiagMat{Float64, Vector{Float64}}}, RealDomain{Int64, TransformVariables.Infinity{true}, Int64}}}}, var"#571#585", var"#572#586", var"#574#588", var"#576#590", Depots1Central1, var"#577#591", var"#581#595", Nothing}, population::Vector{Subject{NamedTuple{(:conc,), Tuple{Vector{Float64}}}, Pumas.ConstantCovar{NamedTuple{(:wt, :dose), Tuple{Int64, Int64}}}, Vector{Pumas.Event{Float64, Float64, Float64, Float64, Float64, Float64, Int64}}, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}}}}, param::NamedTuple{(:tvcl, :tvvc, :tvka, :Ω, :σ_prop), Tuple{Int64, Int64, Int64, Diagonal{Float64, Vector{Float64}}, Float64}}, 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/HDuXQ/src/estimation/likelihoods.jl:2409
 [22] fit(m::PumasModel{ParamSet{NamedTuple{(:tvcl, :tvvc, :tvka, :Ω, :σ_prop), Tuple{RealDomain{Int64, TransformVariables.Infinity{true}, Int64}, RealDomain{Int64, TransformVariables.Infinity{true}, Int64}, RealDomain{Int64, TransformVariables.Infinity{true}, Int64}, PDiagDomain{PDMats.PDiagMat{Float64, Vector{Float64}}}, RealDomain{Int64, TransformVariables.Infinity{true}, Int64}}}}, var"#571#585", var"#572#586", var"#574#588", var"#576#590", Depots1Central1, var"#577#591", var"#581#595", Nothing}, population::Vector{Subject{NamedTuple{(:conc,), Tuple{Vector{Float64}}}, Pumas.ConstantCovar{NamedTuple{(:wt, :dose), Tuple{Int64, Int64}}}, Vector{Pumas.Event{Float64, Float64, Float64, Float64, Float64, Float64, Int64}}, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}}}}, param::NamedTuple{(:tvcl, :tvvc, :tvka, :Ω, :σ_prop), Tuple{Int64, Int64, Int64, Diagonal{Float64, Vector{Float64}}, Float64}}, approx::Pumas.FOCE)
    @ Pumas /builds/PumasAI/PumasSystemImages-jl/.julia/packages/Pumas/HDuXQ/src/estimation/likelihoods.jl:2392
 [23] top-level scope
    @ ~/data/code/WCOP_2022/WCOP_Day3.jl:468
in expression starting at /home/jrun/data/code/WCOP_2022/WCOP_Day3.jl:468

Use := for your conc in the @derived

Since you are using theSubject constructor to generate the Population from the SimulatedObservations, all outputs from the derived block are being considered as observations. And you can only fit a distribution and not an expression (conc)

Hi @vijay - this time I am getting an error at pop = Subject.(sims) itself. I tried passing observations = [:dv] but seems like we do not have that option for the Subject constructor

Error :
julia> pop = Subject.(sims)
ERROR: type NamedTuple has no field conc
Stacktrace:
  [1] getindex
    @ ./namedtuple.jl:118 [inlined]
  [2] (::Pumas.var"#165#166"{Pumas.SimulatedObservations{Subject{NamedTuple{(:conc,), Tuple{Nothing}}, Pumas.ConstantCovar{NamedTuple{(:wt, :dose), Tuple{Int64, Int64}}}, Vector{Pumas.Event{Float64, Float64, Float64, Float64, Float64, Float64, Int64}}, Nothing}, StepRange{Int64, Int64}, NamedTuple{(:dv,), Tuple{Vector{Float64}}}}})(k::Symbol)
    @ Pumas /builds/PumasAI/PumasSystemImages-jl/.julia/packages/Pumas/HDuXQ/src/models/simulated_observations.jl:74
  [3] map
    @ ./tuple.jl:213 [inlined]
  [4] Subject(simsubject::Pumas.SimulatedObservations{Subject{NamedTuple{(:conc,), Tuple{Nothing}}, Pumas.ConstantCovar{NamedTuple{(:wt, :dose), Tuple{Int64, Int64}}}, Vector{Pumas.Event{Float64, Float64, Float64, Float64, Float64, Float64, Int64}}, Nothing}, StepRange{Int64, Int64}, NamedTuple{(:dv,), Tuple{Vector{Float64}}}})
    @ Pumas /builds/PumasAI/PumasSystemImages-jl/.julia/packages/Pumas/HDuXQ/src/models/simulated_observations.jl:72
  [5] _broadcast_getindex_evalf
    @ ./broadcast.jl:648 [inlined]
  [6] _broadcast_getindex
    @ ./broadcast.jl:621 [inlined]
  [7] getindex
    @ ./broadcast.jl:575 [inlined]
  [8] copy
    @ ./broadcast.jl:922 [inlined]
  [9] materialize(bc::Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{1}, Nothing, Type{Subject}, Tuple{Vector{Pumas.SimulatedObservations{Subject{NamedTuple{(:conc,), Tuple{Nothing}}, Pumas.ConstantCovar{NamedTuple{(:wt, :dose), Tuple{Int64, Int64}}}, Vector{Pumas.Event{Float64, Float64, Float64, Float64, Float64, Float64, Int64}}, Nothing}, StepRange{Int64, Int64}, NamedTuple{(:dv,), Tuple{Vector{Float64}}}}}}})
    @ Base.Broadcast ./broadcast.jl:883
 [10] top-level scope
    @ REPL[19]:1

@Rahulub3r the issue is that you specified the observations as conc in the creation of the Population. So, when using the Subject constructor, the specified observation takes precedence over the what you want to really fit. So, if you change observations = conc to observations = dv while creating the population, you should be good.

Also, I noticed that you are trying to re-fit a simulation where your simulation starts at time=0. I am 100% sure that the re-fit will give you a Inf loglikelihood because there is a zero concentration at the time of dosing. In these kind of scenarios, it is always best to start the simulation obstimes after dosing explicitly to not run into errors. So, e,g, 0.1:0.1:24

Hope that helps.

1 Like

That solves it. Thanks @vijay !