\Header{GammaDist}{The Gamma Distribution}
\alias{dgamma}{GammaDist}
\alias{pgamma}{GammaDist}
\alias{qgamma}{GammaDist}
\alias{rgamma}{GammaDist}
\keyword{distribution}{GammaDist}
\begin{Usage}
\begin{verbatim}
dgamma(x, shape, scale=1)
pgamma(q, shape, scale=1)
qgamma(p, shape, scale=1)
rgamma(n, shape, scale=1)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\texttt{x,q}] vector of quantiles.
\item[\texttt{p}] vector of probabilites.
\item[\texttt{n}] number of observations.
\item[\texttt{shape, scale}] shape and scale parameters.
\end{ldescription}
\end{Arguments}
\begin{Value}
These functions provide information about the gamma
distribution with parameters \texttt{shape} and \texttt{scale}.
\texttt{dgamma} gives the density,
\texttt{pgamma} gives the distribution function
\texttt{qgamma} gives the quantile function
and
\texttt{rgamma} generates random deviates.

If \texttt{scale} is omitted, it assumes the default value of \texttt{1}.

The gamma distribution with parameters \texttt{shape} \eqn{= a}{} and
\texttt{scale} \eqn{= b}{} has density
\deqn{
f(x) = \frac{1}{{b}^{a} \Gamma (a)} {x}^{a-1} {e}^{-x/b}
}{f(x) = 1/(b^a Gamma(a)) x^(a-1) e^-(x/b)}
for \eqn{x > 0}{}, \eqn{a > 0}{} and \eqn{b > 0}{}.\end{Value}
\begin{SeeAlso}
\texttt{\Link{gamma}} for the gamma function, \texttt{\Link{dbeta}} for
the beta distribution and \texttt{\Link{dchisq}} for the chi-square
distribution which is a special case of the gamma distribution.\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
-log(dgamma(1:4, shape=1))
p <- (1:9)/10
pgamma(qgamma(p,shape=2), shape=2)
1 - 1/exp(qgamma(p, shape=1))
\end{ExampleCode}
\end{Examples}

