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