bic_cat: Bayesian information criterion for fitted categorical AD...

View source: R/bic_cat.R

bic_catR Documentation

Bayesian information criterion for fitted categorical AD models

Description

Computes BIC using the fitted log likelihood and a parameter count for categorical antedependence parameters.

Usage

bic_cat(fit, n_subjects = NULL)

Arguments

fit

A fitted model object of class "cat_fit" returned by fit_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.

Value

A numeric scalar BIC value.

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))


antedep documentation built on April 25, 2026, 1:06 a.m.