zscore: Z-score Equivalents

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

Description

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

Usage

1
2
3
4
5
zscore(q, distribution, ...)
zscoreGamma(q, shape, rate = 1, scale = 1/rate) 
zscoreT(x, df)
tZscore(x, df)
zscoreHyper(q, m, n, k) 

Arguments

q, x

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

shape

gamma shape parameter (>0)

rate

gamma rate parameter (>0)

scale

gamma scale parameter (>0)

df

degrees of freedom (>0 for zscoreT or >=1 for tZscore)

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 <- zscoreT(x,df=df) then pnorm(z) equals pt(x,df=df).

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, zscoreT and zscoreHyper are specific functions for the gamma, t and hypergeometric distributions respectively.

tZscore is the inverse of zscoreT, and computes t-distribution equivalents for standard normal deviates.

Care is taken to do the computations accurately in both tails of the distributions.

Value

Numeric vector giving equivalent deviates from the standard normal distribution. The exception is tZscore which gives deviates from the specified t-distribution.

Author(s)

Gordon Smyth

See Also

qnorm, pgamma, pt in the stats package.

Examples

1
2
3
4
5
6
7
# First three are 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)

zscoreT(2, df=3)
tZscore(2, df=3)

richierocks/limma2 documentation built on May 27, 2019, 8:47 a.m.