InvChiSq | R Documentation |
Density, distribution function and random generation for the inverse chi-squared distribution and scaled chi-squared distribution.
dinvchisq(x, nu, tau, log = FALSE)
pinvchisq(q, nu, tau, lower.tail = TRUE, log.p = FALSE)
qinvchisq(p, nu, tau, lower.tail = TRUE, log.p = FALSE)
rinvchisq(n, nu, tau)
x , q |
vector of quantiles. |
nu |
positive valued shape parameter. |
tau |
positive valued scaling parameter; if provided it returns values for scaled chi-squared distributions. |
log , log.p |
logical; if TRUE, probabilities p are given as log(p). |
lower.tail |
logical; if TRUE (default), probabilities are |
p |
vector of probabilities. |
n |
number of observations. If |
If X
follows \chi^2 (\nu)
distribution, then 1/X
follows inverse
chi-squared distribution parametrized by \nu
. Inverse chi-squared distribution
is a special case of inverse gamma distribution with parameters
\alpha=\frac{\nu}{2}
and \beta=\frac{1}{2}
;
or \alpha=\frac{\nu}{2}
and
\beta=\frac{\nu\tau^2}{2}
for scaled inverse
chi-squared distribution.
Chisquare
, GammaDist
x <- rinvchisq(1e5, 20)
hist(x, 100, freq = FALSE)
curve(dinvchisq(x, 20), 0, 1, n = 501, col = "red", add = TRUE)
hist(pinvchisq(x, 20))
plot(ecdf(x))
curve(pinvchisq(x, 20), 0, 1, n = 501, col = "red", lwd = 2, add = TRUE)
# scaled
x <- rinvchisq(1e5, 10, 5)
hist(x, 100, freq = FALSE)
curve(dinvchisq(x, 10, 5), 0, 150, n = 501, col = "red", add = TRUE)
hist(pinvchisq(x, 10, 5))
plot(ecdf(x))
curve(pinvchisq(x, 10, 5), 0, 150, n = 501, col = "red", lwd = 2, add = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.