loo_compare: Compare LOO CV models

View source: R/loocv.R

loo_compareR Documentation

Compare LOO CV models

Description

Given multiple loocv outputs, calculate differences in their expected log predictive density.

Usage

loo_compare(...)

Arguments

...

A series of baggr_cv objects passed as arguments, with a minimum of 2 arguments required for comparison. baggr_cv objects can be created via the loocv function. In instances where more than 2 arguments are passed, the first model will be compared sequentially to all other provided models. Arguments can be passed with names (see example below).

Value

Returns a series of comparisons in order of the arguments provided as Model 1 - Model N for N loocv objects provided. Model 1 corresponds to the first object passed and Model N corresponds to the Nth object passed.

See Also

loocv for fitting LOO CV objects and explanation of the procedure; loo package by Vehtari et al (available on CRAN) for a more comprehensive approach

Examples

## Not run: 
# 2 models with more/less informative priors -- this will take a while to run
cv_1 <- loocv(schools, model = "rubin", pooling = "partial")
cv_2 <- loocv(schools, model = "rubin", pooling = "partial",
              prior_hypermean = normal(0, 5), prior_hypersd = cauchy(0,2.5))
loo_compare("Default prior"=cv_1,"Alternative prior"=cv_2)

## End(Not run)

baggr documentation built on May 29, 2024, 6:33 a.m.