Cumulative distributions
This example shows how to plot the empirical cumulative distribution function (ECDF) of a sample. We also show the theoretical CDF.
In engineering, ECDFs are sometimes called "non-exceedance" curves: the y-value for a given x-value gives probability that an observation from the sample is below that x-value. For example, the value of 220 on the x-axis corresponds to about 0.80 on the y-axis, so there is an 80% chance that an observation in the sample does not exceed 220. Conversely, the empirical complementary cumulative distribution function (the ECCDF, or "exceedance" curve) shows the probability y that an observation from the sample is above a value x.
A direct method to plot ECDFs is Axes.ecdf. Passing complementary=True
results in an ECCDF instead.
Alternatively, one can use ax.hist(data, density=True, cumulative=True) to
first bin the data, as if plotting a histogram, and then compute and plot the
cumulative sums of the frequencies of entries in each bin. Here, to plot the
ECCDF, pass cumulative=-1. Note that this approach results in an
approximation of the E(C)CDF, whereas is exact.
