LeveneT2 {smsets} | R Documentation |
Levene's test for two multivariate samples based on Hotelling's
T^2
test with extra information
Description
An R function for the comparison of multivariate variation in two samples,
which implements Levene's test based on Hotelling's T^2
.
Usage
LeveneT2(x, group, level1, var.equal = TRUE)
Arguments
x |
A data frame with one two-level factor and p response variables. |
group |
Two-level factor defining groups. It must be one of the columns
in |
level1 |
A character string identifying Sample 1. The string must be one
of the factor levels in |
var.equal |
A logical variable indicating whether to treat the
within-sample covariance matrices of absolute deviations around medians for
samples 1 and 2 as equal or not. The default is |
Details
LeveneT2
makes use of Hotelling's T^2
to test the variation in
two multivariate samples. This test is an alternative procedure that should
be more robust than Box's test which is known to be rather sensitive to the
assumption that the samples are from multivariate normal distributions.
In LeveneT2
the data values are transformed into absolute deviations
from their respective sample medians
ADM_{ijk} = |x_{ijk}-M_{jk}|
where
x_{ijk}
is the value of variable X_{k}
for the i
th
individual in sample j
, and
M_{jk}
is the median of X_{k}
in sample j
.
The unequal variation question between samples j = 1
and j = 2
becomes a T^2
-test for the difference of the mean ADM
vectors.
Value
Returns an object of class "LeveneT2"
, a list containing the
following components:
name | A character string describing the function. |
medians | A list containing two vectors. The first vector
medians1 contains the medians for all variables in sample 1 as
declared in parameter level1 , and the second vector holds the
corresponding medians for the other sample. |
bygroup.data | A list with two data frames matlevel1 and
matlevel2 containing the original variables for samples 1 and 2
respectively |
absdev.median | A list with two data frames
abs.dev.median1 and abs.dev.median2 containing the absolute
deviations from sample medians for samples 1 and 2, respectively. |
LeveneT2.test | A list of class hotelling.test containing
the list stats and the scalar pval , produced by function
hotelling.test implemented in package
Hotelling |
var.equal | a logical variable indicating whether the two
variances were treated as being equal TRUE or not FALSE . |
group | a character string specifying the name of the two-level factor defining groups. |
levels.group | a vector of length two, showing the two levels in
factor group . |
data.name | a character string giving the name of the data. |
variables | a character string vector containing the variable names. |
data | the data frame analyzed. |
The extractor function print.LeveneT2
returns an
annotated output of the test.
Author(s)
Jorge Navarro Alberto, ganava4@gmail.com
References
Curran, J. and Hersh, T. (2021). Hotelling: Hotelling's T^2 Test and Variants. R package version 1.0-8, https://CRAN.R-project.org/package=Hotelling.
Manly, B.F.J., Navarro Alberto, J.A. and Gerow, K. (2024) Multivariate Statistical Methods. A Primer. 5th Edn. Chapman and Hall/CRC.
Nel, D.G. and van de Merwe, C.A. (1986). A solution to the multivariate Behrens-Fisher problem. Comm. Statist. Theor. Meth., A15, 12, 3719-3736.
Examples
data(sparrows)
LeveneT2.sparrows <- LeveneT2(sparrows, group = Survivorship, level1 = "S",
var.equal = TRUE)
# Brief output
LeveneT2.sparrows