\(-2\ell + \log(n)\,k\) with \(n\) = the number of observations
(nobs(object)), as lme4 does, and \(k\) the number of
parameters (fixed effects, precision and packed random-effect
parameters). There is no single sample size for a mixed model: counting
groups instead (\(n = \) object$ngroups) penalises more and is a
common alternative, -2 * logLik(object) + log(object$ngroups) * k.
Compare BIC values only between fits with the same convention.
Usage
# S3 method for class 'brsmm'
BIC(object, ...)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),
id = factor(rep(1:4, each = 5))
)
prep <- brs_prep(dat, ncuts = 100)
#> brs_prep: n = 20 | exact = 0, left = 1, right = 1, interval = 18
fit <- brsmm(y ~ x1, random = ~ 1 | id, data = prep)
BIC(fit)
#> [1] 196.3492
# }
