TurningPointsResult.concordance#

TurningPointsResult.concordance(other)[source]#

Harding-Pagan concordance with another chronology.

\[I = \frac{1}{T} \sum_{t=1}^{T} \bigl[ S_t S'_t + (1 - S_t)(1 - S'_t) \bigr],\]

the share of dates on which the two contraction indicators \(S\) and \(S'\) agree.

Parameters:

other (TurningPointsResult | ArrayLike) – A TurningPointsResult on the same dates, or a (T,) boolean or probability series – a Markov- switching model’s recession probabilities, say – which is thresholded at one half.

Return type:

float

Returns:

The share of dates on which the two contraction indicators agree; one half is what independent chronologies of equal frequency would produce on average.

Raises:

DimensionError – If the other chronology has a different length.

Example

>>> import numpy as np
>>> t = np.arange(120.0)
>>> y = 0.01 * t + 0.5 * np.sin(2 * np.pi * t / 24)
>>> res = TurningPoints().date(y)
>>> lagged = TurningPoints().date(np.roll(y, 3))
>>> res.concordance(lagged), res.concordance(np.where(res.contraction, 0.8, 0.2))
(0.75, 1.0)
>>> res.concordance(np.zeros(50))
Traceback (most recent call last):
    ...
cultivars.exceptions.DimensionError: chronologies must align; got lengths 120 and 50.