Automatically report the results of Bayesian model comparison using the loo
package.
Arguments
- x
An object of class brms::loo_compare.
- index
type if index to report - expected log pointwise predictive density (ELPD) or information criteria (IC).
- ...
Additional arguments (not used for now).
Value
Objects of class report_text()
.
Details
The rule of thumb is that the models are "very similar" if |elpd_diff| (the absolute value of elpd_diff) is less than 4 (Sivula, Magnusson and Vehtari, 2020). If superior to 4, then one can use the SE to obtain a standardized difference (Z-diff) and interpret it as such, assuming that the difference is normally distributed.
Examples
# \donttest{
library(brms)
m1 <- brms::brm(mpg ~ qsec, data = mtcars)
#> Compiling Stan program...
#> Error in .fun(model_code = .x1): Boost not found; call install.packages('BH')
m2 <- brms::brm(mpg ~ qsec + drat, data = mtcars)
#> Compiling Stan program...
#> Error in .fun(model_code = .x1): Boost not found; call install.packages('BH')
x <- brms::loo_compare(brms::add_criterion(m1, "loo"),
brms::add_criterion(m2, "loo"),
model_names = c("m1", "m2")
)
#> Error in eval(expr, envir, enclos): object 'm1' not found
report(x)
#> Error in eval(expr, envir, enclos): object 'x' not found
# }