brms (version 2.4.0)

add_ic: Add information criteria and fit indices to fitted model objects

Description

Add information criteria and fit indices to fitted model objects

Usage

add_ic(x, ...)

# S3 method for brmsfit add_ic(x, ic = "loo", model_name = NULL, ...)

add_ic(x, ...) <- value

add_loo(x, ...)

add_waic(x, ...)

Arguments

x

An R object typically of class brmsfit.

...

Further arguments passed to the underlying functions computing the information criteria or fit indices.

ic, value

Names of the information criteria / fit indices to compute. Currently supported are "loo", "waic", "kfold", "R2" (R-squared), and "marglik" (log marginal likelihood).

model_name

Optional name of the model. If NULL (the default) the name is taken from the call to x.

Value

An object of the same class as x, but with information criteria added for later usage.

Details

The methods add_loo and add add_waic are just convenient wrappers around add_ic.

Examples

Run this code
# NOT RUN {
fit <- brm(count ~ Trt, epilepsy, poisson())
# add both LOO and WAIC at once
fit <- add_ic(fit, ic = c("loo", "waic"))
print(fit$loo)
print(fit$waic)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab