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)
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] 1.9016494 0.6821781 0.8838798 43.2110479 0.9627293 0.3216433
#> [7] 3.5728557 1.1267577 0.6926790 8.1519486 3.8917801 0.6603720
#> [13] 96.3678371 0.4465320 1.3857696 1.1778767 2.3916497 0.5945125
#> [19] 2.9865776 2.3985589 0.9382666 1.2940753 0.4783434 1.8108502
#> [25] 0.3190744 0.1874310 12.0142534 0.6575729 0.6795114 0.5025854
#> [31] 2.5502824 0.5485328 7.8547933 2.8733430 3.6970014 0.7854427
#> [37] 1.7540894 1.3172715 0.5781822 37.8384551 2.4847504 0.7950980
#> [43] 3.7688737 5.1461741 13.2975012 7.1454609 0.8063314 0.3863400
#> [49] 2.3339125 0.3122662 64.7762844 2.4377386 162.6405670 3.5126051
#> [55] 1.1402587 7.5171413 0.4312803 1.3225483 0.7468765 7.3894906
#> [61] 12.3562802 9.0798559 3.6263994 2.0857028 2.0298622 1.6741318
#> [67] 1.3181996 0.4923331 0.4009200 0.4967066 0.5959504 0.4628702
#> [73] 5.5408177 1.5586563 1.0934053 2.1239243 4.5799413 0.4346557
#> [79] 1.2439756 2.5793766 0.4924331 1.0940504 272.9588328 27.1022658
#> [85] 0.9459965 4.0250192 1.2334103 0.6109278 0.5588355 0.6637669
#> [91] 20.2204337 0.6100783 2.8103526 0.5865932 6.1105303 3.0850092
#> [97] 0.4082117 6.4973408 1.0950702 0.8311981
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))