perm.test: Permutation Test on Monothetic Tree

Description Usage Arguments Details Value Note References Examples

View source: R/perm.test.R

Description

Testing the significance of each monothetic clustering split by permutation methods. The "simple-withhold" method ("sw") shuffles the observations between two groups without the splitting variable. The other two methods shuffle the values in the splitting variable to create a new data set, then it either splits again on that variable ("resplit-limit", "rl") or use all variables as the splitting candidates ("resplit-nolimit", "rn").

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
perm.test(
  object,
  data,
  auto.pick = FALSE,
  sig.val = 0.05,
  method = c("sw", "rl", "rn"),
  rep = 1000L,
  stat = c("f", "aw"),
  bon.adj = TRUE,
  ncores = 1L
)

Arguments

object

The MonoClust object as the result of the clustering.

data

The data set which is being clustered.

auto.pick

Whether the algorithm stops when p-value becomes larger than sig.val or keeps testing and let the researcher pick the final splitting tree. Default value is FALSE.

sig.val

Significance value to decide when to stop splitting. This option is ignored if auto.pick = FALSE, and is 0.05 by default when auto.pick = TRUE.

method

Can be chosen between sw (simple-withhold, default), rl (resplit-limit), or rn (resplit-nolimit). See Details.

rep

Number of permutations required to calculate test statistic.

stat

Statistic to use. Choosing between "f" (Calinski-Harabasz's pseudo-F (Calinski and Harabasz, 1974)) or "aw" (Average silhoutte width by Rousseeuw (1987)).

bon.adj

Whether to adjust for multiple testing problem using Bonferroni correction.

ncores

Number of CPU cores on the current host. When set to NULL, all available cores are used.

Details

Permutation Methods

Simple-Withhold: Shuffle the observations between two proposed clusters

The stat calculated from the shuffles create the reference distribution to find the p-value. Because the splitting variable that was chosen is already the best in terms of reduction of inertia, that variable is withheld from the distance matrix used in the permutation test.

Resplit-Limit: Shuffle splitting variable, split again on that variable

This method shuffles the values of the splitting variables while keeping other variables fixed to create a new data set, then the chosen stat is calculated for each rep to compare with the observed stat.

Resplit-Nolimit: Shuffle splitting variable, split on all variables

Similar to Method 2 but all variables are splitting candidates.

Bonferroni Correction

A hypothesis test occurred lower in the monothetic clustering tree could have its p-value corrected for multiple tests happened before it in order to reach that node. The formula is

adj.p = unadj.p \times depth,

with depth is 1 at the root node.

Value

The same MonoClust object with an extra column (p-value), as well as the numofclusters object if auto.pick = TRUE.

Note

This function uses foreach::foreach() to facilitate parallel processing. It distributes reps to processes.

References

Calinski, T. and Harabasz, J (1974). "A dendrite method for cluster analysis". en. In: Communications in Statistics 3.1, pp. 1-27. doi: 10.1080/03610927408827101.

Rousseeuw, P. J. (1987). "Silhouettes: A graphical aid to the interpretation and validation of cluster analysis". In: Journal of Computational and Applied Mathematics 20, pp. 53-65. ISSN: 03770427. doi: 10.1016/0377-0427(87)90125-7.

Examples

1
2
3
4
5
6
7
library(cluster)
data(ruspini)

ruspini6sol <- MonoClust(ruspini, nclusters = 6)
ruspini6.p_value <- perm.test(ruspini6sol, data = ruspini, method = "sw",
                              rep = 1000)
ruspini6.p_value

monoClust documentation built on Feb. 15, 2021, 5:07 p.m.