Skip to contents

Bayesian information criterion

Usage

# S3 method for class 'brs'
BIC(object, ..., n = c("obs", "groups"))

Arguments

object

A fitted "brs" object.

...

Further fitted models (brs, brsmm or others with a BIC() method).

n

"obs" (default): the number of observations. "groups" applies to brsmm fits only (see BIC.brsmm) and is an error here.

Value

Scalar BIC value; with several models, a data frame with columns df and BIC, one row per model, as stats::BIC().

Examples

# \donttest{
dat <- data.frame(
  y = c(
    0, 5, 20, 50, 75, 90, 100, 30, 60, 45,
    10, 40, 55, 70, 85, 25, 35, 65, 80, 15
  ),
  x1 = rep(c(1, 2), 10)
)
prep <- brs_prep(dat, ncuts = 100)
#> brs_prep: n = 20 | exact = 0, left = 1, right = 1, interval = 18
fit <- brs(y ~ x1, data = prep)
BIC(fit)
#> [1] 194.2913
# }