Package: loo 2.8.0.9000

Jonah Gabry

loo: Efficient Leave-One-Out Cross-Validation and WAIC for Bayesian Models

Efficient approximate leave-one-out cross-validation (LOO) for Bayesian models fit using Markov chain Monte Carlo, as described in Vehtari, Gelman, and Gabry (2017) <doi:10.1007/s11222-016-9696-4>. The approximation uses Pareto smoothed importance sampling (PSIS), a new procedure for regularizing importance weights. As a byproduct of the calculations, we also obtain approximate standard errors for estimated predictive errors and for the comparison of predictive errors between models. The package also provides methods for using stacking and other model weighting techniques to average Bayesian predictive distributions.

Authors:Aki Vehtari [aut], Jonah Gabry [cre, aut], Måns Magnusson [aut], Yuling Yao [aut], Paul-Christian Bürkner [aut], Topi Paananen [aut], Andrew Gelman [aut], Ben Goodrich [ctb], Juho Piironen [ctb], Bruno Nicenboim [ctb], Leevi Lindgren [ctb]

loo_2.8.0.9000.tar.gz
loo_2.8.0.9000.zip(r-4.5)loo_2.8.0.9000.zip(r-4.4)loo_2.8.0.9000.zip(r-4.3)
loo_2.8.0.9000.tgz(r-4.4-any)loo_2.8.0.9000.tgz(r-4.3-any)
loo_2.8.0.9000.tar.gz(r-4.5-noble)loo_2.8.0.9000.tar.gz(r-4.4-noble)
loo_2.8.0.9000.tgz(r-4.4-emscripten)loo_2.8.0.9000.tgz(r-4.3-emscripten)
loo.pdf |loo.html
loo/json (API)
NEWS

# Install 'loo' in R:
install.packages('loo', repos = c('https://stan-dev.r-universe.dev', 'https://cloud.r-project.org'))

Peer review:

Bug tracker:https://github.com/stan-dev/loo/issues

Datasets:
  • Kline - Datasets for loo examples and vignettes
  • milk - Datasets for loo examples and vignettes
  • voice - Datasets for loo examples and vignettes
  • voice_loo - Datasets for loo examples and vignettes

On CRAN:

bayesbayesianbayesian-data-analysisbayesian-inferencebayesian-methodsbayesian-statisticscross-validationinformation-criterionmodel-comparisonstan

17.36 score 149 stars 272 packages 2.6k scripts 48k downloads 29 mentions 65 exports 20 dependencies

Last updated 1 months agofrom:49642207e6. Checks:OK: 7. Indexed: yes.

TargetResultDate
Doc / VignettesOKNov 15 2024
R-4.5-winOKNov 15 2024
R-4.5-linuxOKNov 15 2024
R-4.4-winOKNov 15 2024
R-4.4-macOKNov 15 2024
R-4.3-winOKNov 15 2024
R-4.3-macOKNov 15 2024

Exports:.compute_point_estimate.ndraws.thin_drawscomparecrpsE_looelpdexample_loglik_arrayexample_loglik_matrixextract_log_likfind_model_namesgpdfitis.kfoldis.loois.psisis.psis_loois.sisis.tisis.waickfoldkfold_split_groupedkfold_split_randomkfold_split_stratifiedlooloo_approximate_posteriorloo_approximate_posterior.arrayloo_approximate_posterior.functionloo_approximate_posterior.matrixloo_compareloo_crpsloo_iloo_model_weightsloo_model_weights.defaultloo_moment_matchloo_moment_match.defaultloo_predictive_metricloo_scrpsloo_subsampleloo_subsample.functionloo.arrayloo.functionloo.matrixmcse_loonlistobs_idxpareto_k_idspareto_k_influence_valuespareto_k_tablepareto_k_valuespointwiseprint_dimspseudobma_weightspsispsis_n_eff_valuespsislwrelative_effscrpssisstacking_weightstiswaicwaic.arraywaic.functionwaic.matrixweights.importance_sampling

Dependencies:abindbackportscheckmateclidistributionalfansigenericsgluelifecyclemagrittrmatrixStatsnumDerivpillarpkgconfigposteriorrlangtensorAtibbleutf8vctrs

Approximate leave-future-out cross-validation for Bayesian time series models

Rendered fromloo2-lfo.Rmdusingknitr::rmarkdownon Nov 15 2024.

Last update: 2024-04-15
Started: 2018-10-16

Avoiding model refits in leave-one-out cross-validation with moment matching

Rendered fromloo2-moment-matching.Rmdusingknitr::rmarkdownon Nov 15 2024.

Last update: 2024-04-15
Started: 2020-03-05

Bayesian Stacking and Pseudo-BMA weights using the loo package

Rendered fromloo2-weights.Rmdusingknitr::rmarkdownon Nov 15 2024.

Last update: 2024-04-15
Started: 2018-04-04

Holdout validation and K-fold cross-validation of Stan programs with the loo package

