I have been using ECDF (empirical cumulative distribution function) from statsmodels.distributions to plot a CDF of some data. However, ECDF uses a step function and as a consequence I get jagged-looking plots.
So my question is: Do scipy or statsmodels have a ECDF baked-in without a step function?
By the way, I know I can do this:
hist, bin_edges = histogram(b_oz, normed=True)
plot(np.cumsum(hist))
but I don't get the right scales.
Thanks!
If you just want to change the plot, then you could let matplotlib interpolate between the observed values.
or sort original data and plot
which is the same as plotting it directly
Note: depending on how you want the ecdf to behave at the boundaries and how it will be centered, there are different normalizations for "plotting positions" that are in common use, like the parameter
a
that I added as example a=1 is a common choice.As alternative to using the empirical cdf, you could also use an interpolated or smoothed ecdf or histogram, or a kernel density estimate.