PSIS

PSIS.jl implements the Pareto smoothed importance sampling (PSIS) algorithm from [VehtariSimpson2021].

Given a set of importance weights used in some estimator, PSIS both improves the reliability of the estimates by smoothing the importance weights and acts as a diagnostic of the reliability of the estimates.

See psis for details.

Example

In this example, we use PSIS to smooth log importance ratios for importance sampling 30 isotropic Student $t$-distributed parameters using standard normal distributions as proposals.

using PSIS, Distributions
proposal = Normal()
target = TDist(7)
x = rand(proposal, 1_000, 30)
log_ratios = logpdf.(target, x) .- logpdf.(proposal, x)
result = psis(log_ratios)
PSISResult with 1000 draws, 30 chains, and 1 parameters
Pareto shape (k) diagnostic values:
                   Count       Min. ESS
 (0.5, 0.7]  okay  1 (100.0%)  26838

As indicated by the warnings, this is a poor choice of a proposal distribution, and estimates are unlikely to converge (see PSISResult for an explanation of the shape thresholds).

When running PSIS with many parameters, it is useful to plot the Pareto shape values to diagnose convergence. See Plotting PSIS results for examples.