# Is dunn.test a suitable alternative to kruskalmc in pgirmess package?

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.

• Questions about how to install software are off topic here. Please see our [list of resources on statistics software](meta.stats.stackexchange.com/questions/793/internet-support-for-statistics-software). In any case, even if it were on topic, in general it is preferred if you can post separate questions instead of combining your not-directly-related questions into one. If you edit to include only the question about post hoc tests, your question should be on topic. – Glen_b -Reinstate Monica Jul 6 '15 at 10:46

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

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

I think that Alexis recommendation of dunn.test is a better option, because the ties correction and also the pgirmess package have more dependencies especially rgdal. rgdal requires sp and after installing it, you can install pgirmess .

Install sp:

install.packages('sp')


For Ubuntu install gdal and PROJ.4:

sudo apt-get install libgdal-dev libproj-dev


In R now you can try :

install.packages('pgirmess')


In Mac:

install.packages(‘rgdal’,repos=”http://www.stats.ox.ac.uk/pub/RWin“)
install.packages('pgirmess')


If in Mac this fails, there is a Hard Way