zinbFit {zinbwave} | R Documentation |
Given an object with the data, it fits a ZINB model.
zinbFit(Y, ...) ## S4 method for signature 'SummarizedExperiment' zinbFit(Y, X, V, which_assay, commondispersion = TRUE, verbose = FALSE, nb.repeat.initialize = 2, maxiter.optimize = 25, stop.epsilon.optimize = 1e-04, BPPARAM = BiocParallel::bpparam(), ...) ## S4 method for signature 'matrix' zinbFit(Y, X, V, commondispersion = TRUE, verbose = FALSE, nb.repeat.initialize = 2, maxiter.optimize = 25, stop.epsilon.optimize = 1e-04, BPPARAM = BiocParallel::bpparam(), ...)
Y |
The data (genes in rows, samples in columns). |
... |
Additional parameters to describe the model, see
|
X |
The design matrix containing sample-level covariates, one sample per row. If missing, X will contain only an intercept. If Y is a SummarizedExperiment object, X can be a formula using the variables in the colData slot of Y. |
V |
The design matrix containing gene-level covariates, one gene per row. If missing, V will contain only an intercept. If Y is a SummarizedExperiment object, V can be a formula using the variables in the rowData slot of Y. |
which_assay |
numeric or character. Which assay of Y to use (only if Y is a SummarizedExperiment). |
commondispersion |
Whether or not a single dispersion for all features is estimated (default TRUE). |
verbose |
Print helpful messages. |
nb.repeat.initialize |
Number of iterations for the initialization of beta_mu and gamma_mu. |
maxiter.optimize |
maximum number of iterations for the optimization step (default 25). |
stop.epsilon.optimize |
stopping criterion in the optimization step, when the relative gain in likelihood is below epsilon (default 0.0001). |
BPPARAM |
object of class |
By default, i.e., if no arguments other than Y
are passed,
the model is fitted with an intercept for the regression across-samples and
one intercept for the regression across genes, both for mu and for pi.
This means that by default the model is fitted with X_mu =
X_pi = 1_n
and V_mu = V_pi = 1_J
. If the user explicitly passes the
design matrices, this behavior is overwritten, i.e., the user needs to
explicitly include the intercept in the design matrices.
If Y is a Summarized experiment, the function uses the assay named "counts", if any, or the first assay.
An object of class ZinbModel
that has been fitted by penalized
maximum likelihood on the data.
SummarizedExperiment
: Y is a
SummarizedExperiment
.
matrix
: Y is a matrix of counts (genes in rows).
se <- SummarizedExperiment(matrix(rpois(60, lambda=5), nrow=10, ncol=6), colData = data.frame(bio = gl(2, 3))) m <- zinbFit(se, X=model.matrix(~bio, data=colData(se))) bio <- gl(2, 3) m <- zinbFit(matrix(rpois(60, lambda=5), nrow=10, ncol=6), X=model.matrix(~bio))