staircase.cov

staircase.cov(collection, lower=-inf, upper=inf)

Calculates the covariance matrix for a collection of Stairs instances

Parameters:
  • collection (pandas.Series, dict, or array-like of Stairs values) – the stairs instances with which to compute the covariance matrix
  • 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 matrix

Return type:

pandas.DataFrame

Examples

>>> import staircase as sc
>>> pd.Series([s1, s2, s1+s2])
0    <staircase.Stairs, id=2452772382088, dates=False>
1    <staircase.Stairs, id=2452772381320, dates=False>
2    <staircase.Stairs, id=2452772893512, dates=False>
dtype: object
>>> sc.cov(pd.Series([s1, s2, s1+s2], index=['s1', 's2', 's1+s2']))
              s1         s2      s1+s2
s1      0.687500   0.140496   0.652893
s2      0.140496   0.471074   0.611570
s1+ s2  0.652893   0.611570   1.264463
>>> sc.cov([s1, s2, s1+s2])
          0          1          2
0  0.687500   0.140496   0.652893
1  0.140496   0.471074   0.611570
2  0.652893   0.611570   1.264463