Given the log-likelihood from compute_logLik_mpca, and the
number of clusters K, dimension r, etc., this function
computes the corrected BIC:
BIC = -2 * log(L) + nu * log(N),
where nu is the parameter count for MPCA. The corrected formula is
K*(M*r + r*(r-1)/2 + M + 1) + (K-1), i.e. for each cluster
we have (M*r) for the directions, r*(r-1)/2 for factor covariances,
M for the mean, and 1 for sigma^2. Then (K-1) for mixing proportions.
Details
The parameter count includes:
M*r: loading matrix (W or P)r*(r-1)/2: factor covariances (off-diagonal elements)M: cluster means (mu)1: isotropic noise variance (sigma2)K-1: mixing proportions
This corrected formula properly penalizes larger r values, improving r estimation stability.
Note: N_obs should typically be the total number of time points (sum of T_i) rather than the number of subjects, as BIC penalizes based on sample size.