fit-method-loo | R Documentation |
The $loo()
method computes approximate LOO-CV using the
loo package. In order to use this method you must compute and save
the pointwise log-likelihood in your Stan program. See loo::loo.array()
and the loo package vignettes
for details.
loo(variables = "log_lik", r_eff = TRUE, moment_match = FALSE, ...)
variables |
(string) The name of the variable in the Stan program
containing the pointwise log-likelihood. The default is to look for
|
r_eff |
(multiple options) How to handle the
|
moment_match |
(logical) Whether to use a
moment-matching correction for problematic
observations. The default is |
... |
Other arguments (e.g., |
The object returned by loo::loo.array()
or
loo::loo_moment_match.default()
.
The loo package website with documentation and vignettes.
## Not run:
# the "logistic" example model has "log_lik" in generated quantities
fit <- cmdstanr_example("logistic")
loo_result <- fit$loo(cores = 2)
print(loo_result)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.