Fit a (w/o copula) model for a count matrix of a single cell type
Source:R/scDesign2_fit_revised.R
fit_wo_copula.Rd
This function only fits the marginal distribution for each gene.
Usage
fit_wo_copula(
x,
marginal = c("auto_choose", "zinb", "nb", "poisson"),
jitter = TRUE,
min_nonzero_num = 2
)
Arguments
- x
A matrix of shape p by n that contains count values.
- 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.
- min_nonzero_num
The minimum number of non-zero values required for a gene to be fitted a marginal model.
Value
The genes of x
will be partitioned into two groups. The first group contains
genes with at least min_non_zero_num
non-zero values. The second group contains the
other genes. For the first group, the marginal distribution of each gene will be fitted.
For the last group, no model will be fitted and only the index of these genes will be
recorded. A list that contains the above fitted model will be returned that contains the
following components.
- marginal_param1
A matrix of the parameters for the marginal distributions of genes in group one.
- gene_sel1
A numeric vector of the row indices of the genes in group one.
- gene_sel2
A numeric vector of the row indices of the genes in group two.
- min_non_zero_num
Same as the input.
- sim_method
A character string that says 'ind', short for 'independent'. To be distinguished with the copula model.