Unified interface for computing BIC for both MFA and MPCA models.
Usage
compute_BIC(loglik, K, r, M, N_obs, model_type)
Arguments
- loglik
Numeric scalar, the log-likelihood value
- K
Integer, number of clusters
- r
Integer, number of factors/synergies
- M
Integer, number of variables (muscles)
- N_obs
Integer, number of observations (total time points across subjects)
- model_type
Character, either "MFA" or "MPCA"
Value
A numeric scalar representing the BIC value (lower is better)
Details
BIC = -2 * loglik + p * log(N_obs), where p is the number of parameters.
The parameter count differs between MFA and MPCA due to different model
structures.
Examples
if (FALSE) { # \dontrun{
# Compute BIC for an MFA model
bic <- compute_BIC(loglik, K = 2, r = 3, M = 8, N_obs = 1000, model_type = "MFA")
} # }