Created
August 4, 2016 16:34
-
-
Save chris-wood/20a907c634aaeec09db1590a6416b97d to your computer and use it in GitHub Desktop.
kolmogorov_smirnov_test.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_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