Learn R Programming

VALIDICLUST (version 0.1.0)

test_multimod: Multimodality test for post clustering variable involvement

Description

Multimodality test for post clustering variable involvement

Usage

test_multimod(X, g, cl, k1, k2)

Value

A list containing : A list with the following elements

  • data_for_test : The data used for the test

  • stat_g : The dip statistic

  • pval : The resulting p-values of the test computed with the diptest function

Arguments

X

The data matrix of size on which the clustering is applied

g

The variable on which the test is applied

cl

The labels of the data obtained thanks to a clustering algorithm

k1

The first cluster of interest

k2

The second cluster of interest

Examples

Run this code
X <- matrix(rnorm(200),ncol = 2)
hcl_fun <- function(x){
return(as.factor(cutree(hclust(dist(x), method = "ward.D2"), k=2)))}
cl <- hcl_fun(X)
plot(X, col=cl)
test_var1 <- test_multimod(X, g=1, k1=1, k2=2, cl = cl)
test_var2 <- test_multimod(X, g=2, k1=1, k2=2, cl = cl)

Run the code above in your browser using DataLab