psis.brmsfit {brms}  R Documentation 
Pareto smoothed importance sampling (PSIS)
Description
Implementation of Pareto smoothed importance sampling (PSIS), a method for stabilizing importance ratios. The version of PSIS implemented here corresponds to the algorithm presented in Vehtari, Simpson, Gelman, Yao, and Gabry (2022). For PSIS diagnostics see the paretokdiagnostic page.
Usage
## S3 method for class 'brmsfit'
psis(log_ratios, newdata = NULL, resp = NULL, model_name = NULL, ...)
Arguments
log_ratios 
A fitted model object of class 
newdata 
An optional data.frame for which to evaluate predictions. If

resp 
Optional names of response variables. If specified, predictions are performed only for the specified response variables. 
model_name 
Currently ignored. 
... 
Value
The psis()
methods return an object of class "psis"
,
which is a named list with the following components:
log_weights

Vector or matrix of smoothed (and truncated) but unnormalized log weights. To get normalized weights use the
weights()
method provided for objects of class"psis"
. diagnostics

A named list containing two vectors:

pareto_k
: Estimates of the shape parameterk
of the generalized Pareto distribution. See the paretokdiagnostic page for details. 
n_eff
: PSIS effective sample size estimates.

Objects of class "psis"
also have the following attributes:
norm_const_log

Vector of precomputed values of
colLogSumExps(log_weights)
that are used internally by theweights
method to normalize the log weights. tail_len

Vector of tail lengths used for fitting the generalized Pareto distribution.
r_eff

If specified, the user's
r_eff
argument. dims

Integer vector of length 2 containing
S
(posterior sample size) andN
(number of observations). method

Method used for importance sampling, here
psis
.
References
Vehtari, A., Gelman, A., and Gabry, J. (2017). Practical Bayesian model evaluation using leaveoneout crossvalidation and WAIC. Statistics and Computing. 27(5), 1413–1432. doi:10.1007/s1122201696964 (journal version, preprint arXiv:1507.04544).
Vehtari, A., Simpson, D., Gelman, A., Yao, Y., and Gabry, J. (2022). Pareto smoothed importance sampling. preprint arXiv:1507.02646
Examples
## Not run:
fit < brm(rating ~ treat + period + carry, data = inhaler)
psis(fit)
## End(Not run)