What does this tool do?
LOO-CV (Leave-One-Out Cross-Validation) measures the out-of-sample predictive accuracy of a Bayesian model.
The tool has three stages: concept β analyse R output β make a decision.
Note: This tool
does not compute LOO β that is not feasible in a browser.
You compute LOO in R with
add_criterion() and paste the output into Stage 2.
Stage 1 β The concept
Model A (linear) vs.
Model B (polynomial degree 4) on the same dataset.
Each step: one point is held out, both models are refitted on Nβ1 points, then predictions are compared.
Dashed line = LOO fit; β = LOO prediction; arrow = residual.
Stage 2 β R output
In R, LOO is written directly into the model object:
model.1 <- add_criterion(model.1, c("loo"))
Then:
loo_compare(model.1, model.2, ...) β paste output into the first field.
The second field (optional) takes the output of
print(model.1$criteria$loo)
for the Pareto-k diagnostics of a
single model.
Load example shows the expected format.
Model Stacking
Model Stacking is a form of model averaging β but without model priors.
Instead of choosing one model, an ensemble is formed:
ΕΆ = wβΒ·ΕΆβ + wβΒ·ΕΆβ + wβΒ·ΕΆβ (weights sum to 1)
Weights are optimised directly from LOO predictive performance
(Yao et al. 2018). Redundant models automatically receive weight β 0.
vs. classical model averaging (BMA):
BMA weights by model posterior probability β stacking by
out-of-sample predictive accuracy. Stacking is more robust against similar models
and prior-sensitive BMA problems (McElreath Ch. 7).
Decision rule
|elpd_diff| > 2Β·SE β clear difference
|elpd_diff| < 2Β·SE β practically indistinguishable
k > 0.7 β LOO estimate unreliable, reloo() recommended
Prerequisites
brms Model Builder (model structure) Β· Posterior PPC (model diagnostics)