| psis.brmsfit | R Documentation |
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 (2024). For PSIS diagnostics see the pareto-k-diagnostic page.
## S3 method for class 'brmsfit'
psis(log_ratios, newdata = NULL, resp = NULL, model_name = NULL, ...)
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. |
... |
Further arguments passed to |
The psis() methods return an object of class "psis",
which is a named list with the following components:
log_weightsVector or matrix of smoothed (and truncated) but unnormalized log
weights. To get normalized weights use the
weights() method provided for objects of
class "psis".
diagnosticsA named list containing two vectors:
pareto_k: Estimates of the shape parameter k of the
generalized Pareto distribution. See the pareto-k-diagnostic
page for details.
n_eff: PSIS effective sample size estimates.
Objects of class "psis" also have the following attributes:
norm_const_logVector of precomputed values of colLogSumExps(log_weights) that are
used internally by the weights method to normalize the log weights.
tail_lenVector of tail lengths used for fitting the generalized Pareto distribution.
r_effIf specified, the user's r_eff argument.
dimsInteger vector of length 2 containing S (posterior sample size)
and N (number of observations).
methodMethod used for importance sampling, here psis.
Vehtari, A., Gelman, A., and Gabry, J. (2017). Practical Bayesian model evaluation using leave-one-out cross-validation and WAIC. Statistics and Computing. 27(5), 1413–1432. doi:10.1007/s11222-016-9696-4 (journal version, preprint arXiv:1507.04544).
Vehtari, A., Simpson, D., Gelman, A., Yao, Y., and Gabry, J. (2024). Pareto smoothed importance sampling. Journal of Machine Learning Research, 25(72):1-58. PDF
## Not run:
fit <- brm(rating ~ treat + period + carry, data = inhaler)
psis(fit)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.