selectK: selectK.

Description Usage Arguments Details Value Examples

View source: R/SC-MEB.R

Description

The function selectK is used to select the best K according to BIC or Modified BIC criterion.

Usage

1
selectK(SCobject, K_set = 2:10, criterion = "BIC", c = 1)

Arguments

SCobject

is an object generated from SC.MEB function.

K_set

is a integer vector used in SC.MEB. The default is 2:10

criterion

is a character specifying the criterion for selecting K. The default value is BIC. The alternative value MBIC can also be used.

c

is a positive value in the modified BIC. The default is 1. Here we briefly explain how to choose the parameter c in the modified BIC. In general, For the ST or Visium dataset, it often ranges from 0.4 to 1 while for the MERFISH dataset with large number of cells, it often becomes larger, for example 10,20. Most importantly, SC-MEB is fast, scaling well in terms of sample size, which allow the user to tune the c based on their prior knowledge about the tissues or cells.

Details

The function selectK is used to select the best K according to BIC or Modified BIC criterion.

Value

a list contains two items. one is for the best K and the other is the clustering labels of n spots.

Examples

1
2
3
4
5
6
7
y = matrix(rnorm(50, 0, 1), 25,2)
pos = cbind(rep(1:5, each=5), rep(1:5, 5))
Adj_sp = getneighborhood_fast(pos, 1.2)
beta_grid = c(0.5,1)
K_set = 2:3
out = SC.MEB(y, Adj_sp, beta_grid, K_set, TRUE, 2)
selectK(out, K_set)

SC.MEB documentation built on Oct. 8, 2021, 9:08 a.m.