Created
August 4, 2016 16:36
-
-
Save chris-wood/c74dd061376445d4344dfa99389417ee to your computer and use it in GitHub Desktop.
minimum_distance_test_ks_example.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
def exponential_cdf(l, x): | |
return 1 - math.exp(-1 * l * x) | |
def generate_exponential_sample(Xs, l): | |
F0 = [] | |
for x in Xs: | |
F0.append((x, exponential_cdf(l, x))) | |
return F0 | |
import kolmogorov | |
# mean = \lambda^{-1} for the exponential distribution | |
F0 = generate_exponential_sample(min_distances, 0.995 ** -1) | |
Fk = kolmogorov.calc_empirical_distribution(min_distances) | |
print kolmogorov.kolmogorov_smirnov_test(F0, Fk, 0.05) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment