dinvgamma: Inverse gamma distribution

Description Usage Arguments Details Value See Also Examples

Description

Probability density function, cumulative distribution function, quantile function, and random variable generator for the inverse gamma distribution with parameters shape and scale.

Usage

1
2
3
4
5
6
7
dinvgamma(x, shape, scale = 1, log)

qinvgamma(p, shape, scale = 1, lower.tail = TRUE, log.p = FALSE)

pinvgamma(q, shape, scale = 1, lower.tail = TRUE, log.p = FALSE)

rinvgamma(n, shape, scale = 1)

Arguments

x, q

vector of quantiles

shape, scale

shape and scale parameters. Must be positive.

log, logp

logical; if TRUE, probabilities/densities p are returned as log(p)

p

vector of probabilities

lower.tail

logical; if TRUE (default), probabilities are p[X\le X], otherwise, P[X>x]

n

number of observations. If length(n) > 1, the length is taken to be the number required.

Details

The inverse gamma distribution with parameters shape = a and scale = b has density

f(x) = b^a / Gamma(a) x^-a-1 exp(-b/x)

for x\ge 0, a>0, b>0. (Gamma(a) is the function implemented by R's gamma() and defined in its help.)

The mean is \fracba-1 (if a>1) and the variance is \fracb^2(a-1)^2(a-2) (if a>2).

These functions are all based on the gamma distribution. Please see the documentation for issues using the gamma distribution, e.g. issues when the shape parameter is small.

Value

dgamma gives the density, pgamma gives the distribution function, qgamma gives the quantile function, and rgamma generates random deviates.

See Also

dgamma

Examples

1
dinvgamma(2,1) == dgamma(1/2,1)/2^2

jarad/conjugateBayes documentation built on May 14, 2019, 12:46 p.m.