# Simulated categorical data
set.seed(123)
X <- data.frame(
Var1 = as.factor(sample(letters[1:3], 200, replace = TRUE)), # Nominal variable
Var2 = as.factor(sample(letters[4:6], 200, replace = TRUE)), # Nominal variable
Var3 = factor(sample(c("low", "medium", "high"), 200, replace = TRUE),
levels = c("low", "medium", "high"), ordered = TRUE) # Ordinal variable
)
# Run IBcat with automatic lambda selection and multiple initializations
result <- IBcat(X = X, ncl = 3, beta = 15, lambda = -1, nstart = 5)
# Print clustering results
print(result$Cluster) # Cluster membership matrix
print(result$InfoXT) # Mutual information between X and T
print(result$InfoYT) # Mutual information between Y and T
Run the code above in your browser using DataLab