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