jackstraw_kmeans: Non-Parametric Jackstraw for K-means Clustering

View source: R/jackstraw_kmeans.R

jackstraw_kmeansR Documentation

Non-Parametric Jackstraw for K-means Clustering

Description

Test the cluster membership for K-means clustering

Usage

jackstraw_kmeans(
  dat,
  kmeans.dat,
  s = NULL,
  B = NULL,
  center = FALSE,
  covariate = NULL,
  match = TRUE,
  pool = TRUE,
  verbose = FALSE,
  ...
)

Arguments

dat

a matrix with m rows as variables and n columns as observations.

kmeans.dat

an output from applying kmeans() onto dat.

s

a number of “synthetic” null variables. Out of m variables, s variables are independently permuted.

B

a number of resampling iterations.

center

a logical specifying to center the rows of the null samples. By default, TRUE.

covariate

a model matrix of covariates with n observations. Must include an intercept in the first column.

match

a logical specifying to match the observed clusters and jackstraw clusters using minimum Euclidean distances.

pool

a logical specifying to pool the null statistics across all clusters. By default, TRUE.

verbose

a logical specifying to print the computational progress. By default, FALSE.

...

optional arguments to control the k-means clustering algorithm (refers to kmeans).

Details

K-means clustering assign m rows into K clusters. This function enable statistical evaluation if the cluster membership is correctly assigned. Each of m p-values refers to the statistical test of that row with regard to its assigned cluster. Its resampling strategy accounts for the over-fitting characteristics due to direct computation of clusters from the observed data and protects against an anti-conservative bias.

The input data (dat) must be of a class 'matrix'.

Value

jackstraw_kmeans returns a list consisting of

F.obs

m observed F statistics between variables and cluster centers.

F.null

F null statistics between null variables and cluster centers, from the jackstraw method.

p.F

m p-values of membership.

Author(s)

Neo Christopher Chung nchchung@gmail.com

References

Chung (2020) Statistical significance of cluster membership for unsupervised evaluation of cell identities. Bioinformatics, 36(10): 3107–3114 \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1093/bioinformatics/btaa087")}

Examples

## Not run: 
dat = t(scale(t(Jurkat293T), center=TRUE, scale=FALSE))
kmeans.dat <- kmeans(dat, centers=2, nstart = 10, iter.max = 100)
jackstraw.out <- jackstraw_kmeans(dat, kmeans.dat)

## End(Not run)


jackstraw documentation built on Sept. 17, 2024, 1:07 a.m.