staircase.Stairs.corr

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

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

Parameters:
  • other (Stairs) – the stairs instance with which to compute the correlation
  • 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 correlation 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-corr-1.png
>>> s1.corr(s2)
0.24687803791136045
>>> s2.corr(s1)
0.24687803791136045
>>> s1.corr(s2, lower=0, upper=6)
0.27500954910846337