Levenetests2s.mv {smsets} | R Documentation |
Multiple two-sample Levene tests for the comparison of variation in multivariate data
Description
Performs multiple two-sample Levene tests, based on two-sample t-tests
applied to absolute differences around medians for more than one response
vector, with corrected significance levels using any of the adjustment
methods for multiple comparisons offered by p.adjust
.
This function includes the argument alternative =
useful to specify
the type of alternative, either one-sided (lower-/ upper-tail) or two-sided.
Effects sizes are also computed with respect to the two-sample t-tests.
Usage
Levenetests2s.mv(
x,
group,
level1,
alternative = "two.sided",
var.equal = FALSE,
P.adjust = "none",
unit = "units"
)
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 |
alternative |
a character string specifying the alternative hypothesis,
must be one of |
var.equal |
a logical variable indicating whether to treat the two
variances as being equal. If |
P.adjust |
p-value correction method, a character string. Can be abbreviated. See 'Details'. |
unit |
Physical units of the response variable useful to fully characterize raw effect sizes |
Details
This function focuses on the univariate Levene test for the comparison of
mean values for two samples, when more than one variable is involved in the
data analysis, so that type one error rates ("false significances") in the
series of Levene tests are adjusted according to the number of response
variables analyzed. The pairwise comparisons between the two levels in
group
with corrections for multiple testing are made over more than
one response vector.
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.
Value
Returns an object of class "Levenetests2s.mv"
, a list containing the
following components:
name | A character string describing the function. |
medians | A list containing two vectors of length p,
being p the number of response variables. medians1 and
medians2 store the medians for samples 1 (corresponding to
level1 ) and 2, respectively. |
absdev.median | A list containing two data frames,
abs.dev.median1 and abs.dev.median2 , corresponding to the
absolute deviation around sample medians 1 and 2, respectively |
means.absdev | A list containing two vectors of length p,
(means.absdev1 and means.absdev1 ), corresponding to the
mean absolute deviations around medians for variables 1,...,p, in
samples 1 and 2, respectively. |
vars.absdev | A list containing two vectors of length p,
(vars.absdev1 and vars.absdev1 ), corresponding to the
variances of absolute deviations around medians for variables 1,...,
p, in samples 1 and 2, respectively. |
t.list | A list containing p vectors of length 5, each
vector containing the t-statistic, the degrees of freedom, the adjusted
p-value for the test, the raw effect size estimator:
\bar{x}_1 - \bar{x}_2 , and the post hoc effect size estimator
recommended by Hedges (1981), analogous to Cohen's d, given by
|\bar{x}_1 - \bar{x}_2| / \hat{\sigma} . Here
\hat{\sigma} = \sqrt{MSE} where MSE is the mean squared error,
the estimator of the variance for the difference of means
\bar{x}_1 - \bar{x}_2 , respectively. |
alternative | A character string specifying the alternative hypothesis chosen. |
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 |
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. |
data | the data frame analyzed. |
The extractor function print.Levenetests2s.mv
returns an
annotated output of the Levene tests (or, equivalently, the two-sample
t-tests applied to the absolute differences around medians).
Author(s)
Jorge Navarro Alberto, ganava4@gmail.com
References
Manly, B.F.J., Navarro Alberto, J.A. and Gerow, K. (2024) Multivariate Statistical Methods. A Primer. 5th Edn. Chapman and Hall/CRC.
Hedges, L. V. 1981. Distribution theory for Glass’s estimator of effect size and related estimators. Journal of Educational Statistics 6(2): 107–128.
Examples
data(sparrows)
res.Levene2s.mv <- Levenetests2s.mv(sparrows, Survivorship, "S",
alternative = "less", var.equal = TRUE,
P.adjust = "bonferroni", unit = "mm")
res.Levene2s.mv