Kolmogorov-Smirnov Test
Testing whether a sample comes from a specified distribution, or whether two samples come from the same distribution, using the empirical CDF.
The KS statistic D = 0.195 is the largest vertical gap between the empirical CDF (step function) and the theoretical CDF (smooth curve). Larger n โ closer agreement.
The Kolmogorov-Smirnov (KS) test tests whether a sample comes from a specified distribution (one-sample) or whether two samples come from the same distribution (two-sample).
Empirical CDF: for data , the empirical CDF is .
One-sample test: compare to the hypothesized CDF :
Two-sample test: compare empirical CDFs from two samples:
Large is evidence against (same distribution).
Data: (). Test : standard normal.
The empirical CDF is a step function. We find the largest vertical gap between this step function and (the standard normal CDF). If , the critical value at for is 0.565. Since , fail to reject normality.
Why should you generally not use the one-sample KS test to test normality when the mean and variance were estimated from the same data?
Solution
The KS test assumes the null distribution is completely specified in advance โ not estimated from the data. If you estimate and from the data, then fit , the estimated distribution will always fit better than a fixed one would. The KS critical values are too conservative (too large), meaning you'll fail to reject normality too often (p-values are too large).
Use the Lilliefors test instead โ it's the KS test with corrected critical values for the case where parameters are estimated from the data. Or use the Shapiro-Wilk test, which is generally more powerful for testing normality.
Related concepts
Needs first
Related