View source: R/pareto_smooth.R
pareto_smooth | R Documentation |
Smooth the tail draws of x by replacing tail draws by order statistics of a generalized Pareto distribution fit to the tail(s). For further details see Vehtari et al. (2022).
pareto_smooth(x, ...)
## S3 method for class 'rvar'
pareto_smooth(x, return_k = TRUE, extra_diags = FALSE, ...)
## Default S3 method:
pareto_smooth(
x,
tail = c("both", "right", "left"),
r_eff = NULL,
ndraws_tail = NULL,
return_k = TRUE,
extra_diags = FALSE,
verbose = FALSE,
...
)
x |
(multiple options) One of:
|
... |
Arguments passed to individual methods (if applicable). |
return_k |
(logical) Should the Pareto khat be included in
output? If |
extra_diags |
(logical) Should extra Pareto khat diagnostics
be included in output? If |
tail |
(string) The tail to diagnose/smooth:
The default is |
r_eff |
(numeric) relative effective sample size estimate. If
|
ndraws_tail |
(numeric) number of draws for the tail. If
|
verbose |
(logical) Should diagnostic messages be printed? If
|
Either a vector x
of smoothed values or a named list
containing the vector x
and a named list diagnostics
containing Pareto smoothing
diagnostics:
khat
: estimated Pareto k shape parameter, and
optionally
min_ss
: minimum sample size for reliable Pareto
smoothed estimate
khat_threshold
: khat-threshold for reliable
Pareto smoothed estimates
convergence_rate
: Relative convergence rate for Pareto smoothed estimates
Aki Vehtari, Daniel Simpson, Andrew Gelman, Yuling Yao and Jonah Gabry (2022). Pareto Smoothed Importance Sampling. arxiv:arXiv:1507.02646
mu <- extract_variable_matrix(example_draws(), "mu")
pareto_smooth(mu)
d <- as_draws_rvars(example_draws("multi_normal"))
pareto_smooth(d$Sigma)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.