Transform non-normal random deviates to standard normal
Compute z-score equivalents of non-normal random deviates.
zscore(q, distribution, ...) zscoreGamma(q, shape, rate = 1, scale = 1/rate) zscoreHyper(q, m, n, k)
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 |
n |
as for |
k |
as for |
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.
Numeric vector or matrix of equivalent deviates from the standard normal distribution.
Gordon Smyth
zscoreNBinom
in the edgeR package.
qnorm
in the stats package.
# 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)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.