\HeaderA{poisson.test}{Exact Poisson tests}{poisson.test}
\keyword{htest}{poisson.test}
\begin{Description}\relax
Performs an exact test of a simple null hypothesis about the
rate parameter in Poisson distribution, or for the
ratio between two rate parameters.
\end{Description}
\begin{Usage}
\begin{verbatim}
poisson.test(x, T = 1, r = 1,
    alternative = c("two.sided", "less", "greater"),
    conf.level = 0.95)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{x}] number of events. A vector of length one or two.
\item[\code{T}] time base for event count. A vector of length one or two. 
\item[\code{r}] hypothesized rate or rate ratio
\item[\code{alternative}] indicates the alternative hypothesis and must be
one of \code{"two.sided"}, \code{"greater"} or \code{"less"}.
You can specify just the initial letter.
\item[\code{conf.level}] confidence level for the returned confidence
interval.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
Confidence intervals are computed similarly to those of
\code{\LinkA{binom.test}{binom.test}} in the one-sample case, and using
\code{\LinkA{binom.test}{binom.test}} in the two sample case.
\end{Details}
\begin{Value}
A list with class \code{"htest"} containing the following components:
\begin{ldescription}
\item[\code{statistic}] the number of events (in the first sample if there
are two.)
\item[\code{parameter}] the corresponding expected count
\item[\code{p.value}] the p-value of the test.
\item[\code{conf.int}] a confidence interval for the rate or rate ratio.
\item[\code{estimate}] the estimated rate or rate ratio.
\item[\code{null.value}] the rate or rate ratio under the null,
\code{r}.
\item[\code{alternative}] a character string describing the alternative
hypothesis.
\item[\code{method}] the character string \code{"Exact Poisson test"} or
\code{"Comparison of Poisson rates"} as appropriate.
\item[\code{data.name}] a character string giving the names of the data.
\end{ldescription}
\end{Value}
\begin{Note}\relax
The rate parameter in Poisson data is often given based on a
\dQuote{time on test} or similar quantity (person-years, population
size, or expected number of cases from mortality tables). This is the
role of the \code{T} argument.

The one-sample case is effectively the binomial test with a very large
\code{n}. The two sample case is converted to a binomial test by
conditioning on the total event count, and the rate ratio is directly
related to the odds in that binomial distribution.
\end{Note}
\begin{SeeAlso}\relax
\code{\LinkA{binom.test}{binom.test}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}

### These are paraphrased from data sets in the ISwR package

## SMR, Welsh Nickel workers
poisson.test(137, 24.19893)

## eba1977, compare Fredericia to other three cities for ages 55-59
poisson.test(c(11,6+8+7),c(800, 1083+1050+878))
\end{ExampleCode}
\end{Examples}

