loo_bgam {bayesGAM} | R Documentation |
Calls the loo
package to perform efficient approximate leave-one-out cross-validation on models fit with bayesGAM
Description
Computes PSIS-LOO CV, efficient approximate leave-one-out (LOO) cross-validation for
Bayesian models using Pareto smoothed importance sampling (PSIS). This calls the implementation
from the loo
package of the methods described in Vehtari, Gelman, and Gabry (2017a, 2017b).
Usage
loo_bgam(object, ...)
## S4 method for signature 'bayesGAMfit'
loo_bgam(object, ...)
## S4 method for signature 'array'
loo_bgam(object, ...)
Arguments
object |
Object of type |
... |
Additional parameters to pass to pass to |
Value
a named list of class c("psis_loo", "loo")
estimates
-
A matrix with two columns (
Estimate
,SE
) and three rows (elpd_loo
,p_loo
,looic
). This contains point estimates and standard errors of the expected log pointwise predictive density (elpd_loo
), the effective number of parameters (p_loo
) and the LOO information criterionlooic
(which is just-2 * elpd_loo
, i.e., converted to deviance scale). pointwise
-
A matrix with five columns (and number of rows equal to the number of observations) containing the pointwise contributions of the measures (
elpd_loo
,mcse_elpd_loo
,p_loo
,looic
,influence_pareto_k
). in addition to the three measures inestimates
, we also report pointwise values of the Monte Carlo standard error ofelpd_loo
(mcse_elpd_loo
), and statistics describing the influence of each observation on the posterior distribution (influence_pareto_k
). These are the estimates of the shape parameterk
of the generalized Pareto fit to the importance ratios for each leave-one-out distribution. See the pareto-k-diagnostic page for details. diagnostics
-
A named list containing two vectors:
-
pareto_k
: Importance sampling reliability diagnostics. By default, these are equal to theinfluence_pareto_k
inpointwise
. Some algorithms can improve importance sampling reliability and modify these diagnostics. See the pareto-k-diagnostic page for details. -
n_eff
: PSIS effective sample size estimates.
-
psis_object
-
This component will be
NULL
unless thesave_psis
argument is set toTRUE
when callingloo()
. In that casepsis_object
will be the object of class"psis"
that is created when theloo()
function callspsis()
internally to do the PSIS procedure.
References
Vehtari, A., Gelman, A., and Gabry, J. (2017a). 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., Gelman, A., and Gabry, J. (2017b). Pareto smoothed importance sampling. preprint arXiv:1507.02646
Vehtari A, Gabry J, Magnusson M, Yao Y, Gelman A (2019). “loo: Efficient leave-one-out cross-validation and WAIC for Bayesian models.” R package version 2.2.0, <URL: https://mc-stan.org/loo>.
Examples
f <- bayesGAM(weight ~ np(height), data = women,
family = gaussian, iter=500, chains = 1)
loo_bgam(f)