R: Pairwise post-hoc Test for Multiple Comparisons of Mean Rank...

posthoc.friedman.nemenyi.test {PMCMR} | R Documentation

## Pairwise post-hoc Test for Multiple Comparisons of Mean Rank Sums for Unreplicated Blocked Data (Nemenyi-Test)

### 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

    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.

### Author(s)

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

    ##
    ## 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)

[Package PMCMR version 4.2 Index]