Home
0 values
📋 Or paste multiple values (comma, space, or line separated)
No data entered. Add values above or paste a list.
0 values
📋 Or paste multiple values (comma, space, or line separated)
No data entered. Add values above or paste a list.

What Is the Kolmogorov-Smirnov Test?

The Kolmogorov-Smirnov (K-S) test is a nonparametric statistical test used to determine whether a sample comes from a specified theoretical distribution (one-sample test) or whether two independent samples come from the same distribution (two-sample test). It is a goodness-of-fit test that does not require assumptions about the underlying distribution.

Null Hypothesis (H₀): The sample(s) come from the specified distribution (or the two samples come from the same distribution).

Alternative Hypothesis (H₁): The sample(s) do not come from the specified distribution (or the two samples come from different distributions).

How the Test Works

  1. Sort Data: Sort all observations in ascending order.
  2. Compute ECDF: Calculate the empirical cumulative distribution function (ECDF) for each sample. The ECDF at a point x is the proportion of observations ≤ x.
  3. Calculate D Statistic: Find the maximum absolute difference between the two cumulative distribution functions: D = sup|x|F₁(x) − F₂(x)|
  4. Determine Significance: Compare D to the critical value or use the p-value. A larger D indicates greater divergence from the null hypothesis.

When to Use the K-S Test

  • Testing for normality (one-sample test against the normal distribution).
  • Comparing two independent samples to see if they come from the same distribution (two-sample test).
  • When data is continuous and ordinal.
  • When you do not want to make parametric assumptions about the data.

Why Use This Calculator?

  • One-Sample and Two-Sample Tests: Supports both test types.
  • Complete Analysis: Get D statistic, p-value, critical value, and ECDF table.
  • Step-by-Step: Follow the calculation process with detailed steps.
  • Visual Chart: Compare ECDFs with an interactive chart.
  • Free & Private: No registration, no data storage.

❓ Kolmogorov-Smirnov Test Calculator FAQ

What is the Kolmogorov-Smirnov test?

The Kolmogorov-Smirnov (K-S) test is a nonparametric goodness-of-fit test used to determine whether a sample comes from a specified distribution (one-sample) or whether two samples come from the same distribution (two-sample).

What is the D statistic?

The D statistic is the maximum absolute difference between two cumulative distribution functions. It is defined as D = sup|x|F₁(x) − F₂(x)|.

What is the null hypothesis of the K-S test?

For the one-sample test, the null hypothesis states that the sample comes from the specified theoretical distribution. For the two-sample test, the null hypothesis states that the two samples come from the same distribution.

How do I interpret the p-value?

If the p-value is less than your significance level (α), you reject the null hypothesis and conclude that the sample does not come from the specified distribution (or the two samples differ). If p > α, you fail to reject the null hypothesis.

What is the difference between one-sample and two-sample K-S tests?

The one-sample K-S test compares a sample to a theoretical distribution (like the normal distribution). The two-sample K-S test compares two independent samples to determine if they come from the same distribution.

What are the assumptions of the K-S test?

The data should be measured on at least an ordinal scale, observations should be independent, and the test parameters (mean and SD) are estimated from the sample for the normality test.

Is the K-S test affected by outliers?

Yes, the K-S test is sensitive to outliers because the D statistic is based on the maximum difference between distributions. Outliers can significantly affect the ECDF.

What are the limitations of the K-S test?

The K-S test is more sensitive to deviations in the center of the distribution than in the tails. It may have low power with small sample sizes. The Shapiro-Wilk test is often recommended as an alternative for normality testing, especially for small samples.

How is the critical value determined?

The critical value depends on the sample size (n) and the chosen significance level (α). For the one-sample test, critical values are tabulated for various n and α levels.

What is the ECDF?

The Empirical Cumulative Distribution Function (ECDF) is the proportion of observations in a sample that are less than or equal to a given value. It is a step function that increases by 1/N at each ordered data point.

Can I use the K-S test for discrete data?

The K-S test was designed for continuous distributions. While it can be applied to discrete data, the results may be conservative. Other tests like the Chi-square test may be more appropriate for discrete data.

What is the difference between the K-S test and the Shapiro-Wilk test?

Both tests are used for normality testing. The Shapiro-Wilk test is generally more powerful for detecting departures from normality, especially with small samples. The K-S test is more sensitive to differences in the center of the distribution.

How many samples can I compare?

The two-sample K-S test compares exactly two independent samples. For comparing more than two samples, consider the Kruskal-Wallis test or the Anderson-Darling k-sample test.

What is the tie correction in the K-S test?

The K-S test handles ties naturally because it uses the ECDF, which counts tied values as part of the cumulative proportion. No special tie correction is needed for the K-S test.

Is this calculator free?

Yes, this calculator is completely free to use. No registration or personal data storage is required. All calculations are performed in your browser.