Skip to content

Instantly share code, notes, and snippets.

@otaviomguerra
Created July 28, 2018 03:51
Show Gist options
  • Save otaviomguerra/0344b2abc5ad30709f97e9107871306c to your computer and use it in GitHub Desktop.
Save otaviomguerra/0344b2abc5ad30709f97e9107871306c to your computer and use it in GitHub Desktop.
computes ECDF for 1D array
def ecdf(data):
"""Compute ECDF for a one-dimensional array of measurements."""
# Number of data points: n
n = len(data)
# x-data for the ECDF: x
x = np.sort(data)
# y-data for the ECDF: y
y = np.arange(1, n+1) / n
return x, y
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment