nbinomDeviance: Negative Binomial Deviance

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/nbinomDeviance.R

Description

Fit the same log-link negative binomial or Poisson generalized linear model (GLM) to each row of a matrix of counts.

Usage

1
nbinomDeviance(y, mean, dispersion=0, weights=NULL)

Arguments

y

numeric matrix containing the negative binomial counts, with rows for genes and columns for libraries. A vector will be treated as a matrix with one row.

mean

numeric matrix of expected values, of same dimension as y. A vector will be treated as a matrix with one row.

dispersion

numeric vector or matrix of negative binomial dispersions, as for glmFit. Can be a scalar, a vector of length equal to nrow(y), or a matrix of same dimensions as y.

weights

numeric vector or matrix of non-negative weights, as for glmFit. Can be a scalar, a vector of length equal to ncol(y), or a matrix of same dimensions as y.

Details

Computes the total residual deviance for each row of y, i.e., weighted row sums of the unit deviances.

Care is taken to ensure accurate computation in limiting cases when the dispersion is near zero or mean*dispersion is very large.

Value

nbinomDeviance returns a numeric vector of length equal to the number of rows of y.

Author(s)

Gordon Smyth, Yunshun Chen, Aaron Lun. C++ code by Aaron Lun.

References

Dunn PK, Smyth GK (2018). Generalized linear models with examples in R. Springer, New York, NY. doi: 10.1007/978-1-4419-0118-7

Jorgensen B (2013). Generalized linear models. Encyclopedia of Environmetrics 3, Wiley. doi: 10.1002/9780470057339.vag010.pub2

McCarthy DJ, Chen Y, Smyth GK (2012). Differential expression analysis of multifactor RNA-Seq experiments with respect to biological variation. Nucleic Acids Research 40, 4288-4297. doi: 10.1093/nar/gks042

See Also

nbinomUnitDeviance

Examples

1
2
3
y <- matrix(1:6,3,2)
mu <- matrix(3,3,2)
nbinomDeviance(y,mu,dispersion=0.2)

hiraksarkar/edgeR_fork documentation built on Dec. 20, 2021, 3:52 p.m.