Evaluate or Compare the Quality of Clusters Quantitatively
This function is a wrapper to two functions: intCriteria
function in
package clusterCrit, and NbClust
in package NbClust. It
can be used to quantitatively compare different clustering options.
evalClusters( spectra, pkg = "NbClust", hclst = NULL, k = NULL, h = NULL, crit = "Dunn", ... )
spectra |
An object of S3 class |
pkg |
Character. One of |
hclst |
An object of S3 class |
k |
Integer. The number of groups in which to cut the tree
( |
h |
Numeric. The height at which to cut the tree. Either |
crit |
String. A string giving the criteria to be used in evaluating
the quality of the cluster. See |
... |
Other parameters to be passed to the functions. In particular,
the default |
Both of the packages used here compute very similar quantities. For details, see the publication and respective vignettes. Package clusterCrit takes the approach in which you cluster in a separate step using whatever parameters you like, then the tree is cut either at a given height or in such a way as to produce a fixed number of groups. One or more indices are then computed. Then, you repeat this process with different clustering criteria, and compare. Package NbClust allows one to specify a range of possible number of clusters and a few other parameters and will return indices corresponding to each set options, which is somewhat more automated.
A list giving the results, as described in intCriteria
or
NbClust
.
Bryan A. Hanson, DePauw University.
M. Charrad et. al. "NbClust: An R Package for Determining the Relevant Number of Clusters in a Data Set." J. Stat. Soft. vol. 61 no. 6 October 2014.
hclust
for the underlying base function.
hcaSpectra
for HCA analysis of a Spectra
object.
hcaScores
for HCA analysis of PCA scores from a
Spectra
object. Additional documentation at
https://bryanhanson.github.io/ChemoSpec/
# These are a little slow for CRAN checking ## Not run: data(metMUD2) # Using clusterCrit res1 <- hcaSpectra(metMUD2) # default clustering and distance methods res2 <- hcaSpectra(metMUD2, d.method = "cosine") # The return value from hcaSpectra is a list with hclust as the first element. crit1 <- evalClusters(metMUD2, pkg = "clusterCrit", hclst = res1[[1]], k = 2) crit2 <- evalClusters(metMUD2, pkg = "clusterCrit", hclst = res2[[1]], k = 2) # crit1 and crit2 can now be compared. # Using NbClust res3 <- evalClusters(metMUD2, min.nc = 2, max.nc = 5, method = "average", index = "kl") ## End(Not run)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.