psislw: Pareto smoothed importance sampling (PSIS)

Description Usage Arguments Details Value Note References See Also


Pareto smoothed importance sampling (PSIS)


psislw(lw, wcp = 0.2, wtrunc = 3/4, cores = getOption("loo.cores",
  parallel::detectCores()), llfun = NULL, llargs = NULL, ...)



A matrix or vector of log weights. For computing LOO, lw = -log_lik (see extract_log_lik) and is an S by N matrix where S is the number of simulations and N is the number of data points. (If lw is a vector it will be coerced to a one-column matrix.)


The proportion of importance weights to use for the generalized Pareto fit. The 100*wcp% largest weights are used as the sample from which to estimate the parameters of the generalized Pareto distribution.


For truncating very large weights to S^wtrunc. Set to zero for no truncation.


The number of cores to use for parallelization. This can be set for an entire R session by options(loo.cores = NUMBER). The default is detectCores().

llfun, llargs

See loo.function.


Ignored when psislw is called directly. The ... is only used internally when psislw is called by the loo function.


See the 'PSIS-LOO' section in loo-package.


A named list with components lw_smooth (modified log weights) and pareto_k (estimated generalized Pareto shape parameter(s) k).


This function is primarily intended for internal use, but is exported so that users can call it directly if interested in PSIS for purposes other than LOO-CV.


Vehtari, A., Gelman, A., and Gabry, J. (2016a). Practical Bayesian model evaluation using leave-one-out cross-validation and WAIC. Statistics and Computing. Advance online publication. doi:10.1007/s11222-016-9696-4. arXiv preprint:

Vehtari, A., Gelman, A., and Gabry, J. (2016b). Pareto smoothed importance sampling. arXiv preprint:

See Also

pareto-k-diagnostic for PSIS diagnostics.

Search within the loo package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.