[R] Multiple Comparisons-Kruskal-Wallis-Test: kruskal{agricolae} and kruskalmc{pgirmess} don't yield the same results although they should do (?)

greatest.possible.newbie daniel.hoop at gmx.net
Fri Aug 3 07:42:41 CEST 2012


Hi there,

I am doing multiple comparisons for data that is not normally distributed.
For this purpose I tried both functions kruskal{agricolae} and
kruskalmc{pgirmess}. It confuses me that these functions do not yield the
same results although they are doing the same thing, don't they? Can anyone
tell my why this happens and which function I can trust?

kruskalmc() tells me that there are no differences between any of the groups
(i.e. the "difference" column of the results is filled only with FALSE).
kruskal() tells me that there are indeed differences (between group 4 and
11).

Here is my data and code:

x <- structure(c(-0.089, 0.093, -0.125, -0.253, 0.053, 0.029, 0.429,
0.139, 0.153, -0.035, 0.721, 0, -0.271, -0.014, 0.038, 0.107, 
-0.064, -0.178, 0, -0.065, 0.232, 0, -0.036, 0.107, -0.018, -0.632, 
0.189, -0.247, -0.982, 0.161, 0.307, 0.146, 0.21, -0.043, -0.029, 
0.107, -0.043, -0.178, 0.036, 0.511, 0, 0.307, 0.389, -0.754, 
0.152, -0.129, 0.65, 0.411, 0, 0.539, -0.122, 0.514, -0.15, -1.19, 
-0.032, 0.103, 0, -0.522, -0.857, -0.036, 0.104, -0.357, 0.114, 
-0.054, 0.04, 0.036, 0.086, 0.736, -0.097, 0.784, 0.053, 0.007, 
-0.646, 0.185, 0.107, -0.115, 0, -0.036, -0.082, -0.113, -0.032, 
0.354, -0.095, -0.328, -0.215, -0.036, 0, 0.357, 0, 0.108, -0.014, 
0.307, -0.053, 0.318, -0.058, 0.268, -0.067, 0.071, 0.261, -0.018, 
0.054, 0.086, 1.107, -0.617, 0.286, 0.072, 0.036, 0.179, -0.096, 
0.143, 0.45, -0.21, 0.372, 0.061, -0.218, -0.214, 0.272, 0.108, 
0.175, -0.017, 0.473, -0.575, 0.083, 0.025, 0.25, -0.843, -0.054, 
-0.775, 0.036, -0.297, 0.8, 0.004, 0.189, 0.005, 0.103, 0.289, 
-0.107, -0.096, 0, 0.015, -0.035, -0.125, 0.125, -0.071, -0.029, 
-0.643, -0.008, 0.184, 0.303, 0, -0.164, 0.047, -0.062, -0.164, 
-0.604, -0.178, 0.233, -0.154, -0.107, -0.14, -0.207, 0.211, 
0.175, 0.714, 0, 0.286, -0.143, 0.018, 0.643, -0.036, 0.357, 
0.071, 0.186, 0.104, -0.086, -0.611, -0.028, -0.025, 0.179, -0.032, 
0.058, 0.04, -0.428, 0.447, 0.178, -0.061, 0.167, -0.071, 0.321, 
0.082, 0.532, -0.22, 0.086, -0.107, 0.118, -0.139, 0.03, -0.228, 
0.008, 0.178, -0.3, 0.018, -0.025, -0.329, 0.136, 0.304, 0.085, 
-0.014, 0.07, 0.136, -0.218, 0.071, -0.178, 0.012, 0.229, 0.268, 
-0.535, 0.164, -0.15, 0.097, 0.125, -0.536, 0.214, 0.222, -0.089, 
-0.121, -0.155, -0.286, -0.282, -0.443, 0.071, -0.05, -0.04, 
-0.075, -0.03, -0.357, -0.071, 0.641, 0.007, 0, 0.018, -0.573, 
0.132, -0.33, -0.279, -0.639, -0.093, -0.5, -0.197, 0.303, 0.322, 
-0.071, -0.071, 0.165, 0, 0, 0, 0, 0.054, -0.321, 0.093, 0.268, 
-0.511, -0.3, 0.202, 0.328, -0.24, 0.871, -0.021, 0.211, 0.118, 
-0.157, -0.357, 0.107, 0, 0.072, -0.357, 0.003, 0.147, 0.057, 
-0.315, 0.053, 0.35, -0.107, 0.036, -0.143, 0.168, 0, 0.172, 
0.321, 0.178, -0.526, -0.035, 0.247, 0.557, 0.168, 0.143, 0, 
-0.432, 0.072, -0.065, 1, 0, 0.179, 0.218, 0.196, -0.122, -0.457, 
0.072, 0, 0.247, -0.296, -0.118, 0.107, 0.136, 0.029, -0.058, 
0.25, 0.139, -0.057, 0.15, 0.042, -0.703, -0.018, -0.318, -0.011, 
-0.321, -0.6, -1.189, 0.225, -0.143, -0.112, 0.09, -0.071, -0.015, 
0.828, 0.124, 0.582, 0.689, -0.107, 0.017, -0.15, 0.057, 0.143, 
0.107, -0.204, -0.118, 0.021, 0.067, -0.035, -0.357, -1.015, 
-0.039, 0.046, -0.036, 0.072, 0.204, 0.05, -0.038, 0, 0.057, 
-0.05, 0.41, 0.143, -0.325, 0.332, -0.153, 0.157, -0.185, 0.206, 
-0.086, -0.204, 0, 0.271, -0.143, 0, -0.357, 0.218, 0.036, 0.179, 
-0.45, 0.072, 0.018, -0.259, 0, -0.53, -0.018, -0.054, 0.435, 
0.378, 0.221, -0.921, -0.375, -0.54, 0.25, -0.16, 0, -0.007, 
-0.357, 0.204, 0.129, 0, -0.45, 0, 0, 0.571, 0.392, 0, -0.465, 
0.072, 0.072, -0.257, -0.007, 0.039, 0, 0.299, -0.526, 0.268, 
-0.05, -0.45, 0.178, 0.025, 0.072, 0.107, 0.195, 0.089, 0.115, 
0, 0.189, -0.036, -0.337, -0.45, -0.34, -0.065, 0.343, -0.071, 
0.107, -0.111, 0, -0.411, -1.012, -0.108, -0.036, -0.036, 0.243, 
-0.118, 0.045, 0.018, -0.607, 0.196, -0.425, -0.174, 0.068, -0.886, 
-0.075, 0.143, 0.09, 0.482, -0.058, -0.2, 0.341, -0.014, 0.068, 
0.107, 0.078, 0.107, -0.25, 0.382, -0.122, -0.466, -0.471, 0.046, 
0.229, 0.329, 0.043, -0.207, 0.357, 0.029, 0.107, 0.286, 0, -0.15, 
-0.389, -0.261, -0.135, 1.028, 0.384, 0.136, -0.147, -0.143, 
0.486, -0.075, -0.036, 0.04, -0.214, 0, 0.286, 0.071, 0.25, 0.115, 
1, 7, 5, 1, 1, 1, 11, 8, 3, 11, 9, 4, 9, 2, 1, 1, 4, 2, 2, 4, 
2, 1, 1, 6, 4, 4, 8, 1, 4, 1, 9, 1, 11, 9, 3, 10, 1, 4, 1, 5, 
2, 1, 1, 1, 1, 3, 7, 11, 1, 1, 2, 1, 1, 2, 1, 1, 8, 2, 1, 1, 
1, 1, 1, 10, 3, 4, 1, 10, 2, 1, 1, 6, 5, 1, 1, 11, 1, 11, 3, 
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1, 1, 1, 
1, 1, 2, 10, 1, 6, 2, 1, 1, 1, 1, 1, 1, 1, 10, 10, 6, 11, 1, 
1, 1, 1, 11, 1, 1, 1, 1, 2, 1, 1, 1, 7, 6, 1, 1, 1, 9, 1, 7, 
11, 4, 1, 1, 1, 1, 8, 1, 1, 6, 1, 2, 1, 3, 1, 11, 1, 5, 1, 6, 
1, 1, 11, 6, 1, 1, 1, 2, 1, 1, 2, 6, 7, 7, 1, 8, 3, 1, 1, 1, 
7, 1, 1), .Dim = c(500L, 2L))

