Density, distribution function, quantile function and
random generation for the inverse-Gamma distribution
with parameters a
and b
.
digam(x, a, b, log = FALSE)
rigam(n, a, b)
pigam(q, a, b, lower.tail = TRUE, log.p = FALSE)
qigam(p, a, b, lower.tail = TRUE, log.p = FALSE)
vector of quantiles.
parameters a
and b
. Must be positive.
logical; if TRUE
, probabilities/densities \(p\) are
returned as \(log(p)\).
number of observations.
logical; if TRUE
, probabilities are \(P[X\leq x]\),
otherwise, \(P[X>x]\).
vector of probabilities.
digam gives the density, pigam gives the distribution function, qigam gives the quantile function, and rigam generates random deviates.
Invalid arguments will result in return value NaN, with a warning.
The length of the result is determined by n
for rig.
The inverse-Gamma distribution has density given by $$f(x; a, b) = \frac{b^a}{\Gamma(a)}x^{a-1}\exp( -\frac{b}{x}),$$ where \(x>0\) and \(a,b>0\).
rigam(100, a = 1, b = 1)
#> [1] 0.4995765 3.7668682 0.9883241 1.6821348 0.3383608 0.9627293
#> [7] 0.3216433 3.5728557 1.1267577 0.6926790 8.1519486 3.8917801
#> [13] 0.6603720 96.3678371 0.4465320 1.3857696 1.1778767 2.3916497
#> [19] 0.5945125 2.9865776 2.3985589 0.9382666 1.2940753 0.4783434
#> [25] 1.8108502 0.3190744 0.1874310 12.0142534 0.6575729 0.6795114
#> [31] 0.5025854 2.5502824 0.5485328 7.8547933 2.8733430 3.6970014
#> [37] 0.7854427 1.7540894 1.3172715 0.5781822 37.8384551 2.4847504
#> [43] 0.7950980 3.7688737 5.1461741 13.2975012 7.1454609 0.8063314
#> [49] 0.3863400 2.3339125 0.3122662 64.7762844 2.4377386 162.6405670
#> [55] 3.5126051 1.1402587 7.5171413 0.4312803 1.3225483 0.7468765
#> [61] 7.3894906 12.3562802 9.0798559 3.6263994 2.0857028 2.0298622
#> [67] 1.6741318 1.3181996 0.4923331 0.4009200 0.4967066 0.5959504
#> [73] 0.4628702 5.5408177 1.5586563 1.0934053 2.1239243 4.5799413
#> [79] 0.4346557 1.2439756 2.5793766 0.4924331 1.0940504 272.9588328
#> [85] 27.1022658 0.9459965 4.0250192 1.2334103 0.6109278 0.5588355
#> [91] 0.6637669 20.2204337 0.6100783 2.8103526 0.5865932 6.1105303
#> [97] 3.0850092 0.4082117 6.4973408 1.0950702
pigam(0.4, a = 1, b = 1)
#> [1] 0.082085
qigam(0.8, a = 1, b = 1)
#> [1] 4.48142
plot(function(x){digam(x, a = 1, b = 1)}, main =
"Inverse-Gamma density", ylab = "Probability density",
xlim = c(0,10))