Skip to contents

Fit models for a count matrix

Usage

fit_model_scDesign2(
  data_mat,
  cell_type_sel,
  sim_method = c("copula", "ind"),
  marginal = c("auto_choose", "zinb", "nb", "poisson"),
  jitter = TRUE,
  zp_cutoff = 0.9,
  min_nonzero_num = 3,
  ncores = 1
)

Arguments

data_mat

A matrix of shape p by n that contains count values. Each of its column names should be the cell type names of that cell. Its column names should also match cell_type_sel.

cell_type_sel

A character vector that contains the selected cell types for which a model will be fitted.

sim_method

Specification of the type of model. Default value is 'copula', which selects the copula model. 'ind' will select the (w/o copula) model.

marginal

Specification of the types of marginal distribution. Default is 'zinb'. 'poisson' simply fits the Poisson model. 'nb' fits the NB model that chooses between NB and Poisson depending on whether there is underdispersion. 'zinb' fits the ZINB model. If there is underdispersion, it chooses between ZIP and Poisson by a lrt. Otherwise, it tries to fit the ZINB model. If in this case, there is no zero at all or an error occurs, it will fit an NB model instead. 'auto' chooses among zinb, NB, ZIP. 'poisson' simply fits the Poisson model.

jitter

Logical, whether a random projection should be performed in the distributional transform.

zp_cutoff

The maximum propotion of zero allowed for a gene to be included in the joint copula model.

min_nonzero_num

The minimum number of non-zero values required for a gene to be fitted a marginal model.

ncores

A numeric value that indicates the number of parallel cores for model fitting. One core for each cell type.

Value

A list with the same length as cell_type_sel that contains the fitted model as each of its element.