robnb {DiPhiSeq}R Documentation

Calculates the estimate and standard error of beta and phi. It takes as input counts from one group of samples for a single gene. This function is the core underlining function of the whole package. A significant part of the code is edited based on William H. Aeberhard's glmrob.nb R function; we appreciate them very much for sharing their code online. This function also implement Algorithm 1 of our submitted paper about DiPhiSeq. This function is called by robtest. Most users don't need to call this function directly.

Description

Calculates the estimate and standard error of beta and phi. It takes as input counts from one group of samples for a single gene. This function is the core underlining function of the whole package. A significant part of the code is edited based on William H. Aeberhard's glmrob.nb R function; we appreciate them very much for sharing their code online. This function also implement Algorithm 1 of our submitted paper about DiPhiSeq. This function is called by robtest. Most users don't need to call this function directly.

Usage

robnb(y, log.depth, c.tukey.beta = 4, c.tukey.phi = 4, phi.ini = 0.5,
  alpha = 0.2, minphi = 0.01, maxphi = 5, maxit = 30, maxit.beta = 30,
  maxit.phi = 30, tol.beta = 0.01, tol.phi = 0.005)

Arguments

y

A count vector.

log.depth

Vector of log(sequencing depths).

c.tukey.beta

The c value for beta in Huber function. The default value should be appropriate for most datasets.

c.tukey.phi

The c value for phi in Huber function. The default value should be appropriate for most datasets.

phi.ini

The initial value of phi.

alpha

A positive value for setting initial values. The default value is usually appropriate.

minphi

A searching parameter for Algorithm 1 (check the algorithm for details.) The default value is usually appropriate.

maxphi

A searching parameter for Algorithm 1 (check the algorithm for details.) The default value is usually appropriate.

maxit

Maximum number of iterations for the outer loop. The default value is usually appropriate.

maxit.beta

Maximum number of iterations for the inner loop of solving beta. The default value is usually appropriate.

maxit.phi

Maximum number of iterations for the inner loop of solving phi. The default value is usually appropriate.

tol.beta

The numerical tolerance of solving beta. The default value is usually appropriate.

tol.phi

The numerical tolerance of solving phi. The default value is usually appropriate.

Value

A list that contains the elements: beta: the estimated (log) expression. phi: the estimated dispersion. fconv: flag of the convergence of the search. vars: the variance-covariance matrix of the estimates. sd.beta: the standard error of beta. sd.phi: the standard error of phi. y: the input y value. log.depth: log(sequencing depth).

Examples

d <- runif(10, min=1, max=2)
y <- rnbinom(10, size=1, mu=d*50)
res <- robnb(y, log(d))

[Package DiPhiSeq version 0.2.0 Index]