All-Pairs Comparisons for Simply Ordered Mean Ranksums
All-Pairs Comparisons for Simply Ordered Mean Ranksums
Performs Nashimoto and Wright's all-pairs comparison procedure for simply ordered mean ranksums.
Source
If method = "asympt" is selected, this function calls an internal probability function pHS. The GPL-2 code for this function was taken from pHayStonLSA of the the package NSM3:
Grant Schneider, Eric Chicken and Rachel Becvarik (2020) NSM3: Functions and Datasets to Accompany Hollander, Wolfe, and Chicken - Nonparametric Statistical Methods, Third Edition. R package version 1.15. https://CRAN.R-project.org/package=NSM3
NPMTest(x,...)## Default S3 method:NPMTest( x, g, alternative = c("greater","less"), method = c("look-up","boot","asympt"), nperm =10000,...)## S3 method for class 'formula'NPMTest( formula, data, subset, na.action, alternative = c("greater","less"), method = c("look-up","boot","asympt"), nperm =10000,...)
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.
alternative: the alternative hypothesis. Defaults to greater.
method: a character string specifying the test statistic to use. Defaults to "look-up" that uses published Table values of Williams (1972).
nperm: number of permutations for the asymptotic permutation test. Defaults to 1000. Ignored, if method = "look-up".
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").
Returns
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.
Either a list of class "PMCMR" or a list with class "osrt" that contains 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: 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.
Details
The procedure uses the property of a simple order, c("thetam′−thetamlethetaj−thetailethetal′−thetal\n", "qquad(lleilemmathrmandm′lejlel′)"). The null hypothesis Hij:θi=θj is tested against the alternative Aij:θi<θj for any 1≤i<j≤k.
The all-pairs comparisons test statistics for a balanced design are
h^ij=i≤m<m′≤jmaxσa/n(Rˉm′−Rˉm),
with n=ni;N=∑ikni(1≤i≤k), Rˉi the mean rank for the ith group, and σa=N(N+1)/12. The null hypothesis is rejected, if hij>hk,α,∞.
For the unbalanced case with moderate imbalance the test statistic is
The null hypothesis is rejected, if h^ij>hk,α,∞/2.
If method = "look-up" the function will 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) and the degree of freedoms (v=∞).
If method = "boot" an asymetric permutation test is conducted and p-values is returned.
If method = "asympt" is selected the asymptotic p-value is estimated as implemented in the function pHayStonLSA of the package NSM3.
Note
The function will give a warning for the unbalanced case and returns the critical value hk,α,∞/2.
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 tableshirleyWilliamsTest(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-testNPMTest(x, g)## Hayter-Stone testhayterStoneTest(x, g)## all-pairs comparisonshsAllPairsTest(x, g)
References
Hayter, A. J.(1990) A One-Sided Studentised Range Test for Testing Against a Simple Ordered Alternative, Journal of the American Statistical Association
85 , 778--785.
Nashimoto, K., Wright, F.T. (2007) Nonparametric Multiple-Comparison Methods for Simply Ordered Medians. Comput Stat Data Anal 51 , 5068–5076.