Skip to content
Prev 318641 / 398506 Next

Kolmogorov-Smirnov: calculate p value given as input the test statistic

On 03/03/2013 09:58, Rani Elkon wrote:
There is no public way to do this in R.  But you can read the code of 
ks.test and see how it does it, and extract the code you need.

Note that ks.test covers several cases and hence has several branches of 
code to compute p values.  Also (and this is one good reason why there 
is no a public interface), the internal code differs by version of R (so 
another answer I have just seen is wrong for pre-3.0.0).
Yes, because if you have the CDF you can recover the sorted data vector 
which is all you need.