Plotting PSIS results
PSIS.jl includes plotting recipes for PSISResult
using any Plots.jl backend, as well as the utility plotting function PSISPlots.paretoshapeplot
.
We demonstrate this with a simple example.
using PSIS, Distributions
proposal = Normal()
target = TDist(7)
ndraws, nchains, nparams = (1_000, 1, 20)
x = rand(proposal, ndraws, nchains, nparams)
log_ratios = logpdf.(target, x) .- logpdf.(proposal, x)
result = psis(log_ratios)
PSISResult with 1000 draws, 1 chains, and 20 parameters
Pareto shape (k) diagnostic values:
Count Min. ESS
(-Inf, 0.5] good 4 (20.0%) 959
(0.5, 0.7] okay 9 (45.0%) 938
(0.7, 1] bad 7 (35.0%) ——
Plots.jl
PSISResult
objects can be plotted directly:
using Plots
plot(result; showlines=true, marker=:+, legend=false, linewidth=2)
This is equivalent to calling PSISPlots.paretoshapeplot(result; kwargs...)
.