#Now perform the kruskalmc() test. 

require(pgirmess)
kruskalmc(x[,1], x[,2])

#Multiple comparison test after Kruskal-Wallis 
#p.value: 0.05 
#Comparisons
#        obs.dif critical.dif difference
#1-2    8.4929415     82.16065      FALSE
#1-3    2.6363784    104.15270      FALSE
#1-4   22.5503277    102.13541      FALSE
#1-5   13.2511610    100.24365      FALSE
#1-6    0.8574104    108.62307      FALSE
#[..........]
#8-9   17.8228070    165.54197      FALSE
#8-10   9.5230263    162.62538      FALSE
#8-11  26.2159443    137.28174      FALSE
#9-10  27.3458333    172.25281      FALSE
#9-11   8.3931373    148.56074      FALSE
#10-11 35.7389706    145.30369      FALSE

require(agricolae)
kruskal(x[,1], x[,2])

# [ ... ]
#Means with the same letter are not significantly different
#Groups, Treatments and mean of the ranks
#a    11      304.4 
#ab   9       296 
#ab   7       286.6 
#ab   8       278.2 
#ab   10      268.7 
#ab   2       250.6 
#ab   6       242.9 
#ab   1       242.1 
#ab   3       239.4 
#ab   5       228.8 
#b    4       219.5 



--
View this message in context: http://r.789695.n4.nabble.com/Multiple-Comparisons-Kruskal-Wallis-Test-kruskal-agricolae-and-kruskalmc-pgirmess-don-t-yield-the-sa-tp4639004.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list