Does the Kolmogorov smirnoff test implemented in matlab already perform a correction for small sample sizes?
2 views (last 30 days)
I want to use the KS test on a rather small dataset and I know that for this case, several correction terms exist for some distributions (compare http://www.vosesoftware.com/whitepapers/Fitting%20distributions%20to%20data.pdf)
eg the correction for normal distributions would be ksstat*=(√n-0.01*(0.85/√n))*ksstat
Does the function kstest already take those corrections into account when computing its results? If not I would need to modify it myself. According to the correction terms one can calculate the new KSstatistic but how can I then derive the p-value and the cut-off value given a certain significance level alpha?
Tom Lane on 14 Jun 2012
If you "edit kstest" you'll see some references. The paper by Marsaglia et al. describes how the p-values are computed. The kstest requires that you test against predetermined parameter values.
If I understand the Vose paper by skimming it quickly, the correction described there is intended to deal with the case where you estimate the parameters from the data. In the Statistics Toolbox, the lillietest function is intended for that case. It uses the same test statistic as the Kolmogorov-Smirnov test, but computes the p-value differently. Again, you can edit that function and see the original reference by Lilliefors and some more recent references. It looks like the Vose material and the lillietest function are both based on Monte Carlo simulations, so they may use similar ideas if not identical formulas.