Computes BIC using the fitted log likelihood and a parameter count for categorical antedependence parameters.
Arguments
- fit
A fitted model object of class
"cat_fit"returned byfit_cat.- n_subjects
Number of subjects. If NULL, extracted from fit.
Details
The BIC is computed as: $$BIC = -2 \times \ell + k \times \log(N)$$ where \(\ell\) is the log-likelihood, \(k\) is the number of free parameters, and \(N\) is the number of subjects.
Examples
set.seed(1)
y <- simulate_cat(40, 5, order = 1, n_categories = 2)
# Fit models of different orders
fit0 <- fit_cat(y, order = 0)
fit1 <- fit_cat(y, order = 1)
fit2 <- fit_cat(y, order = 2)
# Compare BIC
c(BIC_0 = bic_cat(fit0), BIC_1 = bic_cat(fit1), BIC_2 = bic_cat(fit2))
#> BIC_0 BIC_1 BIC_2
#> 290.2363 303.7537 308.9566