
Last chance! 50% off unlimited learning
Sale ends in
Density, distribution function, quantile function and random generation for the inverse gamma distribution.
dinvgamma(x, shape, rate = 1, scale = 1/rate, log = FALSE)pinvgamma(q, shape, rate = 1, scale = 1/rate, lower.tail = TRUE, log.p = FALSE)
qinvgamma(p, shape, rate = 1, scale = 1/rate, lower.tail = TRUE, log.p = FALSE)
rinvgamma(n, shape, rate = 1, scale = 1/rate)
vector of quantiles.
inverse gamma shape parameter
inverse gamma rate parameter
alternative to rate; scale = 1/rate
logical; if TRUE, probabilities p are given as log(p).
logical; if TRUE (default), probabilities are P(X <= x) otherwise, P(X > x).
vector of probabilities.
number of observations. If length(n) > 1, the length is taken to be the number required.
The inverse gamma distribution with parameters shape and rate has density f(x) = rate^shape/Gamma(shape) x^(-1-shape) e^(-rate/x) it is the inverse of the standard gamma parameterization in R.
The functions (d/p/q/r)invgamma simply wrap those of the standard
(d/p/q/r)gamma R implementation, so look at, say,
dgamma
for details.
# NOT RUN {
s <- seq(0, 5, .01)
plot(s, dinvgamma(s, 7, 10), type = 'l')
f <- function(x) dinvgamma(x, 7, 10)
q <- 2
integrate(f, 0, q)
(p <- pinvgamma(q, 7, 10))
qinvgamma(p, 7, 10) # = q
mean(rinvgamma(1e5, 7, 10) <= q)
# }
Run the code above in your browser using DataLab