Luis A. Afonso
Posts:
4,725
From:
LIsbon (Portugal)
Registered:
2/16/05


Re: kolmogovsmirnov, wilcoxon and kruskal tests
Posted:
Dec 24, 2012 12:04 PM


It was asked to say something about:
Date: Dec 22, 2012 8:22 PM Author: czytaczgrup@gmail.com Subject: kolmogovsmirnov, wilcoxon and kruskal tests
Hi Everybody, I'm trying to do some hypotheses testing in R and I have problems with interpretation of results. I have two data sets: x<c(2,1,1,2,2,3,2,2,1,2,2,4,1,2,4,1,1,5,2,1,4,2,2,1,1,2,2,1) y<c(2,2,1,1,2,2,1,4,1,4,2,4,4,4,3,2,4,4,3,2,4,5)
according to the KS test they come from the same distribution: ks.test(x,y) If they come from the same distribution all the characteristics (mean, median, ... ) should be the same. However, Wicoxon and Kruskal tests indicate that their null hypothesis should be rejected
wilcox.test(x,y) kruskal.test(list(x,y))
Now, I am puzzled with the outcome of the test. I can simply imagine a situation when Wilcox and Kruskal tests indicate that their null hypothesis should be accepted but the KS test can indicate that samples comes from different distributions. Here, it is the other way round. Does any one has some hints what causes the problems? Best,
Gruppo ________________________________
My Comment
Till yesterday I did suppose that all indication of rank statistics regarding the Twosample KolmogorovSmirnov Test was complete idiotic. Facing the following Richard Ulrich?s response I?m not so sure . . . (Irony?s somewhat a lighter way to disapprove . . . I mean. Christmas Time . . .)
Luis A. Afonso ______________________________________
Date: Dec 23, 2012 4:31 PM Author: Richard Ulrich Subject: Re: kolmogovsmirnov, wilcoxon and kruskal tests
On Sat, 22 Dec 2012 21:27:54 0800 (PST), Ray Koopman <koopman@sfu.ca> wrote:
>On Dec 22, 5:22 pm, czytaczg...@gmail.com wrote: >> [...]>> >> according to the KS test they come from the same distribution: >>NO. You misunderstand the logic of hypothesis testing. Failing to>reject a hypothesis does not mean that it is true or that you should>act as if it were true. It means only that, in the way that the test>looks at data, your data are not inconsistent with the hypothesis. >Other tests, that look at the data differently, may well disagree.
Good statement. I'll just add that these socalled nonparametric tests are based on ranks, and their usual tests are calculated on thebasis of "no ties"  That certainly does not characterize these data, with 50 scores from 1 to 5. It is conceivable that a Montecarlo test of KS, done by generating 10,000 samples with the same margins, would show that the KS testoutcome *is* an unusual one. Or it might not. It seems to me, though I'm not entirely sure, that the KS test is fundamentally testing the number of "interchanges" in ranks (which is a linear metric), whereas the other two tests are measuring the squared differences in ranks. So, he tests may disagree because they are testing two different ways to measure the nonfit. For these data, I would be willing to report the means as meaningful ... and thus, using that as a guide, I would be willing to use the ordinary ttest for comparison? Rich Ulrich

