Description Usage Arguments Details Value Note Author(s) References See Also Examples

Density, distribution function, quantile function, and random generation
for the gamma distribution with parameters `mean`

and `cv`

.

1 2 3 4 |

`x` |
vector of quantiles. |

`q` |
vector of quantiles. |

`p` |
vector of probabilities between 0 and 1. |

`n` |
sample size. If |

`mean` |
vector of (positive) means of the distribution of the random variable. |

`cv` |
vector of (positive) coefficients of variation of the random variable. |

`log, log.p` |
logical; if |

`lower.tail` |
logical; if |

Let *X* be a random variable with a gamma distribution with parameters
`shape=`

*α* and `scale=`

*β*. The relationship
between these parameters and the mean (`mean=`

*μ*) and coefficient
of variation (`cv=`

*τ*) of this distribution is given by:

*α = τ^{-2} \;\;\;\;\;\; (1)*

*β = μ/α \;\;\;\;\;\; (2)*

*μ = αβ \;\;\;\;\;\; (3)*

*τ = α^{-1/2} \;\;\;\;\;\; (4)*

Thus, the functions `dgammaAlt`

, `pgammaAlt`

, `qgammaAlt`

, and
`rgammaAlt`

call the **R** functions `dgamma`

,
`pgamma`

, `qgamma`

, and `rgamma`

,
respectively, using the values for the `shape`

and `scale`

parameters
given by: `shape <- cv^-2`

, `scale <- mean/shape`

.

`dgammaAlt`

gives the density, `pgammaAlt`

gives the distribution function,
`qgammaAlt`

gives the quantile function, and `rgammaAlt`

generates random
deviates.

Invalid arguments will result in return value `NaN`

, with a warning.

The gamma distribution takes values on the positive real line. Special cases of
the gamma are the exponential distribution and the
chi-square distribution. Applications of the gamma include
life testing, statistical ecology, queuing theory, inventory control and
precipitation processes. A gamma distribution starts to resemble a normal
distribution as the shape parameter *α* tends to infinity or
the cv parameter *τ* tends to 0.

Some EPA guidance documents (e.g., Singh et al., 2002; Singh et al., 2010a,b) discourage using the assumption of a lognormal distribution for some types of environmental data and recommend instead assessing whether the data appear to fit a gamma distribution.

Steven P. Millard ([email protected])

Forbes, C., M. Evans, N. Hastings, and B. Peacock. (2011).
*Statistical Distributions, Fourth Edition*.
John Wiley and Sons, Hoboken, NJ.

Johnson, N. L., S. Kotz, and N. Balakrishnan. (1994).
*Continuous Univariate Distributions, Volume 1*.
Second Edition. John Wiley and Sons, New York.

Singh, A., A.K. Singh, and R.J. Iaci. (2002). Estimation of the Exposure Point Concentration Term Using a Gamma Distribution. EPA/600/R-02/084. October 2002. Technology Support Center for Monitoring and Site Characterization, Office of Research and Development, Office of Solid Waste and Emergency Response, U.S. Environmental Protection Agency, Washington, D.C.

Singh, A., R. Maichle, and N. Armbya. (2010a). *ProUCL Version 4.1.00
User Guide (Draft)*. EPA/600/R-07/041, May 2010. Office of Research and
Development, U.S. Environmental Protection Agency, Washington, D.C.

Singh, A., N. Armbya, and A. Singh. (2010b). *ProUCL Version 4.1.00
Technical Guide (Draft)*. EPA/600/R-07/041, May 2010. Office of Research and
Development, U.S. Environmental Protection Agency, Washington, D.C.

GammaDist, `egammaAlt`

,
Probability Distributions and Random Numbers.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | ```
# Density of a gamma distribution with parameters mean=10 and cv=2,
# evaluated at 7:
dgammaAlt(7, mean = 10, cv = 2)
#[1] 0.02139335
#----------
# The cdf of a gamma distribution with parameters mean=10 and cv=2,
# evaluated at 12:
pgammaAlt(12, mean = 10, cv = 2)
#[1] 0.7713307
#----------
# The 25'th percentile of a gamma distribution with parameters
# mean=10 and cv=2:
qgammaAlt(0.25, mean = 10, cv = 2)
#[1] 0.1056871
#----------
# A random sample of 4 numbers from a gamma distribution with
# parameters mean=10 and cv=2.
# (Note: the call to set.seed simply allows you to reproduce this example.)
set.seed(10)
rgammaAlt(4, mean = 10, cv = 2)
#[1] 3.772004230 1.889028078 0.002987823 8.179824976
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.