Description Usage Arguments Details Value
View source: R/ShinyFunctions.R
Stability index shows how stable each cluster is accross the selected range of k
.
The stability index varies between 0 and 1, where
1 means that the same cluster appears in every solution for different k
.
1 | calculate_stability(consensus, k)
|
consensus |
consensus item of the sc3 slot of an object of 'SingleCellExperiment' class |
k |
number of clusters k |
Imagine a given cluster is split into N
clusters when k
is changed (all possible
values of k
are provided via ks
argument in the main sc3
function).
In each of the new clusters there are given_cells
of the given cluster and also some
extra_cells
from other clusters. Then we define stability as follows:
\frac{1}{ks*N^2}∑_{ks}∑_{N}\frac{given\_cells}{given\_cells + extra\_cells}
Where one N
corrects for the number of clusters and the other N
is a penalty
for splitting the cluster. ks
corrects for the range of k
.
a numeric vector containing a stability index of each cluster
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.