CalcWorldHub
Free online calculator · no signup

Two sample Kolmogorov Smirnov CDF distance calculator

Compare two empirical distributions using their largest CDF separation, detecting changes beyond a shift in their means.

4,000 tools
Two sample Kolmogorov Smirnov CDF distance calculator — First independent sample, Second independent sample and calculation method
Two sample Kolmogorov Smirnov CDF distance calculator: inputs and calculation method.

How to use this calculator

Compare two empirical distributions using their largest CDF separation, detecting changes beyond a shift in their means.

  1. Enter First independent sample, Second independent sample. Match the units shown beside each field and review the result together with the assumptions below.
  2. Read the worked example below to check the expected input format and result.
  3. Compare another scenario by changing one input at a time. Use Reset to return to the starting values.
Calculation guide

Two sample Kolmogorov Smirnov CDF distance explained

The distance is the largest gap between the empirical CDFs; the asymptotic p-value uses an independent, continuous-distribution null, so ties can affect its calibration.

Inputs, symbols, and units

x — First independent sample
Ordered values in the role named above. Match row positions with other lists and use a consistent measurement unit within the same variable. Use comma-separated values in the stated order.
y — Second independent sample
Ordered values in the role named above. Match row positions with other lists and use a consistent measurement unit within the same variable. Use comma-separated values in the stated order.

Formula and method

D=maxx|Fn(x)−Gm(x)|; approximate tail=QKS(√[nm/(n+m)]D).

Merge the unique observed values and advance both empirical CDFs through tied values together. The distance is exact for the entered data; the displayed p-value uses the limiting continuous-null distribution.

A worked scenario

First independent sample = 1,2,2.5,3,4,5; Second independent sample = 2,3,4,5,6,7,8.

  • Two-sample KS distance D: 0.42857143
  • Asymptotic two-sided p-value: 0.59307955

The first sample ends at five while the second continues to eight. The calculation checks every pooled observed value, including the upper tail where the first empirical CDF is already one.

Assumptions and edge cases

Independent samples, at least two values each, at most 2,000 combined. Ties and discrete outcomes make the continuous reference conservative or otherwise inaccurate; no finite-sample correction is applied.

Reading the outputs

A larger D means greater distributional separation. The p-value does not identify whether location, spread, or shape caused that separation.

Frequently asked questions

Does this test compare means?

It compares entire distributions; equal means can coexist with a large CDF gap.

Must the sample sizes match?

No. Each CDF is normalized by its own sample size.

Is it appropriate for paired measurements?

No. Pairing requires a method that preserves dependence within pairs.

How do I use the Two sample Kolmogorov Smirnov CDF distance calculator?

Enter First independent sample, Second independent sample. Match the units shown beside each field and review the result together with the assumptions below.

What is a worked example of Two sample Kolmogorov Smirnov CDF distance?

First independent sample = 1,2,2.5,3,4,5; Second independent sample = 2,3,4,5,6,7,8. Two-sample KS distance D: 0.42857143 Asymptotic two-sided p-value: 0.59307955 The first sample ends at five while the second continues to eight. The calculation checks every pooled observed value, including the upper tail where the first empirical CDF is already one.