dist.Inverse.Gamma {LaplacesDemon} R Documentation

## Inverse Gamma Distribution

### Description

This is the density function and random generation from the inverse gamma distribution.

### Usage

dinvgamma(x, shape=1, scale=1, log=FALSE)
rinvgamma(n, shape=1, scale=1)


### Arguments

 n This is the number of draws from the distribution. x This is the scalar location to evaluate density. shape This is the scalar shape parameter \alpha, which defaults to one. scale This is the scalar scale parameter \beta, which defaults to one. log Logical. If log=TRUE, then the logarithm of the density is returned.

### Details

• Application: Continuous Univariate

• Density: p(\theta) = \frac{\beta^\alpha}{\Gamma(\alpha)} \theta^{-(\alpha + 1)} \exp(-\frac{\beta}{\theta}), \quad \theta > 0

• Inventor: Unknown (to me, anyway)

• Notation 1: \theta \sim \mathcal{G}^{-1}(\alpha, \beta)

• Notation 2: p(\theta) = \mathcal{G}^{-1}(\theta | \alpha, \beta)

• Parameter 1: shape \alpha > 0

• Parameter 2: scale \beta > 0

• Mean: E(\theta) = \frac{\beta}{\alpha - 1}, for \alpha > 1

• Variance: var(\theta) = \frac{\beta^2}{(\alpha - 1)^2 (\alpha - 2)}, \alpha > 2

• Mode: mode(\theta) = \frac{\beta}{\alpha + 1}

The inverse-gamma is the conjugate prior distribution for the normal or Gaussian variance, and has been traditionally specified as a vague prior in that application. The density is always finite; its integral is finite if \alpha > 0. Prior information decreases as \alpha, \beta \rightarrow 0.

These functions are similar to those in the MCMCpack package.

### Value

dinvgamma gives the density and rinvgamma generates random deviates. The parameterization is consistent with the Gamma Distribution in the stats package.

dgamma, dnorm, dnormp, and dnormv.

### Examples

library(LaplacesDemon)
x <- dinvgamma(4.3, 1.1)
x <- rinvgamma(10, 3.3)

#Plot Probability Functions
x <- seq(from=0.1, to=20, by=0.1)
plot(x, dinvgamma(x,1,1), ylim=c(0,1), type="l", main="Probability Function",
ylab="density", col="red")
lines(x, dinvgamma(x,1,0.6), type="l", col="green")
lines(x, dinvgamma(x,0.6,1), type="l", col="blue")
legend(2, 0.9, expression(paste(alpha==1, ", ", beta==1),
paste(alpha==1, ", ", beta==0.6), paste(alpha==0.6, ", ", beta==1)),
lty=c(1,1,1), col=c("red","green","blue"))


[Package LaplacesDemon version 16.1.6 Index]