I recalled David Huard posted the below,

which apparently was once in the sandbox...

hth,

Alan Isaac

def empiricalcdf(data, method='Hazen'):

"""Return the empirical cdf.

Methods available (here i goes from 1 to N)

Hazen: (i-0.5)/N

Weibull: i/(N+1)

Chegodayev: (i-.3)/(N+.4)

Cunnane: (i-.4)/(N+.2)

Gringorten: (i-.44)/(N+.12)

California: (i-1)/N

:see:

http://svn.scipy.org/svn/scipy/trunk/scipy/sandbox/dhuard/stats.py

:author: David Huard

"""

i = np.argsort(np.argsort(data)) + 1.

nobs = len(data)

method = method.lower()

if method == 'hazen':

cdf = (i-0.5)/nobs

elif method == 'weibull':

cdf = i/(nobs+1.)

elif method == 'california':

cdf = (i-1.)/nobs

elif method == 'chegodayev':

cdf = (i-.3)/(nobs+.4)

elif method == 'cunnane':

cdf = (i-.4)/(nobs+.2)

elif method == 'gringorten':

cdf = (i-.44)/(nobs+.12)

else:

raise 'Unknown method. Choose among Weibull, Hazen, Chegodayev,

Cunnane, Gringorten and California.'

return cdf

## ···

On 7/9/2010 12:02 AM, per freem wrote:

How can I plot the empirical CDF of an array of numbers in matplotlib

in Python?