[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.3551345 2.6403854 0.7891176 0.6768871 1.6957872 1.1760363 3.2335386
#>  [8] 2.7240963 2.2320751 2.5265923
#> 
#> [[2]]
#>  [1] 1.2344521 0.4870609 0.6086769 0.6331897 1.7083927 1.5854916 0.4115175
#>  [8] 0.5895807 0.6017752 4.7628489
#> 
#> [[3]]
#>  [1] 0.4850548 0.3221032 0.1922588 0.3201009 1.5690963 0.2837889 0.2171369
#>  [8] 0.5139052 0.2703320 0.4445637
#> 
#> [[4]]
#>  [1] 0.1475969 0.1871711 0.1426781 0.8938035 0.1192441 0.4128474 0.4395875
#>  [8] 0.1194052 0.2903319 0.5641590
#> 

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