Performs Baumgartner-Weiß-Schindler many-to-one comparison test.
bwsManyOneTest(x, ...)# S3 method for default
bwsManyOneTest(
x,
g,
alternative = c("two.sided", "greater", "less"),
method = c("BWS", "Murakami", "Neuhauser"),
p.adjust.method = p.adjust.methods,
...
)
# S3 method for formula
bwsManyOneTest(
formula,
data,
subset,
na.action,
alternative = c("two.sided", "greater", "less"),
method = c("BWS", "Murakami", "Neuhauser"),
p.adjust.method = p.adjust.methods,
...
)
A list with class "PMCMR"
containing the following components:
a character string indicating what type of test was performed.
a character string giving the name(s) of the data.
lower-triangle matrix of the estimated quantiles of the pairwise test statistics.
lower-triangle matrix of the p-values for the pairwise tests.
a character string describing the alternative hypothesis.
a character string describing the method for p-value adjustment.
a data frame of the input data.
a string that denotes the test distribution.
a numeric vector of data values, or a list of numeric data vectors.
further arguments to be passed to or from methods.
a vector or factor object giving the group for the
corresponding elements of "x"
.
Ignored with a warning if "x"
is a list.
the alternative hypothesis. Defaults to two.sided
.
a character string specifying the test statistic to use. Defaults to BWS
.
method for adjusting p values (see p.adjust
).
a formula of the form response ~ group
where
response
gives the data values and group
a vector or
factor of the corresponding groups.
an optional matrix or data frame (or similar: see
model.frame
) containing the variables in the
formula formula
. By default the variables are taken from
environment(formula)
.
an optional vector specifying a subset of observations to be used.
a function which indicates what should happen when
the data contain NA
s. Defaults to getOption("na.action")
.
For many-to-one comparisons (pairwise comparisons with one control) in an one-factorial layout with non-normally distributed residuals Baumgartner-Weiß-Schindler's non-parametric test can be performed. Let there be \(k\) groups including the control, then the number of treatment levels is \(m = k - 1\). Then \(m\) pairwise comparisons can be performed between the \(i\)-th treatment level and the control. H\(_i: F_0 = F_i\) is tested in the two-tailed case against A\(_i: F_0 \ne F_i, ~~ (1 \le i \le m)\).
This function is a wrapper function that sequentially
calls bws_stat
and bws_cdf
for each pair. For the default test method ("BWS"
) the original
Baumgartner-Weiß-Schindler test statistic B and its corresponding Pr(>|B|)
is calculated. For method == "BWS"
only a two-sided test is possible.
For method == "Murakami"
the modified BWS statistic
denoted B* and its corresponding Pr(>|B*|) is computed by sequentially calling
murakami_stat
and murakami_cdf
.
For method == "Murakami"
only a two-sided test is possible.
If alternative == "greater"
then the alternative, if one
population is stochastically larger than the other is tested:
H\(_i: F_0 = F_i\) against A\(_i: F_0 \ge F_i, ~~ (1 \le i \le m)\).
The modified test-statistic B* according to Neuhäuser (2001) and its
corresponding Pr(>B*) or Pr(<B*) is computed by sequentally calling
murakami_stat
and murakami_cdf
with flavor = 2
.
The p-values can be adjusted to account for Type I error
inflation using any method as implemented in p.adjust
.
Baumgartner, W., Weiss, P., Schindler, H. (1998) A nonparametric test for the general two-sample problem, Biometrics 54, 1129--1135.
Murakami, H. (2006) K-sample rank test based on modified Baumgartner statistic and its power comparison, J Jpn Comp Statist 19, 1--13.
Neuhäuser, M. (2001) One-Side Two-Sample and Trend Tests Based on a Modified Baumgartner-Weiss-Schindler Statistic. J Nonparametric Stat 13, 729--739.
murakami_stat
, murakami_cdf
,
bws_stat
, bws_cdf
.
out <- bwsManyOneTest(weight ~ group, PlantGrowth, p.adjust="holm")
summary(out)
## A two-sample test
set.seed(1245)
x <- c(rnorm(20), rnorm(20,0.3))
g <- gl(2, 20)
summary(bwsManyOneTest(x ~ g, alternative = "less", p.adjust="none"))
summary(bwsManyOneTest(x ~ g, alternative = "greater", p.adjust="none"))
if (FALSE) {
## Check with the implementation in package BWStest
BWStest::bws_test(x=x[g==1], y=x[g==2], alternative = "less")
BWStest::bws_test(x=x[g==1], y=x[g==2], alternative = "greater")
}
Run the code above in your browser using DataLab