Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

InvGamma

The Inverse Gamma Distribution


Description

Density function and random generation from the inverse gamma distribution.

Usage

dinvgamma(x, shape, scale = 1)

rinvgamma(n, shape, scale = 1)

Arguments

x

Scalar location to evaluate density.

shape

Scalar shape parameter.

scale

Scalar scale parameter (default value one).

n

Number of draws from the distribution.

Details

An inverse gamma random variable with shape a and scale b has mean \frac{b}{a-1} (assuming a>1) and variance \frac{b^2}{(a-1)^2(a-2)} (assuming a>2).

Value

dinvgamma evaluates the density at x.

rinvgamma takes n draws from the inverse Gamma distribution. The parameterization is consistent with the Gamma Distribution in the stats package.

References

Andrew Gelman, John B. Carlin, Hal S. Stern, and Donald B. Rubin. 2004. Bayesian Data Analysis. 2nd Edition. Boca Raton: Chapman & Hall.

See Also

Examples

density <- dinvgamma(4.2, 1.1)
draws <- rinvgamma(10, 3.2)

MCMCpack

Markov Chain Monte Carlo (MCMC) Package

v1.5-0
GPL-3
Authors
Andrew D. Martin [aut], Kevin M. Quinn [aut], Jong Hee Park [aut,cre], Ghislain Vieilledent [ctb], Michael Malecki[ctb], Matthew Blackwell [ctb], Keith Poole [ctb], Craig Reed [ctb], Ben Goodrich [ctb], Ross Ihaka [cph], The R Development Core Team [cph], The R Foundation [cph], Pierre L'Ecuyer [cph], Makoto Matsumoto [cph], Takuji Nishimura [cph]
Initial release
2021-01-19

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.