Gamma Distribution

DESCRIPTION:
Density, cumulative probability, quantiles and random generation for the gamma distribution.

USAGE:
dgamma(x, shape)
pgamma(q, shape)
qgamma(p, shape)
rgamma(n, shape)

REQUIRED ARGUMENTS:
x:
vector of (positive) quantiles. Missing values (NAs) are allowed.
q:
vector of (positive) quantiles. Missing values (NAs) are allowed.
p:
vector of probabilities. Missing values (NAs) are allowed.
n:
sample size. If length(n) is larger than 1, then length(n) random values are returned.
shape:
shape parameter (> 0). This is replicated to be the same length as p or q or the number of deviates generated.

VALUE:
density (dgamma), probability (pgamma), quantile (qgamma), or random sample (rgamma) for the gamma distribution with shape shape.

SIDE EFFECTS:
The function rgamma causes creation of the dataset .Random.seed if it does not already exist, otherwise its value is updated.

DETAILS:
Elements of q or p that are missing will cause the corresponding elements of the result to be missing.

BACKGROUND:
The gamma distribution takes values on the positive real line. Special cases of the gamma are the exponential distribution and the chi-squared distributions (see Exponential and Chisquare). Applications of the gamma include queuing theory, inventory control and precipitation processes.

REFERENCES:
Johnson, N. L. and Kotz, S. (1970). Continuous Univariate Distributions, vol. 1. Houghton-Mifflin, Boston.

Gamma Distribution. In Encyclopedia of Statistical Sciences. S. Kotz and N. L. Johnson, eds.


NOTE:
See family for the family generating function Gamma used with the glm and gam functions. See gamma for the gamma function.

SEE ALSO:
Chisquare , Exponential , family , Gamma , set.seed .

EXAMPLES:
rgamma(20,10) # sample of 20 with shape parameter 10
pgamma(1.2, 1.5) # the probability that a value from the gamma
                 # distribution with shape 1.5 is less than 1.2
x <- qgamma(seq(.001, .999, len = 100), 1.5) # compute a vector of quantiles

# be sure that you have an open graphics window plot(x, dgamma(x, 1.5), type = "l") # density plot for shape 1.5