Learn R Programming

lmomco (version 2.3.1)

pdfgam: Probability Density Function of the Gamma Distribution

Description

This function computes the probability density function of the Gamma distribution given parameters (\(\alpha\), shape, and \(\beta\), scale) computed by pargam. The probability density function has no explicit form, but is expressed as an integral

$$f(x|\alpha, \beta)^{\mathrm{lmomco}} = \frac{1}{\beta^\alpha\,\Gamma(\alpha)}\, x^{\alpha - 1}\, \mathrm{exp}(-x/\beta) \mbox{,}$$

where \(f(x)\) is the probability density for the quantile \(x\), \(\alpha\) is a shape parameter, and \(\beta\) is a scale parameter.

Alternatively, a three-parameter version is available for this package following the parameterization of the Generalized Gamma distribution used in the gamlss.dist package and is

$$f(x|\mu,\sigma,\nu)_{\mathrm{gamlss.dist}}^{\mathrm{lmomco}}=\frac{\theta^\theta\, |\nu|}{\Gamma(\theta)}\,\frac{z^\theta}{x}\,\mathrm{exp}(-z\theta)\mbox{,}$$

where \(z =(x/\mu)^\nu\), \(\theta = 1/(\sigma^2\,|\nu|^2)\) for \(x > 0\), location parameter \(\mu > 0\), scale parameter \(\sigma > 0\), and shape parameter \(-\infty < \nu < \infty\). Note that for \(\nu = 0\) the distribution is log-Normal. The three parameter version is automatically triggered if the length of the para element is three and not two.

Usage

pdfgam(x, para)

Arguments

x

A real value vector.

para

The parameters from pargam or vec2par.

Value

Probability density (\(f\)) for \(x\).

References

Hosking, J.R.M., 1990, L-moments---Analysis and estimation of distributions using linear combinations of order statistics: Journal of the Royal Statistical Society, Series B, v. 52, pp. 105--124.

Hosking, J.R.M. and Wallis, J.R., 1997, Regional frequency analysis---An approach based on L-moments: Cambridge University Press.

See Also

cdfgam, quagam, lmomgam, pargam

Examples

Run this code
# NOT RUN {
  lmr <- lmoms(c(123,34,4,654,37,78))
  gam <- pargam(lmr)
  x <- quagam(0.5,gam)
  pdfgam(x,gam)

# }
# NOT RUN {
# 3-p Generalized Gamma Distribution and gamlss.dist package parameterization
gg <- vec2par(c(7.4, 0.2, 14), type="gam"); X <- seq(0.04,9, by=.01)
GGa <- gamlss.dist::dGG(X, mu=7.4, sigma=0.2, nu=14)
GGb <- pdfgam(X, gg) # We now compare the two densities.
plot( X, GGa, type="l", xlab="X", ylab="PROBABILITY DENSITY", col=3, lwd=6)
lines(X, GGb, col=2, lwd=2) #
# }
# NOT RUN {
# }
# NOT RUN {
# 3-p Generalized Gamma Distribution and gamlss.dist package parameterization
gg <- vec2par(c(1.7, 3, -4), type="gam"); X <- seq(0.04,9, by=.01)
GGa <- gamlss.dist::dGG(X, mu=1.7, sigma=3, nu=-4)
GGb <- pdfgam(X, gg) # We now compare the two densities.
plot( X, GGa, type="l", xlab="X", ylab="PROBABILITY DENSITY", col=3, lwd=6)
lines(X, GGb, col=2, lwd=2) #
# }

Run the code above in your browser using DataLab