optimal_rank: Determine optimal rank

Description Usage Arguments Details Value Examples

View source: R/utils2.R

Description

Takes as main argument scNMFSet object containing factorized output and estimate the optimal rank.

Usage

1
2
optimal_rank(object, df = 10, BF.threshold = 3, type = NULL,
  m = NULL)

Arguments

object

scNMFSet object containing factorization output, or data frame containing the rank-evidence profile.

df

Degrees of freedom for split fit. Upper bound is the total number of data points (number of rank values scanned).

BF.threshold

Bayes factor threshold for statistical threshold.

type

c(1,2). Type 1 is where there is a clear maximum. Type 2 is where marginal likelihood reaches a maximal level and stays constant. If omitted, the type will be inferred from data.

m

Number of features (e.g., genes) in the count matrix. Only necessary when object is of type data.frame.

Details

The input object is used along with Bayes factor threshold to determine the heterogeneity type (1 or 2) and the optimal rank. If evidence(rank 1)/evidence(rank2) > BF.treshold, rank 1 is favorable than rank 2.

Value

List containing type and ropt (optimal rank).

Examples

1
2
3
4
5
6
set.seed(1)
x <- simulate_whx(nrow=50, ncol=100, rank=5)
s <- scNMFSet(x$x)
s <- vb_factorize(s, ranks=seq(2,8), nrun=5)
plot(s)
optimal_rank(s)

ccfindR documentation built on Nov. 8, 2020, 5:12 p.m.