calculate_stability: Calculate the stability index of the obtained clusters when...

Description Usage Arguments Details Value

View source: R/ShinyFunctions.R

Description

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.

Usage

1
calculate_stability(consensus, k)

Arguments

consensus

consensus item of the sc3 slot of an object of 'SingleCellExperiment' class

k

number of clusters k

Details

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.

Value

a numeric vector containing a stability index of each cluster


hemberg-lab/SC3 documentation built on Dec. 18, 2019, 10:02 p.m.