oneway.test {stats} | R Documentation |
Test for Equal Means in a One-Way Layout
Description
Test whether two or more samples from normal distributions have the same means. The variances are not necessarily assumed to be equal.
Usage
oneway.test(formula, data, subset, na.action, var.equal = FALSE)
Arguments
formula |
a formula of the form |
data |
an optional matrix or data frame (or similar: see
|
subset |
an optional vector specifying a subset of observations to be used. |
na.action |
a function which indicates what should happen when
the data contain |
var.equal |
a logical variable indicating whether to treat the
variances in the samples as equal. If |
Details
If the right-hand side of the formula contains more than one term, their interaction is taken to form the grouping.
Value
A list with class "htest"
containing the following components:
statistic |
the value of the test statistic. |
parameter |
the degrees of freedom of the exact or approximate F distribution of the test statistic. |
p.value |
the p-value of the test. |
method |
a character string indicating the test performed. |
data.name |
a character string giving the names of the data. |
References
B. L. Welch (1951). On the comparison of several mean values: an alternative approach. Biometrika, 38, 330–336. doi:10.2307/2332579.
See Also
The standard t test (t.test
) as the special case for two
samples;
the Kruskal-Wallis test kruskal.test
for a nonparametric
test for equal location parameters in a one-way layout.
Examples
## 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))