brunner.munzel.test: The Brunner-Munzel Test for Stochastic Equality

Description Usage Arguments Value Note Author(s) References See Also Examples

View source: R/brunner.munzel.test.R

Description

This function performs the Brunner–Munzel test for stochastic equality of two samples, which is also known as the Generalized Wilcoxon Test. NAs from the data are omitted.

Usage

1
2
brunner.munzel.test(x, y, alternative = c("two.sided", "greater",
"less"), alpha = 0.05)

Arguments

x

the numeric vector of data values from the sample 1.

y

the numeric vector of data values from the sample 2.

alpha

significance level, default is 0.05 for 95% confidence interval.

alternative

a character string specifying the alternative hypothesis, must be one of "two.sided" (default), "greater" or "less". User can specify just the initial letter.

Value

A list containing the following components:

statistic

the Brunner–Munzel test statistic.

parameter

the degrees of freedom.

conf.int

the confidence interval.

p.value

the p-value of the test.

data.name

a character string giving the name of the data.

estimate

an estimate of the effect size, i.e., P(X < Y) + 0.5 * P(X =Y )

Note

There exist discrepancies with Brunner and Munzel (2000) because there is a typo in the paper. The corrected version is in Neubert and Brunner (2007) (e.g., compare the estimates for the case study on pain scores). The current R function follows Neubert and Brunner (2007).

Author(s)

Wallace Hui, Yulia R. Gel, Joseph L. Gastwirth, Weiwen Miao. This function was updated with the help of Dr. Ian Fellows

References

Brunner, E. and Munzel, U. (2000). The nonparametric Behrens-Fisher problem: asymptotic theory and a small-sample approximation. Biometrical Journal 42: 17–25.

Neubert, K. and Brunner, E. (2007). A Studentized permutation test for the non-parametric Behrens-Fisher problem. Computational Statistics and Data Analysis 51: 5192–5204.

Reiczigel, J., Zakarias, I., and Rozsa, L. (2005). A bootstrap test of stochastic equality of two populations. The American Statistician 59: 1–6.

See Also

wilcox.test, pwilcox

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
## Pain score on the third day after surgery for 14 patients under
## the treatment Y and 11 patients under the treatment N
## (see Brunner and Munzel, 2000; Neubert and Brunner, 2007).

Y <- c(1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 4, 1, 1)
N <- c(3, 3, 4, 3, 1, 2, 3, 1, 1, 5, 4)

brunner.munzel.test(Y, N)

##       Brunner-Munzel Test
## data: Y and N
## Brunner-Munzel Test Statistic = 3.1375,  df = 17.683, p-value = 0.005786
## 95 percent confidence interval:
##  0.5952169 0.9827052
## sample estimates:
## P(X<Y)+.5*P(X=Y)
##        0.788961

Example output

Loading required package: Hmisc
Loading required package: lattice
Loading required package: survival
Loading required package: Formula
Loading required package: ggplot2

Attaching package: 'Hmisc'

The following objects are masked from 'package:base':

    format.pval, round.POSIXt, trunc.POSIXt, units

Loading required package: Kendall
Loading required package: mvtnorm
Loading required package: VGAM
Loading required package: stats4
Loading required package: splines

	Brunner-Munzel Test

data:  Y and N
Brunner-Munzel Test Statistic = 3.1375, df = 17.683, p-value = 0.005786
95 percent confidence interval:
 0.5952169 0.9827052
sample estimates:
P(X<Y)+.5*P(X=Y) 
        0.788961 

lawstat documentation built on Nov. 23, 2017, 5:05 p.m.