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/8867990e01afa35c858f603b366c11d2 to your computer and use it in GitHub Desktop.
Save chris-wood/8867990e01afa35c858f603b366c11d2 to your computer and use it in GitHub Desktop.
kolmogorov_smirnov_statistic.py
def distribution_supremum(F0, Fk):
delta = map(lambda ((x1, y1), (x2, y2)) : abs(y2 - y1), zip(F0, Fk))
support = filter(lambda x : x > 0.0, delta)
return max(support)
def kolmogorov_smirnov_statistic(F0, Fk):
'''
Compute the statistic according to:
https://onlinecourses.science.psu.edu/stat414/node/322
'''
return distribution_supremum(F0, Fk)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment