| add_loo.brma | R Documentation |
Compute approximate leave-one-out cross-validation (LOO-CV) using Pareto smoothed importance sampling (PSIS) for brma model objects and store the result in the object.
## S3 method for class 'brma'
add_loo(object, unit = "estimate", r_eff = NULL, parallel = FALSE, ...)
object |
a brma model object. |
unit |
output/deletion unit. |
r_eff |
optional vector of relative effective sample sizes. If not provided, it is computed from the log-likelihood values. |
parallel |
Logical. If |
... |
additional arguments (currently ignored). |
With unit = "estimate", LOO-CV is computed with one contribution per
effect-size estimate. For binomial and Poisson models, each pair of counts
(ai/ci or x1i/x2i) that defines a single effect size estimate is treated as
one contribution.
With unit = "cluster", LOO-CV is computed with one joint contribution
per cluster. For unweighted normal models without selection this uses the
analytic cluster block covariance. Selection, data-weighted normal, and
GLMM models integrate the held-out cluster effect with Gauss-Hermite
quadrature.
For selection models, the LOO evaluates the weighted likelihood, conditioning on the posterior omega samples.
The PSIS object is essential for model comparison via
loo_compare and is automatically saved in the loo result.
RoBMA stores target metadata so comparisons can reject mismatched data,
unit, or conditioning-depth targets.
Important for model comparison: When comparing models via
loo_compare, the selection is based on expected
out-of-sample predictive performance. This evaluates how well models predict
new observations, not how well they fit the observed data.
The brma object with the LOO result stored in
object[["loo"]][[unit]].
vehtari2017practicalRoBMA \insertCitevehtari2024paretoRoBMA
loo.brma, loo,
loo_compare, pareto_k_ids
## Not run:
if (requireNamespace("metadat", quietly = TRUE)) {
data(dat.lehmann2018, package = "metadat")
fit <- bPET(yi = yi, vi = vi, data = dat.lehmann2018, measure = "SMD")
fit <- add_loo(fit)
loo_fit <- loo(fit)
print(loo_fit)
plot(loo_fit)
}
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.