newmodel: Initialize an object of class newmodel

View source: R/helper_methods.R

newmodelR Documentation

Initialize an object of class newmodel

Description

Initialize an object of class newmodel

Usage

newmodel(
  X,
  V,
  W,
  beta,
  gamma,
  alpha,
  zeta,
  epsilon,
  epsilon_beta,
  epsilon_gamma,
  epsilon_W,
  epsilon_alpha,
  epsilon_zeta,
  n,
  J,
  K
)

Arguments

X

matrix. The design matrix containing sample-level covariates, one sample per row.

V

matrix. The design matrix containing gene-level covariates, one gene per row.

W

matrix. The factors of sample-level latent factors.

beta

matrix or NULL. The coefficients of X in the regression of mu.

gamma

matrix or NULL. The coefficients of V in the regression of mu.

alpha

matrix or NULL. The coefficients of W in the regression of mu.

zeta

numeric. A vector of log of inverse dispersion parameters.

epsilon

nonnegative scalar. Regularization parameter.

epsilon_beta

nonnegative scalar. Regularization parameter for beta.

epsilon_gamma

nonnegative scalar. Regularization parameter for gamma.

epsilon_W

nonnegative scalar. Regularization parameter for W.

epsilon_alpha

nonnegative scalar. Regularization parameter for alpha

epsilon_zeta

nonnegative scalar. Regularization parameter for zeta.

n

integer. Number of samples.

J

integer. Number of genes.

K

integer. Number of latent factors.

Details

This is a wrapper around the new() function to create an instance of class newmodel. Rarely, the user will need to create a newmodel object from scratch, as tipically this is the result of newFit.

If any of X, V, W matrices are passed, n, J, and K are inferred. Alternatively, the user can specify one or more of n, J, and K.

The regularization parameters can be set by a unique parameter epsilon or specific values for the different regularization parameters can also be provided. If only epsilon is specified, the other parameters take the following values:

  • epsilon_beta = epsilon/J

  • epsilon_gamma = epsilon/n

  • epsilon_W = epsilon/n

  • epsilon_alpha = epsilon/J

  • epsilon_zeta = epsilon

We empirically found that large values of epsilon provide a more stable estimation of W.

A call with no argument has the following default values: n = 50, J = 100, K = 0, epsilon=J.

Although it is possible to create new instances of the class by calling this function, this is not the most common way of creating newmodel objects. The main use of the class is within the newFit function.

Value

an object of class newmodel.

Examples

a <- newmodel()
numberSamples(a)
numberFeatures(a)
numberFactors(a)

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