Re: kolmogorov-smirnov two-sample test

Home 21090308 Forums Re: kolmogorov-smirnov two-sample test


For the two-sample case, our code does the following:

  • compute the test statistics D = the max distance between two empirical distributions
  • compute p-value = 1.0 – F.cdf(D) (for the case when F is a pdf not a pmf)

Then, you can use the p-value to compare with whatever alpha you like.

It seems you are trying to solve a reverse problem, given alpha, you want to find D. So, you may want to do something like:
F.cdf(D) = 1.0 – alpha
D = F^-1(1.0 – alpha)

You can use the [tt:3719i9ux]quantile[/tt:3719i9ux] method in a uni-variate distribution to compute it.

Again, you can create any instance of the K-S distribution as you like.

We have done a lot of testings to make sure the values computed are corrected, including consulting the NIST website you quoted above.