Fields of SIR infer

A slightly modified version of the SIR inference video tutorial gives an error:

sir = Pumas.SIR(samples = 200, resamples = 100)
inf_sir = infer(iv1cmt_wt_egfr_results, sir, level = 0.95)
inf_sir.vcov.results
julia> inf_sir.vcov.results
Error showing value of type Pumas.BayesMCMCResults{Pumas.LogMarginal{PumasModel{ParamSet{NamedTuple{(:θcl, :θvc, :δeGFR, :Ω, :σ_add, :σ_prop), Tuple{RealDomain{Float64, TransformVariables.Infinity{true}, Float64}, RealDomain{Float64, TransformVariables.Infinity{true}, Float64}, RealDomain{Float64, TransformVariables.Infinity{true}, Float64}, PDiagDomain{PDMats.PDiagMat{Float64, Vector{Float64}}}, RealDomain{Float64, TransformVariables.Infinity{true}, Float64}, RealDomain{Float64, TransformVariables.Infinity{true}, Float64}}}}, var"#5#17", var"#6#18", var"#8#20", var"#10#22", Central1, var"#11#23", var"#14#26", Nothing}, Vector{Subject{NamedTuple{(:CONC,), Tuple{Vector{Union{Missing, Float64}}}}, Pumas.ConstantCovar{NamedTuple{(:WEIGHT, :eGFR), Tuple{Float64, Float64}}}, Vector{Pumas.Event{Float64, Float64, Float64, Float64, Float64, Float64, Int64}}, Vector{Float64}}}, TransformVariables.TransformTuple{NamedTuple{(:θcl, :θvc, :δeGFR, :Ω, :σ_add, :σ_prop), Tuple{TransformVariables.ShiftedExp{true, Float64}, TransformVariables.ShiftedExp{true, Float64}, TransformVariables.ShiftedExp{true, Float64}, Pumas.PDiagTransform, TransformVariables.ShiftedExp{true, Float64}, TransformVariables.ShiftedExp{true, Float64}}}}, TransformVariables.TransformTuple{NamedTuple{(:θcl, :θvc, :δeGFR, :Ω, :σ_add, :σ_prop), Tuple{TransformVariables.Identity, TransformVariables.Identity, TransformVariables.Identity, Pumas.DiagonalTransform, TransformVariables.Identity, TransformVariables.Identity}}}, Vector{Float64}, Pumas.FOCE, Vector{Vector{Float64}}, Vector{Float64}, NamedTuple{(:optimize_fn, :constantcoef, :omegas, :ensemblealg, :diffeq_options), Tuple{Pumas.DefaultOptimizeFN{Nothing, NamedTuple{(:show_trace, :store_trace, :extended_trace, :g_tol, :allow_f_increases), Tuple{Bool, Bool, Bool, Float64, Bool}}}, NamedTuple{(), Tuple{}}, Tuple{}, EnsembleThreads, NamedTuple{(), Tuple{}}}}}, Vector{NamedTuple{(:θcl, :θvc, :δeGFR, :Ω, :σ_add, :σ_prop), Tuple{Float64, Float64, Float64, PDMats.PDiagMat{Float64, Vector{Float64}}, Float64, Float64}}}, Nothing}:
ERROR: ArgumentError: broadcasting over dictionaries and `NamedTuple`s is reserved
Stacktrace:
  [1] broadcastable(#unused#::NamedTuple{(:θcl, :θvc, :δeGFR, :Ω, :σ_add, :σ_prop), Tuple{Float64, Float64, Float64, PDMats.PDiagMat{Float64, Vector{Float64}}, Float64, Float64}})
    @ Base.Broadcast ./broadcast.jl:683

Also, it is not obvious to me how to extract the correlation between the estimates from the object.
I did not find any documentation on this, (which is why I was messing around with the internals of the object).

Finally, I noticed that a lot of dead links on:
https://docs.pumas.ai/dev/analysis/inference/
e.g. the first “infer” link.

Hi @ArnoStrouwen

Thanks for your question and the report. There is currently no API function for querying the correlation between variables in the SIR samples. (This may change in the next version.) However right now, you can reach in a bit and take the samples out then calculate the correlations using something like:

samples = inf_sir.vcov.results.chains
θcls = getproperty.(samples, :θcl)
θvcs = getproperty.(samples, :θvc)
cor(θcls, θvcs)

This hack might not work in future versions though since it’s not documented behaviour. I hope this helps.