Dear R users I am using KS test to compare two different distribution for the same variable (temperature) for two different time periods. H0: the two distributions are equal H1: the two distributions are different ks.test (temp12, temp22) Two-sample Kolmogorov-Smirnov test data: temp12 and temp22 D = 0.2047, p-value < 2.2e-16 alternative hypothesis: two-sided Warning message: In ks.test(temp12, temp22) : cannot compute correct p-values with ties I don't rally know how to interpret the output from R. Any help is appreciated. ** [[alternative HTML version deleted]]
On Aug 20, 2010, at 9:19 AM, Izidine Pinto wrote:> Dear R users > I am using KS test to compare two different distribution for the same > variable (temperature) for two different time periods. > H0: the two distributions are equal > H1: the two distributions are different > > ks.test (temp12, temp22) > > Two-sample Kolmogorov-Smirnov test > > data: temp12 and temp22 > D = 0.2047, p-value < 2.2e-16 > alternative hypothesis: two-sided > > Warning message: > In ks.test(temp12, temp22) : cannot compute correct p-values with tiesThis question comes up so often there should probably be a FAQ, but I just checked and there is not one (yet). It's only a warning, but it does mean that you need to check the distribution of your values to see how far they depart fro the theoretical ideal of continuous functions for which the KS test was developed. There are alternatives to the ordinary KS test from wilcox.test and the help page refers you to wilcox_test in package coin with a note that it handles situations with ties. (With a p-value that is numerically equivalent to zero, it seems unlikely that the final answer will be materially different than what you are now looking at.) -- David> I don't rally know how to interpret the output from R. > > Any help is appreciated. >-- David Winsemius, MD West Hartford, CT
Hi Izidine, On Friday, 20. August 2010 15:19:24 Izidine Pinto wrote:> Dear R users > I am using KS test to compare two different distribution for the same > variable (temperature) for two different time periods. > H0: the two distributions are equal > H1: the two distributions are different > > ks.test (temp12, temp22) > > Two-sample Kolmogorov-Smirnov test > > data: temp12 and temp22This tells you where the data comes from that was used in this test, basically the program-variable you assigned the values to.> D = 0.2047, p-value < 2.2e-16D represents the value of the test-statistic (difference), so the KS-statistic and the p-value represents the likelihood of observing this particular value of D, or a "more extreme" value by pure chance.> alternative hypothesis: two-sided > > Warning message: > In ks.test(temp12, temp22) : cannot compute correct p-values with tiesThis tells you, that ties occured when performing the test. A "tie" means that two or more samples had the same value. The problem with ties is basically, that it results in difficulties calculating the variance of your variable. Some tests account for this by calculating exact p-values based on permutations, which is, especially for larger sample sizes, computationally expensive.> I don't rally know how to interpret the output from R.I don't want to judge your skills on statistics. However, it seems to me, that you are not completely familiar with the concept of hypothesis testing, the applied statistical tests and the interpretation of the results. Understanding what the test statistic and p-value (confidence interval etc.) are is fundamental for any subsequent steps, especially the interpretation of the calculated results. I had to learn this personally only recently ;) After all, R is just a tool, but the concepts behind the methods it offers must be understood separately as they are basic statistics most of the time.> Any help is appreciated. > > **Hope that makes it a bite more clear. Otherwise, please feel free to ask further :)> > [[alternative HTML version deleted]] >Best, Cedric> ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html and provide commented, > minimal, self-contained, reproducible code.
On Friday, 20. August 2010 15:19:24 Izidine Pinto wrote:> Dear R users > I am using KS test to compare two different distribution for the same > variable (temperature) for two different time periods. > H0: the two distributions are equal > H1: the two distributions are different > > ks.test (temp12, temp22) > > Two-sample Kolmogorov-Smirnov test > > data: temp12 and temp22 > D = 0.2047, p-value < 2.2e-16 > alternative hypothesis: two-sided > > Warning message: > In ks.test(temp12, temp22) : cannot compute correct p-values with ties > > I don't rally know how to interpret the output from R. > > Any help is appreciated. > > ** > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html and provide commented, > minimal, self-contained, reproducible code.Oh, it seems my answer was a little bit to encompassing, as it seemed to me, that you did not understand the output of R at all. If you were only refering your question to the part about ties, then please forget my suggestions on deepening your skills on statistics. Again, those were just hints, based on personal experience :) Best, Cedric