View source: R/nbinomDeviance.R
nbinomUnitDeviance | R Documentation |
Compute unit deviances for the negative binomial distribution.
nbinomUnitDeviance(y, mean, dispersion = 0)
y |
numeric vector or matrix containing negative binomial counts. |
mean |
numeric vector or matrix of expected values. If a matrix, then of same dimensions as |
dispersion |
numeric vector or matrix of negative binomial dispersions.
Can be a scalar, a vector of length |
The unit deviance of the negative binomial distribution is a measure of the distance between y
and mean.
If mean
and dispersion
are the true mean and dispersion of the negative binomial distribution, then the unit deviance follows an approximate chisquare distribution on 1 degree of freedom.
This function computes the unit deviance for each y
observation.
Care is taken to ensure accurate computation in limiting cases when the dispersion is near zero or mean*dispersion
is very large.
Numeric vector or matrix of the same size as y
containing unit deviances.
Gordon Smyth, Yunshun Chen, Aaron Lun. C++ code by Aaron Lun.
Dunn PK, Smyth GK (2018). Generalized linear models with examples in R. Springer, New York, NY. doi: 10.1007/978-1-4419-0118-7 ISBN: 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
y <- 1:4 names(y) <- letters[1:4] nbinomUnitDeviance(y,mean=2.5,dispersion=0.2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.