Efficient Leave-One-Out Cross-Validation and WAIC for Bayesian Models
Overview
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.
- Revert behavior of internal
psis_smooth_tail()function that led to several
failing tests not caught by CRAN reverse dependency checks. This change should
not directly affect individual users. by @VisruthSK in #381
print.compare.loo()regains asimplifyargument for showing the full
comparison table with simplify = FALSE by @florence-bockting in #383.
From NEWS.md in the release
Install
Health
- OK13 OK2026-08-05
- NOTE12 OK, 1 NOTE2026-08-01
- OK13 OK2026-07-25
- ERROR12 OK, 1 ERROR2026-06-27
- OK14 OK2026-04-11
Show 4 earlier changesHide 4 earlier changes
- ERROR13 OK, 1 ERROR2026-04-09
- OK14 OK2026-03-28
- ERROR13 OK, 1 ERROR2026-03-21
- OK14 OK2026-03-10
Documentation
- Help pages
- 44 (8 internal)includes a package overview page
- Examples that run
- 65%13 run in a plain check · 2 only when donttest examples are enabled (R CMD check --as-cran) · 3 never run · 2 hold no code
- Exported functions with examples
- 59%
- Documented parameters
- 98%
- Return-value docs
- 94%
- Help pages citing references
- 48%
- Approximate leave-future-out cross-validation for Bayesian time series models
- Avoiding model refits in leave-one-out cross-validation with moment matching
- Bayesian Stacking and Pseudo-BMA weights
- Holdout validation and K-fold cross-validation of Stan programs with the loo package
- Leave-one-out cross-validation for non-factorized models
- Mixture IS leave-one-out cross-validation for high-dimensional Bayesian models
- Using Leave-one-out cross-validation for large data
- Using the loo package
- Writing Stan programs for use with the loo package
Downloads
Repository
- PRs merged (all time)
- 90%
- Median days to close, 50 most recently updated closed issues
- 10
- Median days to close, 50 most recently updated closed PRs
- 1
Stars over time
Forks over time
Releases over time
Issues over time
PRs over time
Commits over time
Commit identities over time
14 development-tooling and community-health practices detected across 8 families in the upstream repository
Checks run against github.com/stan-dev/loo on 2026-10-18.
The R CMD check workflow runs on Linux, macOS and Windows, and on R-devel
Funding links: GitHub Sponsors, mc-stan.org
The repository owner accepts GitHub Sponsors
GitHub Pages site last deployed 2026-10-14 · The repository has a site deploy workflow
pkgdown site last built 2026-07-24
Show all practicesHide 4 practices
Dependencies
Installing loo adds 19 packages (11 with compiled code, 5.2 MB of source tarballs). Heaviest: vctrs 1.0 MB, rlang 766 KB, cli 629 KB.
Show the 48 most downloaded dependentsHide the 48 most downloaded dependents
and 29 more dependents and 45 packages that suggest it on CRAN ↗
Code & Tests
Datasets
People & History
Pick two releases to compare their code metrics.
- 2.10.1Latest
- 2.10.02026-06-26 · diff ↗
- RR 4.6.0 released · 2026-04-24
- 2.9.02025-12-23 · diff ↗
- RR 4.5.0 released · 2025-04-11
- 2.8.02024-07-03 · diff ↗
- RR 4.4.0 released · 2024-04-24
- 2.7.0
- RR 4.3.0 released · 2023-04-21
- 2.6.0
- RR 4.2.0 released · 2022-04-22
- 2.5.12022-03-24 · diff ↗
- 2.5.02022-03-16 · diff ↗
- RR 4.1.0 released · 2021-05-18
- 2.4.12020-12-09 · diff ↗
- 2.4.0
Show 19 earlier eventsHide 19 earlier events
- 2.3.12020-07-15 · diff ↗
- 2.3.02020-07-07 · diff ↗ ·
added 3 exports
loo_moment_match, loo_moment_match.default, pareto_k_influence_values - RR 4.0.0 released · 2020-04-24
- 2.2.02019-12-19 · diff ↗ ·
removed 1 export
weights.psisadded 15 exports
.compute_point_estimate, .ndraws, .thin_draws, is.sis, is.tis, loo_approximate_posterior, loo_approximate_posterior.array, loo_approximate_posterior.function, loo_approximate_posterior.matrix, loo_subsample, loo_subsample.function, obs_idx, sis, tis, weights.importance_sampling - RR 3.6.0 released · 2019-04-26
- 2.1.02019-03-13 · diff ↗ ·
removed 1 export
kfold_split_balancedadded 9 exports
find_model_names, is.kfold, is.loo, is.psis, is.psis_loo, is.waic, kfold, kfold_split_grouped, loo_compare - RR 3.5.0 released · 2018-04-23
- 2.0.02018-04-11 · diff ↗ ·
added 19 exports
example_loglik_array, example_loglik_matrix, kfold_split_balanced, kfold_split_random, kfold_split_stratified, loo.array, loo_i, loo_model_weights, loo_model_weights.default, mcse_loo, pareto_k_values, print_dims, pseudobma_weights, psis, psis_n_eff_values, relative_eff, stacking_weights, waic.array, weights.psis - RR 3.4.0 released · 2017-04-21
- 1.1.0
- 1.0.0
- RR 3.3.0 released · 2016-05-03
- 0.1.62016-03-23 · diff ↗
- 0.1.52016-02-12 · diff ↗
- 0.1.42015-12-10 · diff ↗
- 0.1.32015-09-18 · diff ↗ ·
removed 3 exports
loo_and_waic, loo_and_waic_diff, psislooadded 4 exports
loo.function, loo.matrix, waic.function, waic.matrix - 0.1.22015-07-17 · diff ↗ ·
removed 2 exports
vgisloo, vgislwadded 6 exports
compare, loo, nlist, psisloo, psislw, waic - 0.1.02015-06-26
- RR 3.2.0 released · 2015-04-16
Package metadata
- First published
- 2015-06-26
- Total releases
- 23 / 11 yrs
- License
- GPL (>= 3) OSI
- Minimum R
- ≥ 3.5
- Bundled data
- 298 KB / 4 files
- Download size
- 2.7 MB
Cite
Cite this package
Run in R for the authors' preferred citation:
citation("loo")The package provides a citation file that builds its entry when R runs it. Run citation() to see it.
Cite the R Observatory
For a number measured here: a download total, a coverage figure, an archival date.
From data release v2026-10-22, which the citation names so these numbers can be found later. More on citing and the projects behind them.