Computes the entropy term used in ICL (Integrated Complete-data Likelihood).
Higher entropy indicates more uncertain cluster assignments.
Arguments
- resp
An (N x K) matrix of responsibilities (posterior probabilities),
where resp[i,k] is the probability that subject i belongs to cluster k.
Value
A numeric scalar representing the entropy: -sum(resp * log(resp)).
Details
The entropy is computed as:
$$H = -\sum_{i=1}^{N} \sum_{k=1}^{K} r_{ik} \log(r_{ik})$$
where \(r_{ik}\) is the responsibility of subject i for cluster k.
A small constant (1e-16) is added to avoid log(0).
Examples
if (FALSE) { # \dontrun{
# Responsibilities from MFA fit
entropy <- compute_entropy(fit_mfa$resp)
} # }