PosteriorDB.jl
Documentation for PosteriorDB.jl ↗
If you have loaded a PosteriorDB.ReferencePosterior, you can transform it into a FlexiChain using FlexiChains.from_posteriordb_ref:
julia
using PosteriorDB, FlexiChains
pdb = PosteriorDB.database()
post = PosteriorDB.posterior(pdb, "eight_schools-eight_schools_centered")
ref = PosteriorDB.reference_posterior(post)
chn = FlexiChains.from_posteriordb_ref(ref)╭─FlexiChain (1000 iterations, 10 chains) ─────────────────────────────────────╮
│ ↓ iter = 10010:10:20000 │
│ → chain = 1:10 │
│ │
│ Parameters (10) ── String │
│ Float64 theta[1], theta[2], theta[3], theta[4], theta[5], theta[6] │
│ theta[7], theta[8], mu, tau │
│ │
│ Extras (0) │
│ (none) │
╰──────────────────────────────────────────────────────────────────────────────╯You can then use all the functionality of FlexiChains on chn:
julia
summarystats(chn)╭─FlexiSummary (9 statistics) ─────────────────────────────────────────────────╮
│ iter collapsed │
│ chain collapsed │
│ ↓ stat = [mean, std, mcse, ess_bulk, ess_tail, rhat, q5, q50, q95] │
│ │
│ Parameters (10) ── String │
│ Float64 theta[1], theta[2], theta[3], theta[4], theta[5], theta[6] │
│ theta[7], theta[8], mu, tau │
│ │
│ Extras (0) │
│ (none) │
│ │
│ Summary │
│ param mean std mcse … rhat q5 q50 q95 │
│ theta[1] 6.1505 5.6159 0.0557 0.9998 -1.6807 5.5890 16.3294 │
│ theta[2] 4.9396 4.6456 0.0462 0.9998 -2.2180 4.7729 12.8168 │
│ theta[3] 3.9059 5.2807 0.0542 1.0001 -4.9143 4.1054 11.8445 │
│ theta[4] 4.7960 4.7709 0.0475 1.0003 -2.6703 4.6953 12.6390 │
│ theta[5] 3.6144 4.6147 0.0461 … 1.0005 -4.2647 3.8204 10.6027 │
│ theta[6] 4.0511 4.7962 0.0485 1.0000 -3.8652 4.1618 11.5161 │
│ theta[7] 6.3172 5.0029 0.0499 0.9999 -0.8547 5.7950 15.3054 │
│ theta[8] 4.8840 5.3177 0.0543 1.0000 -3.3172 4.7853 13.5496 │
│ mu 4.4105 3.3093 0.0330 0.9998 -0.9362 4.3639 9.8321 │
│ tau 3.6021 3.1985 0.0319 … 0.9998 0.2567 2.7470 9.7322 │
╰──────────────────────────────────────────────────────────────────────────────╯Docstrings
FlexiChains.from_posteriordb_ref Function
julia
FlexiChains.from_posteriordb_ref(
ref::PosteriorDB.ReferencePosterior
)::FlexiChain{String}Load a PosteriorDB.ReferencePosterior into a FlexiChain. The keys are stored as strings, which matches the storage format in PosteriorDB.jl.