Skip to content

Instantly share code, notes, and snippets.

@chris-wood
Created August 4, 2016 16:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chris-wood/20a907c634aaeec09db1590a6416b97d to your computer and use it in GitHub Desktop.
Save chris-wood/20a907c634aaeec09db1590a6416b97d to your computer and use it in GitHub Desktop.
kolmogorov_smirnov_test.py
_kolmogorov_smirnov_table = {
(1, 0.2) : 0.900,
(2, 0.2) : 0.684,
(3, 0.2) : 0.565,
(4, 0.2) : 0.494,
# ...
(10, 0.05) : 0.410,
# ...
(100, 0.05) : (1.36 / math.sqrt(100))
# ...
}
def kolmogorov_smirnov_test(F0, Fk, alpha):
n = len(Fk)
statistic = kolmogorov_smirnov_statistic(F0, Fk)
threshold = _kolmogorov_smirnov_table[(n, alpha)]
if statistic > threshold:
return False
return True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment