View source: R/loo_moment_matching.R
loo_moment_match | R Documentation |
Moment matching algorithm for updating a loo object when Pareto k estimates are large.
loo_moment_match(x, ...)
## Default S3 method:
loo_moment_match(
x,
loo,
post_draws,
log_lik_i,
unconstrain_pars,
log_prob_upars,
log_lik_i_upars,
max_iters = 30L,
k_threshold = NULL,
split = TRUE,
cov = TRUE,
cores = getOption("mc.cores", 1),
...
)
x |
A fitted model object. |
... |
Further arguments passed to the custom functions documented above. |
loo |
A loo object to be modified. |
post_draws |
A function the takes |
log_lik_i |
A function that takes |
unconstrain_pars |
A function that takes arguments |
log_prob_upars |
A function that takes arguments |
log_lik_i_upars |
A function that takes arguments |
max_iters |
Maximum number of moment matching iterations. Usually this
does not need to be modified. If the maximum number of iterations is
reached, there will be a warning, and increasing |
k_threshold |
Threshold value for Pareto k values above which the moment
matching algorithm is used. The default value is |
split |
Logical; Indicate whether to do the split transformation or not at the end of moment matching for each LOO fold. |
cov |
Logical; Indicate whether to match the covariance matrix of the
samples or not. If |
cores |
The number of cores to use for parallelization. This defaults to
the option
|
The loo_moment_match()
function is an S3 generic and we provide a
default method that takes as arguments user-specified functions
post_draws
, log_lik_i
, unconstrain_pars
, log_prob_upars
, and
log_lik_i_upars
. All of these functions should take ...
. as an argument
in addition to those specified for each function.
The loo_moment_match()
methods return an updated loo
object. The
structure of the updated loo
object is similar, but the method also
stores the original Pareto k diagnostic values in the diagnostics field.
loo_moment_match(default)
: A default method that takes as arguments a
user-specified model object x
, a loo
object and user-specified
functions post_draws
, log_lik_i
, unconstrain_pars
, log_prob_upars
,
and log_lik_i_upars
.
Paananen, T., Piironen, J., Buerkner, P.-C., Vehtari, A. (2021). Implicitly adaptive importance sampling. Statistics and Computing, 31, 16. doi:10.1007/s11222-020-09982-2. arXiv preprint arXiv:1906.08850.
loo()
, loo_moment_match_split()
# See the vignette for loo_moment_match()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.