bartlett.test(x, …)# S3 method for default
bartlett.test(x, g, …)
# S3 method for formula
bartlett.test(formula, data, subset, na.action, …)
"lm"
).x
.
Ignored if x
is a list.lhs ~ rhs
where lhs
gives the data values and rhs
the corresponding groups.model.frame
) containing the variables in the
formula formula
. By default the variables are taken from
environment(formula)
.NA
s. Defaults to
getOption("na.action")
."htest"
containing the following components:
"Bartlett test of homogeneity of variances"
.x
is a list, its elements are taken as the samples or fitted
linear models to be compared for homogeneity of variances. In this
case, the elements must either all be numeric data vectors or fitted
linear model objects, g
is ignored, and one can simply use
bartlett.test(x)
to perform the test. If the samples are not
yet contained in a list, use bartlett.test(list(x, ...))
. Otherwise, x
must be a numeric data vector, and g
must
be a vector or factor object of the same length as x
giving the
group for the corresponding elements of x
.var.test
for the special case of comparing variances in
two samples from normal distributions;
fligner.test
for a rank-based (nonparametric)
\(k\)-sample test for homogeneity of variances;
ansari.test
and mood.test
for two rank
based two-sample tests for difference in scale.require(graphics)
plot(count ~ spray, data = InsectSprays)
bartlett.test(InsectSprays$count, InsectSprays$spray)
bartlett.test(count ~ spray, data = InsectSprays)
Run the code above in your browser using DataLab