staircase.Stairs.ecdf_stairs

Stairs.ecdf_stairs(lower=-inf, upper=inf)

Calculates an empirical cumulative distribution function for the corresponding step function values (and returns the result as a Stairs instance)

Parameters:
  • lower (int, float or pandas.Timestamp, optional) – lower bound of the step-function domain on which to perform the calculation
  • upper (int, float or pandas.Timestamp, optional) – upper bound of the step-function domain to perform the calculation
Returns:

An instance representing an empirical cumulative distribution function for the step function values

Return type:

Stairs

Examples

>>> s2.plot()
../_images/staircase-Stairs-ecdf_stairs-1.png
>>> ecdf = s2.ecdf_stairs(1,5)
>>> ecdf.plot()
>>> plt.show()
../_images/staircase-Stairs-ecdf_stairs-2_00_00.png
>>> print(f'{ecdf(0):.2%} of values, for s2 between 1 and 5, are less than or equal to 0')
75.00% of values, for s2 between 1 and 5, are less than or equal to 0
>>> print(f'{ecdf(0, how="left"):.2%} of values, for s2 between 1 and 5, are strictly less than 0')
50.00% of values, for s2 between 1 and 5, are strictly less than 0
>>> print(f'{ecdf(0.2) - ecdf(-1):.2%} of values, for s2 between 1 and 5, are in (-1, 0.2]')
25.00% of values, for s2 between 1 and 5, are in (-1, 0.2]
>>> print(f'{ecdf(0.2, how="left") - ecdf(-1, how="left"):.2%} of values, for s2 between 1 and 5, are in [-1, 0.2)')
75.00% of values, for s2 between 1 and 5, are in [-1, 0.2)