\HeaderA{oneway.test}{Test for Equal Means in a One-Way Layout}{oneway.test}
\keyword{htest}{oneway.test}
\begin{Description}\relax
Test whether two or more samples from normal distributions have the
same means.  The variances are not necessarily assumed to be equal.
\end{Description}
\begin{Usage}
\begin{verbatim}
oneway.test(formula, data, subset, na.action, var.equal = FALSE)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{formula}] a formula of the form \code{lhs \textasciitilde{} rhs} where \code{lhs}
gives the sample values and \code{rhs} the corresponding groups.
\item[\code{data}] an optional matrix or data frame (or similar: see
\code{\LinkA{model.frame}{model.frame}}) containing the variables in the
formula \code{formula}.  By default the variables are taken from
\code{environment(formula)}.
\item[\code{subset}] an optional vector specifying a subset of observations
to be used.
\item[\code{na.action}] a function which indicates what should happen when
the data contain \code{NA}s.  Defaults to
\code{getOption("na.action")}.
\item[\code{var.equal}] a logical variable indicating whether to treat the
variances in the samples as equal.  If \code{TRUE}, then a simple F
test for the equality of means in a one-way analysis of variance is 
performed.  If \code{FALSE}, an approximate method of Welch (1951)
is used, which generalizes the commonly known 2-sample Welch test to
the case of arbitrarily many samples.
\end{ldescription}
\end{Arguments}
\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{parameter}] the degrees of freedom of the exact or approximate F
distribution of the test statistic.
\item[\code{p.value}] the p-value of the test.
\item[\code{method}] a character string indicating the test performed.
\item[\code{data.name}] a character string giving the names of the data.
\end{ldescription}
\end{Value}
\begin{References}\relax
B. L. Welch (1951),
On the comparison of several mean values: an alternative approach.
\emph{Biometrika}, \bold{38}, 330--336.
\end{References}
\begin{SeeAlso}\relax
The standard t test (\code{\LinkA{t.test}{t.test}}) as the special case for two
samples;
the Kruskal-Wallis test \code{\LinkA{kruskal.test}{kruskal.test}} for a nonparametric
test for equal location parameters in a one-way layout.
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
## Not assuming equal variances
oneway.test(extra ~ group, data = sleep)
## Assuming equal variances
oneway.test(extra ~ group, data = sleep, var.equal = TRUE)
## which gives the same result as
anova(lm(extra ~ group, data = sleep))
\end{ExampleCode}
\end{Examples}

