Take the 2-minute tour ×
Cross Validated is a question and answer site for people interested in statistics, machine learning, data analysis, data mining, and data visualization. It's 100% free, no registration required.

I'm writing some C++ code that uses a two-sample K-S test. I've computed the largest difference between the two cumulative density functions, $D$, and then compute the test statistic $x = \sqrt{\frac{n_1 n_2}{n_1 + n_2}} D$.

Does anyone know of a simple form for the cumulative density function under the null hypothesis? I found the asymptotic form when $n \rightarrow \infty$ on Wikipedia:

But I haven't been able to find any approximation where $n$ is not large. Can you give me the formula or provide a reference?

Thanks a lot.

share|improve this question
1  
You may read how SPSS computes p-value for KS test (one-sample, 2-sample) in this document –  ttnphns Dec 15 '12 at 16:31
2  
This is expressible in terms of a Jacobi Theta function, $\frac{1}{x} e^{\frac{3 \pi ^2}{8 x^2}} \left(e^{-\frac{\pi ^2}{2 x^2}}\right)^{3/4} \sqrt{\frac{\pi }{2}} \vartheta_2\left(0,e^{-\frac{\pi ^2}{2 x^2}}\right)$. But what is your question? It seems to have been cut off after "$n$ i...". –  whuber Dec 15 '12 at 22:02
    
Thanks! Oops-- edited. –  Oliver Dec 25 '12 at 18:21
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.