dist.Inverse.Gamma: Inverse Gamma Distribution

Description Usage Arguments Details Value See Also Examples

Description

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

Usage

1
2
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

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 -> 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.

See Also

dgamma, dnorm, dnormp, and dnormv.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
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"))

Example output



LaplacesDemon documentation built on July 9, 2021, 5:07 p.m.