Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@chris-wood
Created August 4, 2016 16:36
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/c74dd061376445d4344dfa99389417ee to your computer and use it in GitHub Desktop.
Save chris-wood/c74dd061376445d4344dfa99389417ee to your computer and use it in GitHub Desktop.
minimum_distance_test_ks_example.py
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