Skip to contents

Computes the Bayesian Information Criterion (BIC) for a fitted MFA or MPCA model. This is a unified wrapper that dispatches to the appropriate method-specific function.

Usage

compute_bic_wrapper(method, fit, K, r, M, N_obs)

Arguments

method

Model type: "MFA" or "MPCA".

fit

A fitted model object.

K

Number of clusters.

r

Factor dimension.

M

Number of observed dimensions (muscles).

N_obs

Number of observations (typically sum of T_i).

Value

Numeric scalar: BIC value. Lower is better. Returns NA if computation fails.

Details

BIC is computed as \(-2 \log L + p \log(N)\), where L is the likelihood, p is the number of parameters, and N is the sample size.

Examples

if (FALSE) { # \dontrun{
fit <- mfa_em_fit(list_of_data, K = 3, r = 2)
N_obs <- sum(sapply(list_of_data, nrow))
M <- ncol(list_of_data[[1]])
bic <- compute_bic_wrapper("MFA", fit, K = 3, r = 2, M = M, N_obs = N_obs)
} # }