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

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

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. https://doi.org/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)

Example output

Loading required package: limma
[1] 1.4363222 0.8929643 1.3117841

edgeR documentation built on Jan. 16, 2021, 2:03 a.m.