\Header{ks.test}{Kolmogorov-Smirnov Tests}
\keyword{htest}{ks.test}
\begin{Description}\relax
Performs one or two sample Kolmogorov-Smirnov tests.\end{Description}
\begin{Usage}
\begin{verbatim}
ks.test(x, y, ..., alternative = c("two.sided", "less", "greater"))
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{x}] a numeric vector of data values.
\item[\code{y}] either a numeric vector of data values, or a character string
naming a distribution function.
\item[\code{...}] parameters of the distribution specified by \code{y}.
\item[\code{alternative}] indicates the alternative hypothesis and must be
one of \code{"two.sided"} (default), \code{"greater"} or \code{"less"}.
You can specify just the initial letter.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
If \code{y} is numeric, a two sample test of the null that \code{x}
and \code{y} were drawn from the same distribution is performed.

Alternatively, \code{y} can be a character string naming a
distribution function.  In this case, a one sample test of the null
that the distribution function underlying \code{x} is \code{y} with
parameters specified by \dots{} is carried out.

Currently, no exact p-values are available.  The approximation by the
limiting distribution may be inaccurate in small samples.\end{Details}
\begin{Value}
A list with class \code{"htest"} containing the following components:
\begin{ldescription}
\item[\code{statistic}] the value of the test statistic.
\item[\code{p.value}] the p-value of the test.
\item[\code{alternative}] a character string describing the alternative
hypothesis.
\item[\code{method}] a character string indicating what type of test was
performed.
\item[\code{data.name}] a character string giving the name(s) of the data.
\end{ldescription}
\end{Value}
\begin{References}\relax
Conover, W. J. (1971),
\emph{Practical nonparametric statistics}.
New York: John Wiley \& Sons.
Pages 295--301 (one-sample ``Kolmogorov'' test),
309--314 (two-sample ``Smirnov'' test).\end{References}
\begin{SeeAlso}\relax
\code{\Link{shapiro.test}} which performs the Shapiro-Wilk test for
normality.\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
x <- rnorm(50)
y <- runif(30)
# Do x and y come from the same distribution?
ks.test(x, y)
# Does x come from a shifted gamma distribution with shape 3 and scale 2?
ks.test(x+2, "pgamma", 3, 2) # two-sided
ks.test(x+2, "pgamma", 3, 2, alternative = "gr")
\end{ExampleCode}
\end{Examples}