Rendered fromloo2-elpd.Rmdusingknitr::rmarkdownon Nov 15 2024.

Last update: 2023-11-02
Started: 2020-12-04

Leave-one-out cross-validation for non-factorized models

Rendered fromloo2-non-factorized.Rmdusingknitr::rmarkdownon Nov 15 2024.

Last update: 2024-04-15
Started: 2020-06-15

Mixture IS leave-one-out cross-validation for high-dimensional Bayesian models

Rendered fromloo2-mixis.Rmdusingknitr::rmarkdownon Nov 15 2024.

Last update: 2024-04-15
Started: 2023-03-23

Using Leave-one-out cross-validation for large data

Rendered fromloo2-large-data.Rmdusingknitr::rmarkdownon Nov 15 2024.

Last update: 2024-04-15
Started: 2019-09-17

Using the loo package (version >= 2.0.0)

Rendered fromloo2-example.Rmdusingknitr::rmarkdownon Nov 15 2024.

Last update: 2024-04-15
Started: 2018-04-04

Writing Stan programs for use with the loo package

Rendered fromloo2-with-rstan.Rmdusingknitr::rmarkdownon Nov 15 2024.

Last update: 2024-04-15
Started: 2018-04-04

Readme and manuals

Help Manual

Help pageTopics
Efficient LOO-CV and WAIC for Bayesian modelsloo-package
Pareto smoothed importance sampling (PSIS) using approximate posteriorsap_psis ap_psis.array ap_psis.default ap_psis.matrix
Model comparison (deprecated, old version)compare
Continuously ranked probability scorecrps crps.matrix crps.numeric loo_crps loo_crps.matrix loo_scrps loo_scrps.matrix scrps scrps.matrix scrps.numeric
Compute weighted expectationsE_loo E_loo.default E_loo.matrix
Generic (expected) log-predictive densityelpd elpd.array elpd.matrix
Objects to use in examples and testsexample_loglik_array example_loglik_matrix
Extract pointwise log-likelihood from a Stan modelextract_log_lik
Estimate parameters of the Generalized Pareto distributiongpdfit
A parent class for different importance sampling methods.importance_sampling importance_sampling.array importance_sampling.default importance_sampling.matrix
Generic function for K-fold cross-validation for developersis.kfold kfold kfold-generic
Helper functions for K-fold cross-validationkfold-helpers kfold_split_grouped kfold_split_random kfold_split_stratified
Efficient approximate leave-one-out cross-validation (LOO)is.loo is.psis_loo loo loo.array loo.function loo.matrix loo_i
Efficient approximate leave-one-out cross-validation (LOO) for posterior approximationsloo_approximate_posterior loo_approximate_posterior.array loo_approximate_posterior.function loo_approximate_posterior.matrix
Model comparisonloo_compare loo_compare.default print.compare.loo print.compare.loo_ss
Model averaging/weighting via stacking or pseudo-BMA weightingloo_model_weights loo_model_weights.default pseudobma_weights stacking_weights
Moment matching for efficient approximate leave-one-out cross-validation (LOO)loo_moment_match loo_moment_match.default
Split moment matching for efficient approximate leave-one-out cross-validation (LOO)loo_moment_match_split
Estimate leave-one-out predictive performance..loo_predictive_metric loo_predictive_metric.matrix
Efficient approximate leave-one-out cross-validation (LOO) using subsampling, so that less costly and more approximate computation is made for all LOO-fold, and more costly and accurate computations are made only for m<N LOO-folds.loo_subsample loo_subsample.function
Datasets for loo examples and vignettesKline loo-datasets milk voice voice_loo
LOO package glossaryloo-glossary
The number of observations in a 'psis_loo_ss' object.nobs.psis_loo_ss
Get observation indices used in subsamplingobs_idx
Diagnostics for Pareto smoothed importance sampling (PSIS)mcse_loo pareto-k-diagnostic pareto_k_ids pareto_k_influence_values pareto_k_table pareto_k_values plot.loo plot.psis plot.psis_loo psis_n_eff_values
Convenience function for extracting pointwise estimatespointwise pointwise.loo
Print methodsprint.importance_sampling print.importance_sampling_loo print.loo print.psis print.psis_loo print.psis_loo_ap print.waic
Pareto smoothed importance sampling (PSIS)is.psis is.sis is.tis psis psis.array psis.default psis.matrix
Pareto smoothed importance sampling (deprecated, old version)psislw
Convenience function for computing relative efficienciesrelative_eff relative_eff.array relative_eff.default relative_eff.function relative_eff.importance_sampling relative_eff.matrix
Standard importance sampling (SIS)sis sis.array sis.default sis.matrix
Truncated importance sampling (TIS)tis tis.array tis.default tis.matrix
Update 'psis_loo_ss' objectsupdate.psis_loo_ss
Widely applicable information criterion (WAIC)is.waic waic waic.array waic.function waic.matrix
Extract importance sampling weightsweights.importance_sampling