\Header{Geometric}{The Geometric Distribution}
\alias{dgeom}{Geometric}
\alias{pgeom}{Geometric}
\alias{qgeom}{Geometric}
\alias{rgeom}{Geometric}
\keyword{distribution}{Geometric}
\begin{Usage}
\begin{verbatim}
dgeom(x, prob)
pgeom(q, prob)
qgeom(p, prob)
rgeom(n, prob)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\texttt{x,q}] vector of quantiles representing the number of failures in
a sequence of Bernoulli trials before success occurs.
\item[\texttt{p}] vector of probabilities.
\item[\texttt{n}] number of observations to generate.
\item[\texttt{prob}] probability of success in each trial.
\end{ldescription}
\end{Arguments}
\begin{Description}
These functions provide information about the geometric distribution
with parameter \texttt{prob}.  \texttt{dgeom} gives the density, \texttt{pgeom}
gives the distribution function, \texttt{qgeom} gives the quantile
function, and \texttt{rgeom} generates random deviates.\end{Description}
\begin{Details}
The geometric distribution with \texttt{prob} \eqn{= p}{} has density
\deqn{p(x) = p {(1-p)}^{x}}{p(x) = p (1-p)^x}
for \eqn{x = 0, 1, 2, \ldots}{x = 0, 1, 2, ...}

If an element of \texttt{x} is not integer, the result of \texttt{pgeom}
is zero, with a warning.\end{Details}
\begin{SeeAlso}
\texttt{\Link{dnbinom}} for the negative binomial which generalizes
the geometric distribution.\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
pp <- sort(c((1:9)/10, 1 - .2^(2:8)))
print(qg <- qgeom(pp, prob = .2))
for(i in 1:2) print(qg <- qgeom(pgeom(qg, prob=.2), prob =.2))
Ni <- rgeom(20, prob = 1/4); table(factor(Ni, 0:max(Ni)))
\end{ExampleCode}
\end{Examples}

