Test the cluster membership using a user-defined clustering algorithm
jackstraw_cluster(
dat,
k,
cluster = NULL,
centers = NULL,
algorithm = function(x, centers) kmeans(x, centers, ...),
s = 1,
B = 1000,
center = TRUE,
noise = NULL,
covariate = NULL,
verbose = FALSE,
seed = NULL,
...
)
a data matrix with m
rows as variables and n
columns as observations.
a number of clusters.
a vector of cluster assignments.
a matrix of all cluster centers.
a clustering algorithm to use, where an output must include `cluster` and `centers`. For exact specification, see kmeans
.
a number of ``synthetic'' null variables. Out of m
variables, s
variables are independently permuted.
a number of resampling iterations.
a logical specifying to center the rows. By default, TRUE
.
specify a parametric distribution to generate a noise term. If NULL
, a non-parametric jackstraw test is performed.
a model matrix of covariates with n
observations. Must include an intercept in the first column.
a logical specifying to print the computational progress. By default, FALSE
.
a seed for the random number generator.
optional arguments to control the clustering algorithm.
jackstraw_cluster
returns a list consisting of
m
observed F statistics between variables and cluster centers.
F null statistics between null variables and cluster centers, from the jackstraw method.
m
p-values of membership.
The clustering algorithms 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 user is expected to explore the data with a given clustering algorithm and
determine the number of clusters k
.
Furthermore, provide cluster
and centers
as given by applying algorithm
onto dat
.
The rows of centers
correspond to k
clusters, as well as available levels in cluster
.
This function allows you to specify a parametric distribution of a noise term. It is an experimental feature.
Chung and Storey (2015) Statistical significance of variables driving systematic variation in high-dimensional data. Bioinformatics, 31(4): 545-554 https://academic.oup.com/bioinformatics/article/31/4/545/2748186
Chung (2020) Statistical significance of cluster membership for unsupervised evaluation of cell identities https://academic.oup.com/bioinformatics/article/36/10/3107/5788523