Calls the loo package to perform efficient approximate leave-one-out cross-validation on models fit with bayesGAM
Calls the loo package to perform efficient approximate leave-one-out cross-validation on models fit with bayesGAM
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).
loo_bgam(object,...)## S4 method for signature 'bayesGAMfit'loo_bgam(object,...)## S4 method for signature 'array'loo_bgam(object,...)
Arguments
object: Object of type bayesGAMfit generated from bayesGAM.
...: Additional parameters to pass to pass to loo::loo
Returns
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 criterion looic (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 in estimates, we also report pointwise values of the Monte Carlo standard error of elpd_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 parameter $k$ 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 the `influence_pareto_k` in `pointwise`. 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 the save_psis argument is set to TRUE when calling loo(). In that case psis_object will be the object of class "psis" that is created when the loo() function calls psis()
internally to do the PSIS procedure.
Examples
f <- bayesGAM(weight ~ np(height), data = women, family = gaussian, iter=500, chains =1)loo_bgam(f)
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>.