Using Kolmogorov–Smirnov test A newbie question (please provide detailed answers):
I am trying to use the Kolmogorov–Smirnov test. I managed to calculate the difference between the empirical points and the theoretical distribution $D$ (following Wikipedia). But then I am a bit confused about the test:


*

*Is the null hypothesis that the empirical data is or is not distributed according to the theoretical distribution?

*How do I determine the critical level $\alpha$ when I have $D$? I can use this class to calculate the Kolmogorov Smirnov distribution.


I think I have all the ingredients, but I am not sure how to put them together.
 A: 1) The null hypothesis is that the data is distributed according to the theoretical distribution.
2)  Let $N$ be your sample size, $D$ be the observed value of the Kolmogorov-Smirnov test statistic, and define $\lambda = D(0.12 + \sqrt{N} + 0.11 / \sqrt{N})$.  Then the p-value for the test statistic is approximately:
$Q = 2 \sum_{j=1}^{\infty}(-1)^{j-1}\exp\{-2j^2\lambda^2\}$
Obviously you can't calculate the infinite sum, but if you sum over 100 values or so this will get you very, very, very close.  This approximation is quite good even for small values of $N$, as low as 5 if I recall correctly, and gets better as $N$ increases.  Note, however, that @whuber in comments proposes a better approach.
This is a perfectly reasonable alternative to the Shapiro-Wilk test I suggested in answer to your other question, by the way.  Shapiro-Wilk is more powerful, but if your sample size is in the high hundreds, the Kolmogorov-Smirnov test will have quite a bit of power too.
A: *

*No. Null hypothesis that the empirical data is distributed according to the theoretical distribution.

*Not familiar with java function. But KS test critical values are available online. Also available in the appendix of statistics books which deals nonparametric tests. You can compare few values with the java function and the table. (Please let us know if it is different)
