library(UniversalCVI)
# The data is from Wiroonsri (2024).
x = R1_data[,1:2]
# ---- FCM algorithm ----
# Compute the KPBM index
FCM.KPBM = KPBM.IDX(scale(x), cmax = 15, cmin = 2, method = "FCM",
fzm = 2, nstart = 20, iter = 100)
print(FCM.KPBM)
# The optimal number of cluster
FCM.KPBM[which.max(FCM.KPBM$KPBM),]
# ---- EM algorithm ----
# Compute the KPBM index
EM.KPBM = KPBM.IDX(scale(x), cmax = 15, cmin = 2, method = "EM",
nstart = 20, iter = 100)
print(EM.KPBM)
# The optimal number of cluster
EM.KPBM[which.max(EM.KPBM$KPBM),]
Run the code above in your browser using DataLab