View source: R/wilson_hilferty.R
wilson.hilferty | R Documentation |
Returns the Wilson-Hilferty transformation of random variables with Gamma distribution.
wilson.hilferty(x, shape, rate = 1)
x |
a numeric vector containing Gamma distributed deviates. |
shape , rate |
shape and rate parameters. Must be positive. |
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.
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.
WH.normal
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.