comparing.Partitions: Calculate agreement indices between two partitions

View source: R/comparing.Partitions.r

comparing.PartitionsR Documentation

Calculate agreement indices between two partitions

Description

Calculate agreement indices between two partitions

Usage

comparing.Partitions(cl1,cl2,type="nowak")

Arguments

cl1

A vector of integers (or letters) indicating the cluster to which each object is allocated for first clustering

cl2

A vector of integers (or letters) indicating the cluster to which each object is allocated for second clustering

type

"rand" - for Rand index, "crand" - for adjusted Rand index or "nowak" for Nowak index

Details

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

Rand and adjusted Rand indices uses classAgreement function from e1071 library.

Value

Returns value of 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., Arabie, P. (1985), Comparing partitions, "Journal of Classification", no. 1, 193-218. Available at: \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1007/BF01908075")}.

Nowak, E. (1985), Wskaznik podobienstwa wynikow podzialow, "Przeglad Statystyczny" ["Statistical Review"], no. 1, 41-48.

Rand, W.M. (1971), Objective criteria for the evaluation of clustering methods, "Journal of the American Statistical Association", no. 336, 846-850. Available at: \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1080/01621459.1971.10482356")}.

See Also

replication.Mod

Examples

# Example 1
library(clusterSim)
dataSet<-cluster.Gen(model=5)
cl1<-dataSet$clusters
cl2<-kmeans(dataSet$data,2)$cluster
print(comparing.Partitions(cl1,cl2,type="rand"))

# Example 2
library(clusterSim)
data(data_patternGDM1)
z<-data.Normalization(data_patternGDM1,type="n1")
d<-dist.GDM(z,method="GDM1")
cl1<-pam(d,3,diss=TRUE)$clustering
cl2<-pam(d,4,diss=TRUE)$clustering
print(comparing.Partitions(cl1,cl2,type="crand"))

# Example 3
library(clusterSim)
data(data_patternGDM1)
z<-data.Normalization(data_patternGDM1,type="n9")
d<-dist.GDM(z,method="GDM1")
cl1<-pam(d,3,diss=TRUE)$clustering
hc<-hclust(d, method="complete")
cl2<-cutree(hc,k=3)
print(comparing.Partitions(cl1,cl2,type="nowak"))

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