Solved – Dunn’s test p-values in R are exactly half those in SPSS and GraphPad for the same data

dunn-testnonparametricr

Firstly, this is my first post to Cross Validated, so apologies in advance if I have infringed any conventions.

I am writing up a PhD thesis on aspects of biomedical research, and use R for my statistics. However, I always check some of the data against another package in case I have made a coding error.

I have been running a Kruskall-Wallis test with three groups (sample sizes of 5, 8 and 9) and using Dunn's test for the post-hoc pairwise comparisons. The p-values I get for the pairwise comparisons (unadjusted for multiple comparisons) are exactly half what I get in SPSS and GraphPad for the same data. The Kruskal-Wallis p-value reported by the dunn.test package is exactly what I get running the Kruskal-Wallis test itself in R, or in SPSS and Graphpad. There is a warning after I run my code that the dunn.test package was written on a slightly later version of R, but that seems unlikely to be the cause of a factor of 2 variation. Has anyone else come across a similar discrepancy?

Best Answer

The dunn.test package in R uses a one-sided test, whereas SPSS and GraphPad use two-sided tests. There is no facility in the dunn.test package or its function dunn.test() to change to a two-sided test, but the p-values can be multiplied by 2 if a two-sided test is required.

A two-sided Dunn's test is available from the dunnTest() function in package FSA (Fisheries Stock Assessment). This package is not available from CRAN, but can be downloaded by running the code source("http://www.rforge.net/FSA/InstallFSA.R"). It requires an R version more recent than 3.0.2, and I had trouble installing it until I updated the Rcpp package from CRAN. More information on FSA can be found on https://fishr.wordpress.com/fsa/, and documentation on the dunnTest() function can be found on http://www.rforge.net/doc/packages/FSA/dunnTest.html.

Thanks to Stephan Kolassa for his help in resolving this problem.

Related Question