newFit: Fit a nb regression model

newFitR Documentation

Fit a nb regression model

Description

Given an object with the data, it fits a nb model.

Usage

newFit(Y, ...)

## S4 method for signature 'SummarizedExperiment'
newFit(
  Y,
  X,
  V,
  K = 2,
  which_assay,
  commondispersion = TRUE,
  verbose = FALSE,
  maxiter_optimize = 100,
  stop_epsilon = 1e-04,
  children = 1,
  random_init = FALSE,
  random_start = FALSE,
  n_gene_disp = NULL,
  n_cell_par = NULL,
  n_gene_par = NULL,
  ...
)

## S4 method for signature 'matrix'
newFit(
  Y,
  X,
  V,
  K = 2,
  commondispersion = TRUE,
  verbose = FALSE,
  maxiter_optimize = 100,
  stop_epsilon = 1e-04,
  children = 1,
  random_init = FALSE,
  random_start = FALSE,
  n_gene_disp = NULL,
  n_cell_par = NULL,
  n_gene_par = NULL,
  ...
)

## S4 method for signature 'DelayedMatrix'
newFit(
  Y,
  X,
  V,
  K = 2,
  commondispersion = TRUE,
  verbose = FALSE,
  maxiter_optimize = 100,
  stop_epsilon = 1e-04,
  children = 1,
  random_init = FALSE,
  random_start = FALSE,
  n_gene_disp = NULL,
  n_cell_par = NULL,
  n_gene_par = NULL,
  ...
)

## S4 method for signature 'dgCMatrix'
newFit(Y, ...)

Arguments

Y

The matrix with the data

...

Additional parameters to describe the model, see newmodel.

X

The design matrix containing sample-level covariates, one sample per row. If missing, X will contain only an intercept.

V

The design matrix containing gene-level covariates, one gene per row. If missing, V will contain only an intercept.

K

integer. Number of latent factors(default 2).

which_assay

numeric or character. Which assay of Y to use. If missing, if 'assayNames(Y)' contains "counts" then that is used. Otherwise, the first assay is used.

commondispersion

Whether or not a single dispersion for all features is estimated (default TRUE).

verbose

Print helpful messages(default FALSE).

maxiter_optimize

maximum number of iterations for the optimization step (default 100).

stop_epsilon

stopping criterion in the optimization step, when the relative gain in likelihood is below epsilon (default 0.0001).

children

number of cores of the used cluster(default 1)

random_init

if TRUE no initializations is done(default FALSE)

random_start

if TRUE the setup of parameters is a random samplig(default FALSE)

n_gene_disp

number of genes used in mini-batch dispersion estimation approach(default NULL > all genes are used)

n_cell_par

number of cells used in mini-batch cell's related parameters estimation approach(default NULL > all cells are used)

n_gene_par

number of genes used in mini-batch gene's related parameters estimation approach(default NULL > all genes are used)

Details

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.

If Y is a Summarized experiment, the function uses the assay named "counts", if any, or the first assay.

Currently, if Y is a sparseMatrix, this calls the newFit method on as.matrix(Y)

Value

An object of class newmodel that has been fitted by penalized maximum likelihood on the data.

Methods (by class)

  • SummarizedExperiment: Y is a SummarizedExperiment.

  • matrix: Y is a matrix of counts (genes in rows).

  • DelayedMatrix: Y is a DeleyedMatrix of counts (genes in rows).

  • dgCMatrix: Y is a sparse matrix of counts (genes in rows).

See Also

model.matrix.

Examples

se <- SummarizedExperiment(matrix(rpois(60, lambda=5), nrow=10, ncol=6),
                           colData = data.frame(bio = gl(2, 3)))

m <- newFit(se, X=model.matrix(~bio, data=colData(se)))
bio <- gl(2, 3)
m <- newFit(matrix(rpois(60, lambda=5), nrow=10, ncol=6),
             X=model.matrix(~bio))

fedeago/NewWave documentation built on March 28, 2022, 5:46 a.m.