Skip to content

Instantly share code, notes, and snippets.

@chris-wood
Created August 4, 2016 16:33
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/57d243c66e8d1a7d0159054df3df758a to your computer and use it in GitHub Desktop.
Save chris-wood/57d243c66e8d1a7d0159054df3df758a to your computer and use it in GitHub Desktop.
calc_empirical_distribution.py
def calc_empirical_distribution(Xs):
Fx = []
total = float(len(Xs))
for x in Xs:
subset = filter(lambda y : y <= x, Xs)
count = len(subset)
Fx.append((x, float(count) / total))
return Fx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment