\Header{binom.test}{Exact Binomial Test}
\keyword{htest}{binom.test}
\begin{Description}\relax
Performs an exact test of a simple null hypothesis about the
probability of success in a Bernoulli experiment.\end{Description}
\begin{Usage}
\begin{verbatim}
binom.test(x, n, p = 0.5,
           alternative = c("two.sided", "less", "greater"),
           conf.level = 0.95)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{x}] number of successes, or a vector of length 2 giving the
numbers of successes and failures, respectively.
\item[\code{n}] number of trials; ignored if \code{x} has length 2.
\item[\code{p}] hypothesized probability of success.
\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 obtained by a procedure first given in
Clopper and Pearson (1934).  This guarantees that the confidence level
is at least \code{conf.level}, but in general does not give the
shortest-length confidence intervals.\end{Details}
\begin{Value}
A list with class \code{"htest"} containing the following components:
\begin{ldescription}
\item[\code{statistic}] the number of successes.
\item[\code{parameter}] the number of trials.
\item[\code{p.value}] the p-value of the test.
\item[\code{conf.int}] a confidence interval for the probability of success.
\item[\code{estimate}] the estimated probability of success.
\item[\code{null.value}] the probability of success under the null,
\code{p}.
\item[\code{alternative}] a character string describing the alternative
hypothesis.
\item[\code{method}] the character string \code{"Exact binomial test"}.
\item[\code{data.name}] a character string giving the names of the data.
\end{ldescription}
\end{Value}
\begin{References}\relax
Clopper, C. J. \& Pearson, E. S. (1934).
The use of confidence or fiducial limits illustrated in the case of
the binomial.
\emph{Biometrika}, \bold{26}, 404--413.

Conover, W. J. (1971),
\emph{Practical nonparametric statistics}.
New York: John Wiley \& Sons.
Pages 97--104.

Myles Hollander \& Douglas A. Wolfe (1973),
\emph{Nonparametric statistical inference}.
New York: John Wiley \& Sons.
Pages 15--22.\end{References}
\begin{SeeAlso}\relax
\code{\Link{prop.test}} for a general (approximate) test for equal or
given proportions.\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
## Conover (1971), p. 97f.
## Under (the assumption of) simple Mendelian inheritance, a cross
##  between plants of two particular genotypes produces progeny 1/4 of
##  which are "dwarf" and 3/4 of which are "giant", respectively.
##  In an experiment to determine if this assumption is reasonable, a
##  cross results in progeny having 243 dwarf and 682 giant plants.
##  If "giant" is taken as success, the null hypothesis is that p =
##  3/4 and the alternative that p != 3/4.
binom.test(c(682, 243), p = 3/4)
binom.test(682, 682 + 243, p = 3/4)   # The same.
## => Data are in agreement with the null hypothesis.
\end{ExampleCode}
\end{Examples}

