View source: R/model_fitting.R
fit_marginals | R Documentation |
Fit the marginal distributions for each row of a count matrix
fit_marginals(
x,
marginal = c("auto_choose", "zinb", "nb", "poisson"),
pval_cutoff = 0.05,
epsilon = 1e-05,
jitter = TRUE,
DT = TRUE
)
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. |
pval_cutoff |
Cutoff of p-value of the lrt that determines whether there is zero inflation. |
epsilon |
Threshold value for preventing the transformed quantile to collapse to 0 or 1. |
jitter |
Logical, whether a random projection should be performed in the distributional transform. |
DT |
Logical, whether distributional transformed should be performed. If set to FALSE, the returned object u will be NULL. |
a list with the following components:
a matrix of shape p by 3. The values of each column are: the ZI proportion, the dispersion parameter (for Poisson, it's Inf), and the mean parameter.
NULL or a matrix of the same shape as x, which records the transformed quantiles, by DT.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.