Learn R Programming

bayesics (version 2.0.2)

IC: Compute AIC, BIC, DIC, or WAIC for aov_b or lm_b objects. (Lower is better.)

Description

Compute AIC, BIC, DIC, or WAIC for aov_b or lm_b objects. (Lower is better.)

Usage

DIC(object, ...)

# S3 method for lm_b BIC(object, ...)

# S3 method for glm_b BIC(object, ...)

# S3 method for aov_b BIC(object, ...)

# S3 method for lm_b AIC(object, ...)

# S3 method for glm_b AIC(object, ...)

# S3 method for aov_b AIC(object, ...)

# S3 method for lm_b DIC(object, seed = 1, mc_error = 0.01, ...)

# S3 method for glm_b DIC(object, seed = 1, ...)

# S3 method for aov_b DIC(object, ...)

# S3 method for lm_b WAIC(object, seed = 1, ...)

# S3 method for aov_b WAIC(object, ...)

# S3 method for glm_b WAIC(object, seed = 1, ...)

Value

Numeric (or in the case of DIC, a numeric vector)

Arguments

object

aov_b, lm_b, or glm_b object

...

Passed to methods.

seed

integer. Always set your seed!!!

mc_error

The number of posterior draws will ensure that with 99% probability the posterior mean of the deviance for DIC will be within \(\pm\)mc_errorE(deviance).

Examples

Run this code
# \donttest{
set.seed(2025)
N = 500
test_data <-
  data.frame(x1 = rnorm(N),
             x2 = rnorm(N),
             x3 = letters[1:5])
test_data$outcome <-
  rnorm(N,-1 + test_data$x1 + 2 * (test_data$x3 %in% c("d","e")) )
fit1 <-
  lm_b(outcome ~ x1 + x2 + x3,
       data = test_data)
AIC(fit1)
BIC(fit1)
DIC(fit1)
WAIC(fit1)
# }


Run the code above in your browser using DataLab