[Stable]

dist_inverse_gamma(shape, rate = 1/scale, scale)

Arguments

shape, scale

parameters. Must be strictly positive.

rate

an alternative way to specify the scale.

Examples

dist <- dist_inverse_gamma(shape = c(1,2,3,3), rate = c(1,1,1,2))
dist
#> <distribution[4]>
#> [1] InvGamma(1, 1)   InvGamma(2, 1)   InvGamma(3, 1)   InvGamma(3, 0.5)

mean(dist)
#> [1]   NA 1.00 0.50 0.25
variance(dist)
#> [1]     NA     NA 0.2500 0.0625
support(dist)
#> <support_region[4]>
#> [1] (0,Inf) (0,Inf) (0,Inf) (0,Inf)
generate(dist, 10)
#> [[1]]
#>  [1] 1.2682910 0.5054210 1.2527183 0.3847457 0.6180677 3.6852096 0.9082629
#>  [8] 2.5537300 1.0704954 1.7295030
#> 
#> [[2]]
#>  [1] 0.4353375 6.5229642 0.3495867 1.8060500 1.9831209 0.3501588 1.0943526
#>  [8] 2.9217763 1.1901692 3.9591525
#> 
#> [[3]]
#>  [1] 0.2914869 0.2238596 0.2629737 0.3278068 0.3744589 0.7670413 0.4616446
#>  [8] 0.2096319 0.2840958 0.5798200
#> 
#> [[4]]
#>  [1] 0.08786765 0.09484213 0.40803656 0.32871945 0.11891789 0.16774174
#>  [7] 0.05004681 0.14456958 0.54611588 0.26240868
#> 

density(dist, 2)
#> [1] 0.151632665 0.075816332 0.018954083 0.003042191
density(dist, 2, log = TRUE)
#> [1] -1.886294 -2.579442 -3.965736 -5.795177

cdf(dist, 4)
#> [1] 0.7788008 0.9735010 0.9978385 0.9997035

quantile(dist, 0.7)
#> [1] 2.8036733 0.9112869 0.5225272 0.2612636