zscore(q, distribution, ...)
zscoreGamma(q, shape, rate = 1, scale = 1/rate)
zscoreT(x, df, approx=FALSE)
tZscore(x, df)
zscoreHyper(q, m, n, k)
zscoreT
or >=1 for tZscore
)TRUE
then a fast approximation is used to convert t-statistics into z-scores. If FALSE
, z-scores will be exact.qhyper
qhyper
qhyper
tZscore
which gives deviates from the specified t-distribution.
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.
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.
If approx=TRUE
, then the approximation from Hill (1970) is used to convert t-statistics to z-scores directly without computing tail probabilities.
Brophy (1987) showed this to be most accurate of a variety of possible closed-form transformations.
Brophy, AL (1987). Efficient estimation of probabilities in the t distribution. Behavior Research Methods 19, 462--466.
qnorm
, pgamma
, pt
in the stats package.
# 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)
Run the code above in your browser using DataLab