brunnermunzel.permutation.test {brunnermunzel} | R Documentation |
permuted Brunner-Munzel test
Description
This function performs the permuted Brunner-Munzel test.
Usage
brunnermunzel.permutation.test(x, ...)
## Default S3 method:
brunnermunzel.permutation.test(
x,
y,
alternative = c("two.sided", "greater", "less"),
force = FALSE,
est = c("original", "difference"),
...
)
## S3 method for class 'formula'
brunnermunzel.permutation.test(formula, data, subset = NULL, na.action, ...)
## S3 method for class 'matrix'
brunnermunzel.permutation.test(x, ...)
## S3 method for class 'table'
brunnermunzel.permutation.test(x, ...)
Arguments
x |
the numeric vector of data values from the sample 1, or 2 x n matrix of table (number of row must be 2 and column is ordinal variables). |
... |
further arguments to be passed to or from methods (This argument is for only formula). |
y |
the numeric vector of data values from the sample 2. If x is matrix or table, y must be missing. |
alternative |
a character string specifying the alternative
hypothesis, must be one of |
force |
|
est |
a method to calculate estimate and confidence interval,
must be either
This change is proposed by Dr. Julian D. Karch. |
formula |
a formula of the form |
data |
an optional matrix or data frame (or similar: see
|
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 |
Value
A list containing the following components:
method |
the characters “permuted Brunner-Munzel Test” |
data.name |
a character string giving the name of the data. |
p.value |
the |
estimate |
an estimate of the effect size |
Note
FORTRAN subroutine 'combination' in combination.f is derived from the program by shikino (http://slpr.sakura.ne.jp/qp/combination) (CC-BY-4.0). Thanks to shikono for your useful subroutine.
References
Karin Neubert and Edgar Brunner, “A studentized permutation test for the non-parametric Behrens-Fisher problem”, Computational Statistics and Data Analysis, Vol. 51, pp. 5192-5204 (2007).
See Also
This function is made in reference to following cite (in Japanese): Prof. Haruhiko Okumura (https://oku.edu.mie-u.ac.jp/~okumura/stat/brunner-munzel.html).
Examples
## Hollander & Wolfe (1973), 29f.
## Hamilton depression scale factor measurements in 9 patients with
## mixed anxiety and depression, taken at the first (x) and second
## (y) visit after initiation of a therapy (administration of a
## tranquilizer).
x <- c(1.83, 0.50, 1.62, 2.48, 1.68, 1.88, 1.55, 3.06, 1.30)
y <- c(0.878, 0.647, 0.598, 2.05, 1.06, 1.29, 1.06, 3.14, 1.29)
brunnermunzel.permutation.test(x, y)
##
## permuted Brunner-Munzel Test
##
## data: x and y
## p-value = 0.158
## sample estimates:
## P(X<Y)+.5*P(X=Y)
## 0.2839506
## 'est' option
## if 'est = "difference"' return P(X<Y) - P(X>Y)
brunnermunzel.permutation.test(x, y, est = "difference")
##
## permuted Brunner-Munzel Test
##
## data: x and y
## p-value = 0.158
## sample estimates:
## P(X<Y)-P(X>Y)
## -0.4320988
## Formula interface.
dat <- data.frame(
value = c(x, y),
group = factor(rep(c("x", "y"), c(length(x), length(y))),
levels = c("x", "y"))
)
brunnermunzel.permutation.test(value ~ group, data = dat)
##
## permuted Brunner-Munzel Test
##
## data: value by group
## p-value = 0.158
## sample estimates:
## P(X<Y)+.5*P(X=Y)
## 0.2839506
## 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)
brunnermunzel.permutation.test(Y, N)
##
## permuted Brunner-Munzel Test
##
## data: Y and N
## p-value = 0.008038
## sample estimates:
## P(X<Y)+.5*P(X=Y)
## 0.788961
## Formula interface.
dat <- data.frame(
value = c(Y, N),
group = factor(rep(c("Y", "N"), c(length(Y), length(N))),
levels = c("Y", "N"))
)
brunnermunzel.permutation.test(value ~ group, data = dat)
##
## permuted Brunner-Munzel Test
##
## data: value by group
## p-value = 0.008038
## sample estimates:
## P(X<Y)+.5*P(X=Y)
## 0.788961
## Matrix or Table interface.
##
dat1 <- matrix(c(4, 4, 2, 1, 5, 4), nr = 2, byrow = TRUE)
dat2 <- as.table(dat1)
brunnermunzel.permutation.test(dat1) # matrix
##
## permuted Brunner-Munzel Test
##
## data: Group1 and Group2
## p-value = 0.1593
## sample estimates:
## P(X<Y)+.5*P(X=Y)
## 0.68
brunnermunzel.permutation.test(dat2) # table
##
## Brunner-Munzel Test
##
## permuted Brunner-Munzel Test
##
## data: A and B
## p-value = 0.1593
## sample estimates:
## P(X<Y)+.5*P(X=Y)
## 0.68