Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

chaAllPairsNashimotoTest

All-Pairs Comparisons for Simply Ordered Mean Ranksums


Description

Performs Nashimoto and Wright's all-pairs comparison procedure for simply ordered mean ranksums (NPT'-test and NPY'-test).

According to the authors, the procedure shall only be applied after Chacko's test (see chackoTest) indicates global significance.

Usage

chaAllPairsNashimotoTest(x, ...)

## Default S3 method:
chaAllPairsNashimotoTest(
  x,
  g,
  p.adjust.method = c(p.adjust.methods),
  alternative = c("greater", "less"),
  dist = c("Normal", "h"),
  ...
)

## S3 method for class 'formula'
chaAllPairsNashimotoTest(
  formula,
  data,
  subset,
  na.action,
  p.adjust.method = c(p.adjust.methods),
  alternative = c("greater", "less"),
  dist = c("Normal", "h"),
  ...
)

Arguments

x

a numeric vector of data values, or a list of numeric data vectors.

...

further arguments to be passed to or from methods.

g

a vector or factor object giving the group for the corresponding elements of "x". Ignored with a warning if "x" is a list.

p.adjust.method

method for adjusting p values. Ignored if dist = "h".

alternative

the alternative hypothesis. Defaults to greater.

dist

the test distribution. Defaults to Normal.

formula

a formula of the form response ~ group where response gives the data values and group a vector or factor of 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 NAs. Defaults to getOption("na.action").

Details

The modified procedure uses the property of a simple order, θ_m' - θ_m ≤ θ_j - θ_i ≤ θ_l' - θ_l \qquad (l ≤ i ≤ m~\mathrm{and}~ m' ≤ j ≤ l'). The null hypothesis H_{ij}: θ_i = θ_j is tested against the alternative A_{ij}: θ_i < θ_j for any 1 ≤ i < j ≤ k.

Let R_{ij} be the rank of X_{ij}, where X_{ij} is jointly ranked from ≤ft\{1, 2, …, N \right\}, ~~ N = ∑_{i=1}^k n_i, then the test statistics for all-pairs comparisons and a balanced design is calculated as

SEE PDF

with n = n_i; ~ N = ∑_i^k n_i ~~ (1 ≤ i ≤ k), \bar{R}_i the mean rank for the ith group, and the expected variance (without ties) σ_a^2 = N ≤ft(N + 1 \right) / 12.

For the NPY'-test (dist = "h"), if T_{ij} > h_{k-1,α,∞}.

For the unbalanced case with moderate imbalance the test statistic is

SEE PDF

For the NPY'-test (dist="h") the null hypothesis is rejected in an unbalanced design, if \hat{T}_{ij} > h_{k,α,∞} / √{2}. In case of a NPY'-test, the function does not return p-values. Instead the critical h-values as given in the tables of Hayter (1990) for α = 0.05 (one-sided) are looked up according to the number of groups (k-1) and the degree of freedoms (v = ∞).

For the NPT'-test (dist = "Normal"), the null hypothesis is rejected, if T_{ij} > √{2} t_{α,∞} = √{2} z_α. Although Nashimoto and Wright (2005) originally did not use any p-adjustment, any method as available by p.adjust.methods can be selected for the adjustment of p-values estimated from the standard normal distribution.

Value

Either a list of class "osrt" if dist = "h" or a list of class "PMCMR" if dist = "Normal".

method

a character string indicating what type of test was performed.

data.name

a character string giving the name(s) of the data.

statistic

the estimated statistic(s)

crit.value

critical values for α = 0.05.

alternative

a character string describing the alternative hypothesis.

parameter

the parameter(s) of the test distribution.

dist

a string that denotes the test distribution.

There are print and summary methods available.

A list with class "PMCMR" containing the following components:

method

a character string indicating what type of test was performed.

data.name

a character string giving the name(s) of the data.

statistic

lower-triangle matrix of the estimated quantiles of the pairwise test statistics.

p.value

lower-triangle matrix of the p-values for the pairwise tests.

alternative

a character string describing the alternative hypothesis.

p.adjust.method

a character string describing the method for p-value adjustment.

model

a data frame of the input data.

dist

a string that denotes the test distribution.

Note

The function will give a warning for the unbalanced case and returns the critical value h_{k-1,α,∞} / √{2} if applicable.

References

Hayter, A. J.(1990) A One-Sided Studentised Range Test for Testing Against a Simple Ordered Alternative, J Amer Stat Assoc 85, 778–785.

Nashimoto, K., Wright, F.T. (2007) Nonparametric Multiple-Comparison Methods for Simply Ordered Medians. Comput Stat Data Anal 51, 5068–5076.

See Also

Examples

## Example from Shirley (1977)
## Reaction times of mice to stimuli to their tails.
x <- c(2.4, 3, 3, 2.2, 2.2, 2.2, 2.2, 2.8, 2, 3,
 2.8, 2.2, 3.8, 9.4, 8.4, 3, 3.2, 4.4, 3.2, 7.4, 9.8, 3.2, 5.8,
 7.8, 2.6, 2.2, 6.2, 9.4, 7.8, 3.4, 7, 9.8, 9.4, 8.8, 8.8, 3.4,
 9, 8.4, 2.4, 7.8)
g <- gl(4, 10)

## Shirley's test
## one-sided test using look-up table
shirleyWilliamsTest(x ~ g, alternative = "greater")

## Chacko's global hypothesis test for 'greater'
chackoTest(x , g)

## post-hoc test, default is standard normal distribution (NPT'-test)
summary(chaAllPairsNashimotoTest(x, g, p.adjust.method = "none"))

## same but h-distribution (NPY'-test)
chaAllPairsNashimotoTest(x, g, dist = "h")

## NPM-test
NPMTest(x, g)

## Hayter-Stone test
hayterStoneTest(x, g)

## all-pairs comparisons
hsAllPairsTest(x, g)

PMCMRplus

Calculate Pairwise Multiple Comparisons of Mean Rank Sums Extended

v1.9.0
GPL (>= 3)
Authors
Thorsten Pohlert [aut, cre] (<https://orcid.org/0000-0003-3855-3025>)
Initial release
2021-01-12

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.