compareGap: Compare different clusterings of the same phylogenetic tree...

Description Usage Arguments Value Author(s) References Examples

View source: R/ClustCompare.R

Description

A function that compares a set of clustering schemes by PAM or EM and computes the gap statistics from a given range of k.

Usage

1
compareGap(distM, k.max, clusterings = NULL, B = 100L, method = "PAM")

Arguments

distM

A distance matrix of tree leaves.

k.max

An integer that is at least 2, indicating the max number of clusters desired for the tree.

clusterings

A list of k.max - 1 positive integer vectors. Each positive integer vector is usually the clustering output of clustPAM or clustEM, in which each leaf node is associated with an integer representing the cluster it is assigned. Each positive integer vector must be the same length as the number of leaves in the tree. Clustering vectors must indicate the clustering scheme of the tree from 2 clusters (k = 2) to k.max clusters (k = k.max). Clustering vectors must be ordered in the list by increasing number of clusters. Default value of clusterings is NULL, in which case EM or PAM clustering will be performed on distM over 2 <= k <= k.max depending on the method argument.

B

An integer indicating the number of bootstrap samples. Default value is 100.

method

A character string that is either "PAM" or "EM", indicating the clustering method in case clustering is not given. This argument is ignored if clustering is given. Default value is "PAM".

Value

An S3 object of "clusGap" with gap statistics.

Author(s)

Yuzi Li, rainal.li@mail.utoronto.ca

References

Maechler M, Rousseeuw P, Struyf A, Hubert M, Hornik K (2021). cluster: Cluster Analysis Basics and Extensions. R package version 2.1.2

Examples

1
2
3
4
5
pam <- clustPAM(6, text = NwkTree2)
set.seed(5)
gapStat <- compareGap(distM = pam$distM, k.max = 10, method = "PAM")
gapStat$Tab
set.seed(NULL)

rainali475/ClustPhy documentation built on Dec. 22, 2021, 12:03 p.m.