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)