Solved – Is dunn.test a suitable alternative to kruskalmc in pgirmess package

cumulative distribution functiondunn-testkruskal-wallis test”nonparametricr

I'm trying to run the krushkalmc method after running kruskal.test as part of my analysis with the Kruskal-Wallis rank sum test. I have data with a small sample size that also does not have a normal distribution so I thought that the Kruskal-Wallis rank sum test would be an appropriate choice.

My resulting p-value is .004 but I'd like to do a post-hoc test as well to understand which group(s) differ.

However, I've run into difficulties trying to install the pgirmess package that contains krushkalmc.

  1. Trying to install it from inside R:

    install.packages("pgirmess")
    package ‘pgirmess’ is available as a source package but not as a binary

  2. So then I downloaded it and tried to install it manually:

    install.packages("pgirmess", repos = NULL, type="source")
    Warning: invalid package ‘pgirmess’
    Error: ERROR: no packages specified
    Warning in install.packages :
    installation of package ‘pgirmess’ had non-zero exit status

and here is my sessionInfo()

> sessionInfo()
R version 3.1.2 (2014-10-31)
Platform: x86_64-apple-darwin13.4.0 (64-bit)

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods  
[7] base     

other attached packages:
[1] ggplot2_1.0.0

loaded via a namespace (and not attached):
 [1] colorspace_1.2-4 digest_0.6.8     grid_3.1.2      
 [4] gtable_0.1.2     labeling_0.3     MASS_7.3-35     
 [7] munsell_0.4.2    plyr_1.8.1       proto_0.3-10    
[10] Rcpp_0.11.4      reshape2_1.4.1   scales_0.2.4    
[13] stringr_0.6.2    tools_3.1.2

I've tried to determine if any other package has the kruskalmc but don't see any.

So my questions are:

  1. Do you have any recommendations for installing pgirmess?

  2. Is dunn.test a suitable replacement for identifying which group(s) have significantly different scores? It also notes that

The interpretation of stochastic dominance requires an assumption that
the CDF of one group does not cross the CDF of the other

How do I determine if this CDF – cumulative distribution constraint is met?

Disclaimer: I first opened this question in stackoverflow but closed it there as I think this is a more appropriate site.

Thanks for your help

Best Answer

You will want to read the question What is the difference between various Kruskal-Wallis post-hoc tests? and my answer to it.

From that answer:

dunn.test provides Dunn's (1964) z test approximation to a rank sum test employing both the same ranks used in the Kruskal-Wallis test, and the pooled variance estimate implied by the null hypothesis of the Kruskal-Wallis (akin to using the pooled variance to calculate t test statistics following an ANOVA).

The kruskalmc function in the pgirmess package implements Dunn's post hoc rank sum comparison using z test statistics as directed by Siegel and Castellan (1988), but these authors do not include Dunn's (1964) correction for ties, so kruskalmc will be less accurate than dunn.test when ties exist in the data.

For your second question, you will want to read the question Can a CDF from data cross with another CDF? and its answer.

References

Dunn, O. J. (1964). Multiple comparisons using rank sums. Technometrics, 6(3):241–252.

Siegel and Castellan (1988) Non parametric statistics for the behavioural sciences. MacGraw Hill Int., New York. pp 213-214