Learn R Programming

lmomco (version 0.88)

cdfgam: Cumulative Distribution Function of the Gamma Distribution

Description

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

$$F(x) = \frac{\beta^{-\alpha}}{\Gamma(\alpha)}\int_0^x t^{\alpha - 1} e^{-t/\beta} \mbox{d}F \mbox{,}$$

where $F(x)$ is the nonexceedance probability for the quantile $x$. The parameters have the following interpretation in the R syntax; $\alpha$ is a shape parameter and $\beta$ is a scale parameter.

Usage

cdfgam(x, para)

Arguments

x
A real value.
para
The parameters from pargam or similar.

Value

  • Nonexceedance probability ($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, vol. 52, p. 105--124.

Hosking, J.R.M., 1996, FORTRAN routines for use with the method of L-moments: Version 3, IBM Research Report RC20525, T.J. Watson Research Center, Yorktown Heights, New York.

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

See Also

quagam, pargam

Examples

Run this code
lmr <- lmom.ub(c(123,34,4,654,37,78))
  cdfgam(50,pargam(lmr))

  # A manual demonstration of a gamma parent
  G  <- vec2par(c(0.6333,1.579),type='gam') # the parent
  F1 <- 0.25         # nonexceedance probability
  x  <- quagam(F1,G) # the lower quartile (F=0.25)
  a  <- 0.6333       # gamma parameter
  b  <- 1.579        # gamma parameter
  # compute the integral
  xf <- function(t,A,B) { t^(A-1)*exp(-t/B) }
  Q  <- integrate(xf,0,x,A=a,B=b)
  # finish the math
  F2 <- Q$val*b^(-a)/gamma(a)
  # check the result
  if(abs(F1-F2) < 1e-8) print("yes")

Run the code above in your browser using DataLab