# very artificial example, just for demonstration!
LL <- example_loglik_array()
loo1 <- loo(LL) # should be worst model when compared
loo2 <- loo(LL + 1) # should be second best model when compared
loo3 <- loo(LL + 2) # should be best model when compared
comp <- loo_compare(loo1, loo2, loo3)
print(comp, digits = 2)
# show more details with simplify=FALSE
# (will be the same for all models in this artificial example)
print(comp, simplify = FALSE, digits = 3)
# can use a list of objects with custom names
# will use apple, banana, and cherry, as the names in the output
loo_compare(list("apple" = loo1, "banana" = loo2, "cherry" = loo3))
if (FALSE) {
# works for waic (and kfold) too
loo_compare(waic(LL), waic(LL - 10))
}
Run the code above in your browser using DataLab