View source: R/merge_selective_inference.R
merge_selective_inference | R Documentation |
Merged version of the selective test
merge_selective_inference(X, k1, k2, g, ndraws = 2000, cl_fun, cl)
X |
The data matrix of size on which the clustering is applied |
k1 |
The first cluster of interest |
k2 |
The second cluster of interest |
g |
The variables for which the test is applied |
ndraws |
The number of Monte-Carlo samples |
cl_fun |
The clustering function used to build clusters |
cl |
The labels of the data obtained thanks to the |
A list with the following elements
pval
: The resulting p-values of the test.
adjacent
: List of the adjacent clusters between k1 and k2
pval_adj
: The corresponding adjacent p-values that are merged
X <- matrix(rnorm(200),ncol = 2) hcl_fun <- function(x){ return(as.factor(cutree(hclust(dist(x), method = "ward.D2"), k=4)))} cl <- hcl_fun(X) plot(X, col=cl) #Note that in practice the value of ndraws (the number of Monte-Carlo simulations must be higher) test_var1 <- test_selective_inference(X, k1=1, k2=4, g=1, ndraws =100, cl_fun = hcl_fun, cl = cl)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.