levene.test | R Documentation |
Tests equality of the k
population variances.
levene.test(
y,
group,
location = c("median", "mean", "trim.mean"),
trim.alpha = 0.25,
bootstrap = FALSE,
num.bootstrap = 1000,
kruskal.test = FALSE,
correction.method = c("none", "correction.factor", "zero.removal", "zero.correction")
)
y |
a numeric vector of data values. |
group |
factor of the data. |
location |
the default option is |
trim.alpha |
the fraction (0 to 0.5) of observations to be trimmed from
each end of |
bootstrap |
a logical value identifying whether to implement bootstrap.
The default is |
num.bootstrap |
number of bootstrap samples to be drawn when the |
kruskal.test |
logical value indentifying whether to use the Kruskal–Wallis
statistic. The default option is |
correction.method |
procedures to make the test more robust;
the default option is |
The test statistic is based on
the classical Levene's procedure (using the group means),
the modified Brown–Forsythe Levene-type procedure (using the group medians),
or the modified Levene-type procedure (using the group trimmed means).
More robust versions of the test using the correction factor or structural zero
removal method are also available. Two options for calculating critical values,
namely, approximated and bootstrapped, are available.
By default, NA
s are omitted from the data.
A list of class "htest"
with the following components:
statistic |
the value of the test statistic. |
p.value |
the |
method |
type of test performed. |
data.name |
a character string giving the name of the data. |
non.bootstrap.p.value |
the |
Instead of the ANOVA statistic suggested by Levene,
the Kruskal–Wallis ANOVA may also be applied using this function
(see the parameter kruskal.test
).
Modified from a response posted by Brian Ripley to the R-help e-mail list.
Kimihiro Noguchi, W. Wallace Hui, Yulia R. Gel, Joseph L. Gastwirth, Weiwen Miao
neuhauser.hothorn.test
, lnested.test
,
ltrend.test
, mma.test
, robust.mmm.test
data(pot)
levene.test(pot[,"obs"], pot[,"type"],
location = "median", correction.method = "zero.correction")
## Bootstrap version of the test. The calculation may take up a few minutes
## depending on the number of bootstrap sampling.
levene.test(pot[,"obs"], pot[,"type"],
location = "median", correction.method = "zero.correction",
bootstrap = TRUE, num.bootstrap = 500)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.