staircase.Stairs.cov

Stairs.cov(other, lower=-inf, upper=inf)

Calculates the covariance between two step functions described by self and other.

Parameters:
  • other (Stairs) – the stairs instance with which to compute the covariance
  • lower (int, float or pandas.Timestamp) – lower bound of the interval on which to perform the calculation
  • upper (int, float or pandas.Timestamp) – upper bound of the interval on which to perform the calculation
Returns:

The covariance between self and other

Return type:

float

Examples

>>> fig, axes = plt.subplots(nrows=1, ncols=2, figsize=(12,5), sharey=True, sharex=True)
>>> for ax, title, stair_instance in zip(axes, ("s1", "s2"), (s1, s2)):
...     stair_instance.plot(ax, label=title)
...     ax.set_title(title)
../_images/staircase-Stairs-cov-1.png
>>> s1.cov(s2)
0.1404958677685951
>>> s2.cov(s1)
0.1404958677685951
>>> s1.cov(s2, lower=0, upper=6)
0.125