newFit: Fit a nb regression model

Description Usage Arguments Details Value Methods (by class) See Also Examples

Description

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

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
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)

See Also

model.matrix.

Examples

1
2
3
4
5
6
7
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))

NewWave documentation built on Dec. 26, 2020, 6 p.m.