(Permuted) Brunner-Munzel Test

Provides the functions for Brunner-Munzel test and permuted Brunner-Munzel test, which enable to use formula, matrix, and table as argument. These functions are based on Brunner and Munzel (2000) and Neubert and Brunner (2007) , and are written with FORTRAN.



title: brunnermunzel author: Toshiaki Ara date: "2019-02-18"

For Brunner-Munzel test brunner.munzel.test function in lawstat package is well-known. brunnermunzel.test in this package also accepts formula.

Moreover, this package provides brunnermunzel.permutation.test function for a permuted Brunner-Munzel test used in the case of small sample size.

The script of brunnermunzel.test is derived from that of lawstat package and slightly modified. Thanks to Vyacheslav Lyubchich (maintainer of lawstat package).

Installation

library(devtools)
install_github("toshi-ara/brunnermunzel")

Example

Brunner-Munzel test

## 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)
 
dat <- data.frame(
    value = c(Y, N),
    group = factor(rep(c("Y", "N"), c(length(Y), length(N))),
                   levels = c("Y", "N"))
)
 
library(brunnermunzel)
 
## Default
brunnermunzel.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
## Formula interface
brunnermunzel.test(value ~ group, data = dat)
## 
## 	Brunner-Munzel Test
## 
## data:  value by group
## 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

permuted Brunner-Munzel test

brunnermunzel.permutation.test takes time to obtain results.

library(brunnermunzel)
 
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)
 
dat <- data.frame(
    value = c(Y, N),
    group = factor(rep(c("Y", "N"), c(length(Y), length(N))),
                   levels = c("Y", "N"))
)
 
## Default
brunnermunzel.permutation.test(Y, N)
## 
## 	permuted Brunner-Munzel Test
## 
## data:  Y and N
## p-value = 0.008038
## Formula interface
brunnermunzel.permutation.test(value ~ group, data = dat)
## 
## 	permuted Brunner-Munzel Test
## 
## data:  value by group
## p-value = 0.008038

Comparison with other methods

# Wilcoxon sum-rank test
wilcox.test(value ~ group, data = dat)
## Warning in wilcox.test.default(x = c(1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 4, :
## cannot compute exact p-value with ties
## 
## 	Wilcoxon rank sum test with continuity correction
## 
## data:  value by group
## W = 32.5, p-value = 0.007741
## alternative hypothesis: true location shift is not equal to 0
# exact Wilcoxon sum-rank test
library(coin)
wilcox_test(value ~ group, data = dat, distribution = "exact")
## 
## 	Exact Wilcoxon-Mann-Whitney Test
## 
## data:  value by group (Y, N)
## Z = -2.6934, p-value = 0.00669
## alternative hypothesis: true mu is not equal to 0

News

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("brunnermunzel")

1.3.5 by Toshiaki Ara, 6 months ago


https://github.com/toshi-ara/brunnermunzel


Report a bug at https://github.com/toshi-ara/brunnermunzel/issues/


Browse source code at https://github.com/cran/brunnermunzel


Authors: Toshiaki Ara [aut, cre]


Documentation:   PDF Manual  


GPL-2 | GPL-3 license


Suggests testthat, knitr, rmarkdown, dplyr, ggplot2


See at CRAN