# brunnermunzel.permutation.test: permuted Brunner-Munzel test In brunnermunzel: (Permuted) Brunner-Munzel Test

## Description

This function performs the permuted Brunner-Munzel test.

## Usage

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20``` ```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 `two.sided` (default), `greater` or `less`. User can specify just the initial letter. `force` FALSE(default): If sample size is too large [number of combinations > 40116600 = choose(28, 14)], use `brunnermunzel.test`. TRUE: perform permuted Brunner-Munzel test regardless sample size. `est` a method to calculate estimate and confidence interval, must be either `original` (default) or `difference`. original(default): return p = P(X < Y) + 0.5 * P(X = Y) difference: return mean difference. i.e. P(X < Y) - P(X > Y) = 2 * p - 1 This change is proposed by Dr. Julian D. Karch. `formula` a formula of the form `lhs ~ rhs` where `lhs` is a numeric variable giving the data values and `rhs` a factor with two levels giving 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 `NA`s. Defaults to `getOption("na.action")`.

## 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 p-value of the test. `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).

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114``` ```## 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(XY) brunnermunzel.permutation.test(x, y, est = "difference") ## ## permuted Brunner-Munzel Test ## ## data: x and y ## p-value = 0.158 ## sample estimates: ## P(XY) ## -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