Learn R Programming

kmed (version 0.4.2)

csv: Centroid shadow value (CSV) index and plot

Description

This function computes centroid shadow values and shadow value plots of each cluster. The plot presents the mean of the shadow values as well.

Usage

csv(distdata, idmedoid, idcluster, title = "")

Value

Function returns a list with following components:

result is a data frame of the shadow values for all objects

plot is the shadow value plots of each cluster.

Arguments

distdata

A distance matrix (n x n) or dist object.

idmedoid

A vector of id medoids (see Details).

idcluster

A vector of cluster membership (see Details).

title

A title of the plot.

Author

Weksi Budiaji
Contact: budiaji@untirta.ac.id

Details

The origin of the centroid shadow value is calculated in the shadow function of the flexclust package, in which it is based on the first and second closest centroid. The csv function in this package modifies the centroid into medoid such that the formula to compute shadow value of object i is $$csv(i) = \frac{2d(i, m(i))}{d(i, m(i)) + d(i, m'(i))}$$ where \(d(i, m(i))\) is the distance between object i to the first closest medoid and d(i, m'(i)) is the distance between object i to the second closest medoid.

The idmedoid argument corresponds to the idcluster argument. If the length of idmedoid is 3, for example, the idcluster has to have 3 unique cluster memberships, or it returns Error otherwise. The length of the idcluster has also to be equal to n (the number of objects). In contrast to the silhoutte value, the centoird shadow value is interpreted that lower value is the better cluster separation.

References

F. Leisch. 2010 Neighborhood graphs, stripes and shadow plots for cluster visualization. Statistics and Computing. vol. 20, pp. 457-469

W. Budiaji. 2019 Medoid-based shadow value validation and visualization. International Journal of Advances in Intelligent Informatics. Vol 5 No 2 pp. 76-88

Examples

Run this code
distiris <- as.matrix(dist(iris[,1:4]))
res <- fastkmed(distiris, 3)
sha <- csv(distiris, res$medoid, res$cluster)
sha$result[c(1:3,70:75,101:103),]
sha$plot

Run the code above in your browser using DataLab