View source: R/dist_inverse_gamma.R
| dist_inverse_gamma | R Documentation |
The Inverse Gamma distribution is commonly used as a prior distribution in Bayesian statistics, particularly for variance parameters.
dist_inverse_gamma(shape, rate = 1/scale, scale)
shape, scale |
parameters. Must be strictly positive. |
rate |
an alternative way to specify the scale. |
We recommend reading this documentation on pkgdown which renders math nicely. https://pkg.mitchelloharawild.com/distributional/reference/dist_inverse_gamma.html
In the following, let X be an Inverse Gamma random variable with
shape parameter shape = \alpha and rate parameter
rate = \beta (equivalently, scale = 1/\beta).
Support: x \in (0, \infty)
Mean: \frac{\beta}{\alpha - 1} for \alpha > 1,
otherwise undefined
Variance: \frac{\beta^2}{(\alpha - 1)^2 (\alpha - 2)}
for \alpha > 2, otherwise undefined
Probability density function (p.d.f):
f(x) = \frac{\beta^\alpha}{\Gamma(\alpha)} x^{-\alpha - 1}
e^{-\beta/x}
Cumulative distribution function (c.d.f):
F(x) = \frac{\Gamma(\alpha, \beta/x)}{\Gamma(\alpha)} =
Q(\alpha, \beta/x)
where \Gamma(\alpha, z) is the upper incomplete gamma function and
Q is the regularized incomplete gamma function.
Moment generating function (m.g.f):
M_X(t) = \frac{2 (-\beta t)^{\alpha/2}}{\Gamma(\alpha)}
K_\alpha\left(\sqrt{-4\beta t}\right)
for t < 0, where K_\alpha is the modified Bessel function
of the second kind. The MGF does not exist for t \ge 0.
actuar::InverseGamma
dist <- dist_inverse_gamma(shape = c(1,2,3,3), rate = c(1,1,1,2))
dist
mean(dist)
variance(dist)
support(dist)
generate(dist, 10)
density(dist, 2)
density(dist, 2, log = TRUE)
cdf(dist, 4)
quantile(dist, 0.7)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.