Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

zscoreNBinom

Z-score Equivalents of Negative Binomial Deviate


Description

Compute z-score equivalents of negative binomial random deviates.

Usage

zscoreNBinom(q, size, mu, method = "midp")

Arguments

q

numeric vector or matrix of non-negative quantiles.

size

numeric vector of non-negative size parameters.

mu

numeric vector of means.

method

method for converting from discrete to continuous distribution. Possible values are "midp" or "random".

Details

The mid-p method (method=="midp") applies a continuity correction by splitting the probability mass of each integer in two. It computes the mid-p tail probability of q, then converts to the standard normal deviate with the same cumulative probability distribution value. Care is taken to do the computations accurately in both tails of the distributions.

The randomized method (method=="random") computes randomized quantile residuals (Dunn and Smyth, 1996). In this method, the tail probabilities are randomized over the possible values covered by the discrete integer counts. If q follows a negative binomial distribution with the size and mean correctly specified, then the z-values generated by the randomized method are exactly standard normal.

Non-integer values of q are allowed. The mid-p method handles non-integer values by interpolation while the randomized method rounds q to integers.

Value

Numeric vector or matrix giving equivalent quantiles from the standard normal distribution.

Author(s)

Gordon Smyth

References

Berry, G., & Armitage, P. (1995). Mid-P confidence intervals: a brief review. The Statistician, 417-423.

Dunn, K. P., and Smyth, G. K. (1996). Randomized quantile residuals. Journal of Computational and Graphical Statistics 5, 1-10. http://www.statsci.org/smyth/pubs/residual.html

See Also

pnbinom, qnorm in the stats package.

Examples

zscoreNBinom(c(0,10,100), mu=10, size=10)

edgeR

Empirical Analysis of Digital Gene Expression Data in R

v3.32.1
GPL (>=2)
Authors
Yunshun Chen, Aaron TL Lun, Davis J McCarthy, Matthew E Ritchie, Belinda Phipson, Yifang Hu, Xiaobei Zhou, Mark D Robinson, Gordon K Smyth
Initial release
2021-01-14

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.