Learn R Programming

fastmatrix (version 0.5-7721)

wilson.hilferty: Wilson-Hilferty transformation

Description

Returns the Wilson-Hilferty transformation of random variables with Gamma distribution.

Usage

wilson.hilferty(x, shape, rate = 1)

Arguments

x

a numeric vector containing Gamma distributed deviates.

shape, rate

shape and rate parameters. Must be positive.

Details

Let \(X\) be a random variable following a Gamma distribution with parameters \(a\) = shape and \(b\) = rate with density $$ f(x) = \frac{b^a}{\Gamma(a)} x^{a-1}\exp(-bx),$$ where \(x \ge 0\), \(a > 0\), \(b > 0\) and consider the random variable \(T = X/(a/b)\). Thus, the Wilson-Hilferty transformation $$z = \frac{T^{1/3} - (1 - \frac{1}{9a})}{(\frac{1}{9a})^{1/2}}$$ is approximately distributed as a standard normal distribution. This is useful, for instance, in the construction of QQ-plots.

References

Terrell, G.R. (2003). The Wilson-Hilferty transformation is locally saddlepoint. Biometrika 90, 445-453.

Wilson, E.B., and Hilferty, M.M. (1931). The distribution of chi-square. Proceedings of the National Academy of Sciences of the United States of America 17, 684-688.

See Also

WH.normal

Examples

Run this code
x <- rgamma(n = 300, shape = 2, rate = 1)
z <- wilson.hilferty(x, shape = 2, rate = 1)
par(pty = "s")
qqnorm(z, main = "Transformed Gamma QQ-plot")
abline(c(0,1), col = "red", lwd = 2, lty = 2)

Run the code above in your browser using DataLab