Learn R Programming

BWStest (version 0.2.3)

bws_test: Perform the Baumgartner-Weiss-Schindler hypothesis test.

Description

Perform the Baumgartner-Weiss-Schindler hypothesis test.

Usage

bws_test(
  x,
  y,
  method = c("default", "BWS", "Neuhauser", "B1", "B2", "B3", "B4", "B5"),
  alternative = c("two.sided", "greater", "less")
)

Value

Object of class htest, a list of the test statistic, the p-value, and the method noted.

Arguments

x

a vector of the first sample.

y

a vector of the second sample.

method

a character string specifying the test statistic to use. should be one of the following:

default

This is “Hobson's choice”, which uses the classical BWS test for two-sided alternative, but Neuhauser for one sided alternatives.

BWS

Use the classical BWS test.

Neuhauser

Use Neuhauser's test.

B1

Use Murakami's \(B_1\) test.

B2

Use Murakami's \(B_2\) test, which is exactly Neuhauser's test.

B3

Use Murakami's \(B_3\) test.

B4

Use Murakami's \(B_4\) test.

B5

Use Murakami's \(B_5\) test.

Only Neuhauser's test supports one-sided alternatives.

alternative

a character string specifying the alternative hypothesis, must be one of “two.sided” (default), “greater” or “less”. You can specify just the initial letter. “greater” corresponds to testing whether the survival function of x is greater than that of y; equivalently one can think of this as x being ‘greater’ than y in the sense of first order stochastic dominance.

Author

Steven E. Pav shabbychef@gmail.com

References

W. Baumgartner, P. Weiss, H. Schindler, 'A nonparametric test for the general two-sample problem', Biometrics 54, no. 3 (Sep., 1998): pp. 1129-1135. tools:::Rd_expr_doi("10.2307/2533862")

See Also

bws_test, bws_stat, murakami_stat, murakami_cdf.

Examples

Run this code

# under the null
set.seed(123)
x <- rnorm(100)
y <- rnorm(100)
hval <- bws_test(x,y)

# under the alternative
set.seed(123)
x <- rnorm(100)
y <- rnorm(100,mean=1.0)
hval <- bws_test(x,y)
show(hval)
stopifnot(hval$p.value < 0.05)

# under the alternative with a one sided test.
set.seed(123)
x <- rnorm(100)
y <- rnorm(100,mean=0.7)
hval <- bws_test(x,y,alternative='less')
show(hval)
stopifnot(hval$p.value < 0.01)

hval <- bws_test(x,y,alternative='greater')
stopifnot(hval$p.value > 0.99)

hval <- bws_test(x,y,alternative='two.sided')
stopifnot(hval$p.value < 0.05)

Run the code above in your browser using DataLab