zscoreNBinom: Z-score Equivalents of Negative Binomial Deviate

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

View source: R/zscoreNBinom.R

Description

Compute z-score equivalents of negative binomial random deviates.

Usage

1
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

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

Example output

Loading required package: limma
[1] -3.2971933  0.1106404  9.3247707

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