# Kolmogorov-Smirnov test

**URL:** <https://discourse.julialang.org/t/kolmogorov-smirnov-test/89990>\
**Category:** Statistics\
**Tags:** distributions, hypothesis-tests\
**Created:** [November 9, 2022, 3:38pm UTC](https://discourse.julialang.org/t/kolmogorov-smirnov-test/89990 "2022-11-09T15:38:05Z")\
**Posts on this page:** 4\
**Page:** 2

<div class="post-metadata">

**Author:** ![nalimilan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nalimilan/32/147_2.png) [@nalimilan](https://discourse.julialang.org/u/nalimilan)\
**Post date:** [April 29, 2025, 9:06pm UTC](https://discourse.julialang.org/t/kolmogorov-smirnov-test/89990/21 "2025-04-29T21:06:03Z")

</div>

Note that the references you mention do not give the formula to compute the p-value, but assume you have chosen its level and want to check whether the critical value is consistent with it or not. So it’s not unreasonable to expect the formula to be a bit different. That said it’s definitely worth investigating, possibly throwing an error if we think the function is unreliable at the moment.

---

<div class="post-metadata">

**Author:** ![Dan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dan/32/42581_2.png) [@Dan](https://discourse.julialang.org/u/Dan)\
**Post date:** [April 30, 2025, 1:30am UTC](https://discourse.julialang.org/t/kolmogorov-smirnov-test/89990/22 "2025-04-30T01:30:16Z")

</div>

An easy way to test this without reading any paper would be to test the distribution of the p-values of null hypothesis generated data (should be uniform [0,1])  
This would be a good backup method in any case.

---

<div class="post-metadata">

**Author:** ![Dan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dan/32/42581_2.png) [@Dan](https://discourse.julialang.org/u/Dan)\
**Post date:** [April 30, 2025, 8:01pm UTC](https://discourse.julialang.org/t/kolmogorov-smirnov-test/89990/23 "2025-04-30T20:01:50Z")

</div>

> [@Dan](#):
>
> (should be uniform [0,1])

An amusing caveat: How does one test if the p-values distribute `Uniform(0,1)` ? Using the Kolmogorov-Smirnov test. This is awkwardly circular, but this can be remedied by choosing the number of samples `N` for the uniformity test high enough to make it pass reasonable thresholds.

---

<div class="post-metadata">

**Author:** ![andreasnoack](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/andreasnoack/32/27_2.png) [@andreasnoack](https://discourse.julialang.org/u/andreasnoack)\
**Post date:** [October 22, 2025, 6:46pm UTC](https://discourse.julialang.org/t/kolmogorov-smirnov-test/89990/24 "2025-10-22T18:46:20Z")

</div>

The issue here was fixed in [Handle discrete distributions in ExactOneSampleKSTest by andreasnoack · Pull Request #350 · JuliaStats/HypothesisTests.jl · GitHub](https://github.com/JuliaStats/HypothesisTests.jl/pull/350) and will be available soon with [New version: HypothesisTests v0.11.6 by JuliaRegistrator · Pull Request #141006 · JuliaRegistries/General · GitHub](https://github.com/JuliaRegistries/General/pull/141006).

[Previous page](https://discourse.julialang.org/t/kolmogorov-smirnov-test/89990.md?page=1)
