# posthoc.friedman.nemenyi.test: Pairwise post-hoc Test for Multiple Comparisons of Mean Rank... In PMCMR: Calculate Pairwise Multiple Comparisons of Mean Rank Sums

## Description

Calculate pairwise comparisons using Nemenyi post-hoc test for unreplicated blocked data. This test is usually conducted post-hoc after significant results of the `friedman.test`. The statistics refer to upper quantiles of the studentized range distribution (`Tukey`).

## Usage

 ```1 2 3 4 5 6 7 8 9``` ```posthoc.friedman.nemenyi.test(y, ...) ## Default S3 method: posthoc.friedman.nemenyi.test(y, groups, blocks, ...) ## S3 method for class 'formula' posthoc.friedman.nemenyi.test(formula, data, subset, na.action, ...) ```

## Arguments

 `y` either a numeric vector of data values, or a data matrix. `groups` a vector giving the group for the corresponding elements of `y` if this is a vector; ignored if `y` is a matrix. If not a factor object, it is coerced to one. `blocks` a vector giving the block for the corresponding elements of `y` if this is a vector; ignored if `y` is a matrix. If not a factor object, it is coerced to one. `formula` a formula of the form `a ~ b | c`, where `a`, `b` and `c` give the data values and corresponding groups and blocks, respectively. `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")`. `...` further arguments to be passed to or from methods.

## Details

A one-way ANOVA with repeated measures that is also referred to as ANOVA with unreplicated block design can also be conducted via the `friedman.test`. The consequent post-hoc pairwise multiple comparison test according to Nemenyi is conducted with this function.

If y is a matrix, than the columns refer to the treatment and the rows indicate the block.

See `vignette("PMCMR")` for details.

Let R_j and n_j denote the sum of Friedman-ranks and the sample size of the j-th group, respectively, then a difference between two groups is significant on the level of α, if the following inequality is met:

|R_i / n_i - R_j / n_j| > q(∞; k; α) / 2^0.5 * (k (k + 1) / (6 n))^0.5

with k the number of groups (or treatments) and n the total number of data.

## Value

A list with class "PMCMR"

 `method ` The applied method. `data.name` The name of the data. `p.value` The p-value according to the studentized range distribution. `statistic` The estimated upper quantile of the studentized range distribution. `p.adjust.method` Defaults to "none"

## Note

This function does not test for ties.

Thorsten Pohlert

## References

Janez Demsar (2006), Statistical comparisons of classifiers over multiple data sets, Journal of Machine Learning Research, 7, 1-30.

P. Nemenyi (1963) Distribution-free Multiple Comparisons. Ph.D. thesis, Princeton University.

Lothar Sachs (1997), Angewandte Statistik. Berlin: Springer. Pages: 668-675.

## See Also

`friedman.test`, `kruskal.test`, `posthoc.kruskal.nemenyi.test`, `Tukey`

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16``` ```## ## Sachs, 1997, p. 675 ## Six persons (block) received six different diuretics (A to F, treatment). ## The responses are the Na-concentration (mval) ## in the urine measured 2 hours after each treatment. ## y <- matrix(c( 3.88, 5.64, 5.76, 4.25, 5.91, 4.33, 30.58, 30.14, 16.92, 23.19, 26.74, 10.91, 25.24, 33.52, 25.45, 18.85, 20.45, 26.67, 4.44, 7.94, 4.04, 4.4, 4.23, 4.36, 29.41, 30.72, 32.92, 28.23, 23.35, 12, 38.87, 33.12, 39.15, 28.06, 38.23, 26.65),nrow=6, ncol=6, dimnames=list(1:6,c("A","B","C","D","E","F"))) print(y) friedman.test(y) posthoc.friedman.nemenyi.test(y) ```

### Example output

```     A     B     C    D     E     F
1 3.88 30.58 25.24 4.44 29.41 38.87
2 5.64 30.14 33.52 7.94 30.72 33.12
3 5.76 16.92 25.45 4.04 32.92 39.15
4 4.25 23.19 18.85 4.40 28.23 28.06
5 5.91 26.74 20.45 4.23 23.35 38.23
6 4.33 10.91 26.67 4.36 12.00 26.65

Friedman rank sum test

data:  y
Friedman chi-squared = 23.333, df = 5, p-value = 0.0002915

Pairwise comparisons using Nemenyi multiple comparison test
with q approximation for unreplicated blocked data

data:  y

A      B      C      D      E
B 0.1880 -      -      -      -
C 0.0917 0.9996 -      -      -
D 0.9996 0.3388 0.1880 -      -
E 0.0395 0.9898 0.9996 0.0917 -
F 0.0016 0.6363 0.8200 0.0052 0.9400

P value adjustment method: none
```

PMCMR documentation built on May 2, 2019, 7:28 a.m.