[R] kruskal test p value way too low.

David Doyle kydaviddoyle at gmail.com
Sun Oct 26 14:55:30 CET 2014


Thank for your help!!  That took care of the problem!

Thank  you again

David "Kentucky Geologist trying to learn R" Doyle

On Sun, Oct 26, 2014 at 12:37 AM, Rolf Turner <r.turner at auckland.ac.nz>
wrote:

> On 26/10/14 16:40, David Doyle wrote:
>
>> Hello,
>>
>> I'm trying to run kruskal test on some data but the p values seemed way
>> too
>> low.  So I tried it on some similar data and still got p-value =
>> 1.611e-09.  I'm sure it is a simple mistake but I can't figure it out.
>>
>> Below is my data and code.  Could it be because there are some miss data /
>> NAs in the data set??  If so, could some one point me towards a solution??
>>
>> Thank you for your time.
>> David
>>
>> mydata <-read.csv("http://doylesdartden.com/R/test.csv", sep=",")
>> kruskal.test(mydata, AMMONIA~Well)
>>
>>          Kruskal-Wallis rank sum test
>>
>> data:  mydata
>> Kruskal-Wallis chi-squared = 36.3952, df = 1, p-value = 1.611e-09
>>
>
> Thank you for providing a clear question and an easily reproducible
> example.
>
> The problem is your syntax for the call to the kruskal.test() function.
>
> It should be:
>
>     kruskal.test(AMMONIA ~ Well, data=mydata)
>
> This gives a p-value of 1 (which agrees with wilcox.test); t.test() gives
> a p-value of 0.7958) so harmony is restored to the universe.
>
> IMHO there is a bit of a design flaw in kruskal.test(); it should have
> thrown an error, given your syntax.  The wilcox.test() function *does*
> throw an error.
>
> cheers,
>
> Rolf Turner
>
> --
> Rolf Turner
> Technical Editor ANZJS
>

	[[alternative HTML version deleted]]



More information about the R-help mailing list