Statistics & probability

Two sample Kolmogorov Smirnov empirical distance calculator

Comparing two samples by their means can miss differences in spread or shape.

Your numbers

Enter the stated row or dataset format. No missing cells or thousands separators. Keep observation order where it represents pairing or time.
Enter the stated row or dataset format. No missing cells or thousands separators. Keep observation order where it represents pairing or time.

Calculated on your device. Your inputs aren’t sent to us.

Your result

Ready when you are

Enter your inputs and select Calculate.

Try it, understand it

Explore the result

Comparing two samples by their means can miss differences in spread or shape. The two-sample Kolmogorov–Smirnov distance compares their empirical cumulative distributions across all observed values.

Worked example comparison
ExampleOutputWhat to notice
Worked exampleEmpirical two sample Kolmogorov Smirnov distance0.5For A equal to one and two and B equal to two and three, FA is one half at value one while FB is zero. At value two the cumulative fractions are one and one half. The maximum absolute gap is therefore 0.5. At value three both cumulative fractions reach one. The displayed table exposes each step used to find the maximum.
Compare a changed assumptionEmpirical two sample Kolmogorov Smirnov distance0Use identical empirical samples and inspect the zero-distance limit.

Check your understanding

Does a zero empirical distance prove identical population distributions?

No. It means the entered finite samples have identical empirical cumulative distributions.

Predict the comparison before running it

Use identical empirical samples and inspect the zero-distance limit.

Behind the numbers

How this calculation works

Comparing two samples by their means can miss differences in spread or shape. The two-sample Kolmogorov–Smirnov distance compares their empirical cumulative distributions across all observed values. This page reports the largest absolute gap and its two signed directional components. It intentionally reports a descriptive distance rather than attaching a continuous-null p value to any dataset supplied.

THE FORMULAD = maximum over x |FA(x)−FB(x)|

A worked example

For A equal to one and two and B equal to two and three, FA is one half at value one while FB is zero. At value two the cumulative fractions are one and one half. The maximum absolute gap is therefore 0.5. At value three both cumulative fractions reach one. The displayed table exposes each step used to find the maximum.

Good to know

No hypothesis-test p value or rejection cutoff is provided. Classical continuous-distribution null formulas do not automatically apply to ties, discrete outcomes or paired measurements. Dependencies between observations and sampling design are not corrected. The distance is useful for describing distributions but cannot establish causal change or equivalence by itself.

What this calculation answers

Comparing two samples by their means can miss differences in spread or shape. The two-sample Kolmogorov–Smirnov distance compares their empirical cumulative distributions across all observed values.

This page reports the largest absolute gap and its two signed directional components. It intentionally reports a descriptive distance rather than attaching a continuous-null p value to any dataset supplied.

The Sample percentile calculator examines selected empirical quantiles. The KS distance instead searches the entire empirical cumulative difference.

Use the right input conventions

Enter each numeric sample as a list. The samples may have different sizes. Their values must describe comparable quantities in the same units; row order does not create pairing in this calculation.

Pooled distinct values are sorted and all observations tied at a value advance together. That convention makes the empirical cumulative fractions explicit and avoids arbitrary within-tie ordering.

Interpret the result

The distance ranges from zero for identical empirical distributions to one for completely separated supports. Its value does not indicate which physical cause produced the difference, or whether that difference is substantively important.

A signed gap FA minus FB means a larger fraction of A is at or below that threshold. Read it as a cumulative-distribution comparison, not as the difference between sample means.

Work through the example

For A equal to one and two and B equal to two and three, FA is one half at value one while FB is zero. At value two the cumulative fractions are one and one half.

The maximum absolute gap is therefore 0.5. At value three both cumulative fractions reach one. The displayed table exposes each step used to find the maximum.

Where the model stops

No hypothesis-test p value or rejection cutoff is provided. Classical continuous-distribution null formulas do not automatically apply to ties, discrete outcomes or paired measurements.

Dependencies between observations and sampling design are not corrected. The distance is useful for describing distributions but cannot establish causal change or equivalence by itself.

A few questions, answered

Does a zero empirical distance prove identical population distributions?

No. It means the entered finite samples have identical empirical cumulative distributions.

What changes in the comparison?

Use identical empirical samples and inspect the zero-distance limit.

Find your calculator

Start typing to explore the library.