Performs Levene's tests for m samples on p responses, based on
(univariate) One-Way ANOVAs and One-Way MANOVAs applied to absolute
differences around medians. Significance levels of the univariate tests of
variation can be corrected using any of the adjustment methods for multiple
comparisons offered by p.adjust. Effects sizes are also
computed with respect to the One-Way ANOVAs.
Levenetestsms.mv(x, group, var.equal = FALSE, P.adjust = "none")Returns an list of class "Levenetestsms.mv", a list
containing the following components:
name | A character string describing the function. | medians | A \(m \times p\) matrix; the cell (m,p) contains the median of the p-th response in sample m. | absdev_medians | A list containing m data frames, one
data frame for each level of group, and each data frame having
p columns containing the absolute deviations around the m-th
sample median. | df_absdev | A data frame containing the absolute deviations
around medians, seen as a compact version of absdev_medians. | means_absdev | A \(m \times p\) matrix; the cell (m,p) contains the mean absolute deviation around the median of the p-th response in sample m. | vars_absdev | A \(m \times p\) matrix; the cell (m,p) contains the variance of absolute deviations around the median of the p-th response in sample m. | OneWayANOVAs | A list containing the results of the p
tests for equal means of absolute deviations around medians in a one-way
layout. Each element in the list is basically the result of
oneway.test, but the p-values have been possibly
recomputed as a consequence of the P.adjust method chosen. | ANOVATables | A list containing p analysis of variance
tables produced by anova.lm, each table corresponding to a one-way
analysis of variance for the comparison of m-samples on the
p-th response variable. Each element in the list is basically the
result of anova.lm, but the p-values have been
possibly recomputed as a consequence of 1) the P.adjust method
chosen, and/or 2) the assumption of equal variance of absolute deviations
around medians is FALSE. | var.equal |
A logical variable indicating whether the two
variances were treated as being equal TRUE or not FALSE. | P.adjust | A character string indicating the correction method chosen. | Eff_sizes | A list of length p containing four effect
size measures for an F-test in one-way ANOVA, and their respective 95%
confidence intervals. Those measures are \(\eta^2\), \(\omega^2\),
\(\epsilon^2\) and Cohen's f, as implemented in the
effectsize package (Ben-Shachar et al. 2020). When
var.equal = FALSE these effect sizes are approximations. | OWM_absdev | A list of class "manova" containing the
results of the One-Way MANOVA applied to the absolute deviations around
medians, i.e., the multivariate Levene's test. | group | A character string specifying the name of the m-level factor defining samples. | levels.group | A vector of length m showing the levels in
factor group. | variables | A vector of length p showing the names of response variables. | data.name | A character string giving the name of the data. | data | The data frame analyzed. |
The extractor function print.Levenetestsms.mv returns
an annotated output of the univariate Levene tests and, optionally, the
multivariate Levene's test.
a data frame containing a factor with m levels and p response variables.
a factor with m levels defining samples. It must be one
of the columns in x.
a logical variable indicating whether to treat the m
variances of absolute deviations around medians (the variances of the measure
of variation among samples!) as being equal for the One-Way ANOVAs. If
TRUE then a simple F test for the equality of means is performed. If
FALSE the Welch (1951) approximation to the degrees of freedom is
used, as implemented in oneway.test.
p-value correction method of univariate Levene's tests (One-Way ANOVAs), a character string. Can be abbreviated. See 'Details'.
Jorge Navarro Alberto, ganava4@gmail.com
This function focuses on robust Levene's tests, both univariate and
multivariate, for the comparison of variation among m samples in
multivariate data. These tests can be chosen as alternatives to Box's test
which is sensitive to deviations from normality. The application of
Levene's test one variable at a time from a set of p variables can be
computed by repeating p times car's package function
leveneTest (Fox and Weisberg 2019), when
center = median. However, there are p univariate Levene's tests
possible, each one consisting of one-way ANOVAs applied to the absolute
deviations around medians. Therefore, the p-values produced in the ANOVAs can
be subject to corrections for multiple testing, depending on the number of
response variables analyzed. The methods implemented in P.adjust are
the same as those contained in the p.adjust.methods:
"bonferroni", "holm", "hochberg", "hommel",
"BH", (Benjamini-Hochberg) or its alias "fdr" (False Discovery
Rate), and "BY" (Benjamini & Yekutieli). The default pass-through
option ("none") is also included. Four measures of effect size are
also computed with respect to the univariate F tests, which are interpreted
as effect sizes of variation among samples. User-friendly summaries of all
analyses (including the multivariate Levene's test) can be invoked using the
print method for this function.
Ben-Shachar, M., Lüdecke, D., and Makowski, D. (2020). effectsize: Estimation of Effect Size Indices and Standardized Parameters. Journal of Open Source Software, 5(56), 2815. doi: 10.21105/joss.02815
Fox, J., and Weisberg, S. (2019). An R Companion to Applied Regression, Third edition. Sage, Thousand Oaks CA. https://www.john-fox.ca/Companion/.
Manly, B.F.J., Navarro Alberto, J.A. and Gerow, K. (2024) Multivariate Statistical Methods. A Primer. 5th Edn. Chapman and Hall/CRC.
Welch, B.L. (1951). On the comparison of several mean values: an alternative approach. Biometrika, 38, 330-336. doi:10.2307/2332579.
data(skulls)
res.Levenems.mv <- Levenetestsms.mv(skulls, Period, var.equal = TRUE,
P.adjust = "bonferroni")
res.Levenems.mv
Run the code above in your browser using DataLab