zscore {limma} | R Documentation

## Transform non-normal random deviates to standard normal

### Description

Compute z-score equivalents of non-normal random deviates.

### Usage

    zscore(q, distribution, ...)
    zscoreGamma(q, shape, rate = 1, scale = 1/rate)
    zscoreHyper(q, m, n, k)

### Arguments

`q` | numeric vector or matrix giving deviates of a random variable
`distribution` | character name of probabability distribution for which a cumulative distribution function exists
`...` | other arguments specify distributional parameters and are passed to the cumulative distribution function
`shape` | gamma shape parameter (>0)
`rate` | gamma rate parameter (>0)
`scale` | gamma scale parameter (>0)
`m` | as for `qhyper`
`n` | as for `qhyper`
`k` | as for `qhyper`

### Details

These functions compute the standard normal deviates which have the same quantiles as the given values in the specified distribution. For example, if `z <- zscoreGamma(x, shape, rate)` then `pnorm(z)` equals `pgamma(x, shape, rate)`.

`zscore` works for any distribution for which a cumulative distribution function (like `pnorm`) exists in R. The argument `distribution` is the name of the cumulative distribution function with the `"p"` removed.

`zscoreGamma` and `zscoreHyper` are specific functions for the gamma and hypergeometric distributions respectively.

The transformation to z-scores is done by converting to log tail probabilities, and then using `qnorm`. For numerical accuracy, the left or right tail is used, depending on which is likely to be smaller.

### Value

Numeric vector or matrix of equivalent deviates from the standard normal distribution.

### Author(s)

Gordon Smyth

### See Also

`zscoreT`.

`zscoreNBinom` in the edgeR package.

`qnorm` in the stats package.

### Examples

    # These are all equivalent
    zscore(c(1,2.5), dist="gamma", shape=0.5, scale=2)
    zscore(c(1,2.5), dist="chisq", df=1)
    zscoreGamma(c(1,2.5), shape=0.5, scale=2)

[Package limma version 3.42.2 Index]