index.C: Calculates Hubert & Levin C index - internal cluster quality...

View source: R/index.C.r

index.CR Documentation

Calculates Hubert & Levin C index - internal cluster quality index

Description

Calculates Hubert & Levin C index - internal cluster quality index

Usage

index.C(d,cl)

Arguments

d

'dist' object

cl

A vector of integers indicating the cluster to which each object is allocated

Details

See file $R_HOME\library\clusterSim\pdf\indexC_details.pdf for further details

Thanks to Özge Sahin from Technical University of Munich for for pointing the difference between index.G3 and index.C.

Value

calculated C index

Author(s)

Marek Walesiak marek.walesiak@ue.wroc.pl, Andrzej Dudek andrzej.dudek@ue.wroc.pl

Department of Econometrics and Computer Science, University of Economics, Wroclaw, Poland

References

Hubert, L.J., Levin, J.R. (1976), A General Statistical Framework for Assessing Categorical Clustering in Free Recall, Psychological Bulletin, Vol. 83, No. 6, 1072-1080.

See Also

index.G1, index.G2, index.G3, index.S, index.H, index.KL, index.Gap, index.DB

Examples

# Example 1
library(clusterSim)
data(data_ratio)
d <- dist.GDM(data_ratio)
c <- pam(d, 5, diss = TRUE)
icq <- index.C(d,c$clustering)
print(icq)

# Example 2
library(clusterSim)
data(data_ordinal)
d <- dist.GDM(data_ordinal, method="GDM2")
# nc - number_of_clusters
min_nc=2
max_nc=6
res <- array(0,c(max_nc-min_nc+1, 2))
res[,1] <- min_nc:max_nc
clusters <- NULL
for (nc in min_nc:max_nc)
{
hc <- hclust(d, method="complete")
cl2 <- cutree(hc, k=nc)
res[nc-min_nc+1,2] <- C <- index.C(d,cl2)
clusters <- rbind(clusters,cl2)
}
print(paste("min C for",(min_nc:max_nc)[which.min(res[,2])],"clusters=",min(res[,2])))
print("clustering for min C-index")
print(clusters[which.min(res[,2]),])
#write.table(res,file="C_res.csv",sep=";",dec=",",row.names=TRUE,col.names=FALSE)
plot(res, type="p", pch=0, xlab="Number of clusters", ylab="C", xaxt="n")
axis(1, c(min_nc:max_nc))

clusterSim documentation built on Sept. 30, 2024, 9:15 a.m.