Friday, December 6, 2013

Interpret KS.test from R

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
This 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-16
D 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 ties
This 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.