Skip to contents

Computes the intraclass correlation coefficient (ICC) for each latent class, measuring the proportion of total variance due to individual differences.

Usage

calculate_icc(object, type = c("unconditional", "conditional"))

Arguments

object

Fitted SurveyMixrRE object

type

Character: "unconditional" (default, marginal ICC) or "conditional" (conditional on covariates)

Value

Numeric vector of ICC values for each class

Details

The unconditional ICC for class k is:

$$ICC_k = \frac{\psi^2_{0k}}{\psi^2_{0k} + \sigma^2_k}$$

where \(\psi^2_{0k}\) is the random intercept variance and \(\sigma^2_k\) is the residual variance.

**Interpretation:** - ICC = 0: No clustering (all variance is residual) - ICC = 1: Perfect clustering (all variance is between individuals) - Typical range: 0.1-0.5 for longitudinal data

Examples

if (FALSE) { # \dontrun{
# Note: Random effects functionality is under development
fit <- gmm_survey_re(
  data = mcs_simulated,
  id = "id", time = "age", outcome = "selfcontrol",
  n_classes = 3, random = ~ 1, starts = 100
)

# Calculate ICC for each class
icc_vals <- calculate_icc(fit)
print(icc_vals)
} # }