0
$\begingroup$

I have four samples (x1, x2, x3, and x4) as thier values shown below

> x1
 [1] 0.6343592 0.4960767 0.5802182 0.5224468 0.5774899 0.4938405
 [7] 0.6413160 0.6168486 0.4975457 0.6120071 0.5813722 0.5425456
[13] 0.4792247 0.5383875 0.5702392 0.4406344 0.5309179 0.5509874
[19] 0.5457732 0.5413252 0.5338342 0.4286551 0.4222129 0.5207673
[25] 0.4984457 0.5304531
> x2
 [1] 0.7181799 0.4925333 0.5131511 0.5536727 0.6369794 0.5294548
 [7] 0.5027039 0.5640035 0.5602509 0.6028623 0.5796146 0.5604145
[13] 0.5433392 0.5080444 0.5376570 0.4539623 0.5471905 0.5695738
[19] 0.5545275 0.5999702 0.5630518 0.5747470 0.5287676 0.4027051
[25] 0.4779424 0.5447307
> x3
 [1] 0.5948402 0.5494434 0.5960296 0.5634001 0.6044936 0.6109550
 [7] 0.5234166 0.6028709 0.5049527 0.6092599 0.6330479 0.6176069
[13] 0.5755432 0.5345823 0.5176935 0.5439285 0.5304621 0.5560827
[19] 0.6256231 0.5500233 0.5482850 0.5255282 0.5158963 0.5380739
[25] 0.5453110 0.5395740
> x4
 [1] 0.6806158 0.5835167 0.6193832 0.4222333 0.5425774 0.4785489
 [7] 0.4474077 0.4303011 0.6169782 0.4598568 0.4713550 0.4516266
[13] 0.4754098 0.6126220 0.4883478 0.4667159 0.4642833 0.5761202
[19] 0.4414092 0.5019286 0.5978668 0.4861931 0.4944485 0.4815222
[25] 0.4877936 0.5955430

I tried to calculate p-value of kruskal.test which was pretty straight forward

> kruskal.test(list(x1, x2, x3, x4))
Kruskal-Wallis chi-squared = 9.9539, df = 3, p-value = 0.01896

However when I tried to find out the result of kruskal.test p-value between any of these samples, the results were equal to 0.4624 for any pairs of them do these results have any interpretation? More clearly am I doing something wrong to get these identical results for different samples or there are other reasons that I should know of?

> kruskal.test(x1, x2)
Kruskal-Wallis chi-squared = 25, df = 25, p-value = 0.4624

> kruskal.test(x1, x3)
Kruskal-Wallis chi-squared = 25, df = 25, p-value = 0.4624

> kruskal.test(x2, x3)
Kruskal-Wallis chi-squared = 25, df = 25, p-value = 0.4624
$\endgroup$
1
$\begingroup$

Looks like you're loading in your data wrong when running the pairwise comparisons. When separating them by a coma, R is expecting a vector that distinguishes the groups from each other. You could fix this by providing the data in the same you way did intially.

kruskal.test(list(x1, x2))

Also, instead of running kruskal.test on each pair, you could also do a dunn.test from the library dunn.test. This will do the pairwise comparisons for you.

| cite | improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.