fit_model_scDesign2: Fit models for a count matrix

View source: R/model_fitting.R

fit_model_scDesign2R Documentation

Fit models for a count matrix

Description

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.8,
  min_nonzero_num = 2,
  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 value is 'auto_choose' which chooses between ZINB, NB, ZIP and Poisson by a likelihood ratio test (lrt) and whether there is underdispersion. 'zinb' will fit the ZINB model. If there is underdispersion, it will choose between ZIP and Poisson by a lrt. Otherwise, it will try 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. 'nb' fits the NB model that chooses between NB and Poisson depending on whether there is underdispersion. '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.

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.


JSB-UCLA/scDesign2 documentation built on Nov. 2, 2024, 4:26 a.m.