Learn R Programming

PMCMRplus (version 1.9.3)

bwsManyOneTest: BWS Many-To-One Comparison Test

Description

Performs Baumgartner-Wei<U+00DF>-Schindler many-to-one comparison test.

Usage

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, ... )

Arguments

x

a numeric vector of data values, or a list of numeric data vectors.

further arguments to be passed to or from methods.

g

a vector or factor object giving the group for the corresponding elements of "x". Ignored with a warning if "x" is a list.

alternative

the alternative hypothesis. Defaults to two.sided.

method

a character string specifying the test statistic to use. Defaults to BWS.

p.adjust.method

method for adjusting p values (see p.adjust).

formula

a formula of the form response ~ group where response gives the data values and group a vector or factor of the corresponding groups.

data

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).

subset

an optional vector specifying a subset of observations to be used.

na.action

a function which indicates what should happen when the data contain NAs. Defaults to getOption("na.action").

Value

A list with class "PMCMR" containing the following components:

method

a character string indicating what type of test was performed.

data.name

a character string giving the name(s) of the data.

statistic

lower-triangle matrix of the estimated quantiles of the pairwise test statistics.

p.value

lower-triangle matrix of the p-values for the pairwise tests.

alternative

a character string describing the alternative hypothesis.

p.adjust.method

a character string describing the method for p-value adjustment.

model

a data frame of the input data.

dist

a string that denotes the test distribution.

Details

For many-to-one comparisons (pairwise comparisons with one control) in an one-factorial layout with non-normally distributed residuals Baumgartner-Wei<U+00DF>-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<U+00DF>-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<U+00E4>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.

References

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<U+00E4>user, M. (2001) One-side two-sample and trend tests based on a modified Baumgartner-Weiss-Schindler statistic. Journal of Nonparametric Statistics 13, 729--739.

See Also

murakami_stat, murakami_cdf, bws_stat, bws_cdf.

Examples

Run this code
# NOT RUN {
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"))

# }
# NOT RUN {
## 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