concordance#
- cultivars.spectral.cycles.concordance(first, second)[source]#
Harding-Pagan concordance of two chronologies.
\[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 two contraction indicators \(S\) and \(S'\) agree. Each argument is a
TurningPointsResultor a(T,)array: booleans are taken as the contraction indicator, and a probability series – a Markov-switching model’s smoothed recession probability – is thresholded at one half.- Parameters:
first (
TurningPointsResult|ArrayLike) – One chronology.second (
TurningPointsResult|ArrayLike) – The other, on the same dates.
- Return type:
- Returns:
The share of dates on which the two indicators agree.
- Raises:
DimensionError – If the lengths differ or an input is not a series.
NumericalError – If a probability series is non-finite.
Note
One half is the expected concordance of two independent chronologies that each spend half their time in contraction; in general it is \(p p' + (1 - p)(1 - p')\) for contraction shares \(p\) and \(p'\), so two chronologies that are mostly expansion agree by chance well above one half, and a reading should be set against that base rate rather than against one half. The threshold is strict: a probability of exactly one half reads as expansion. An integer 0/1 series is read as probabilities and works as expected; a series outside
[0, 1]is not refused and is thresholded like any other.See also
TurningPointsResult.concordance()– the same measure as a method of a chronology.MSAR– whose smoothed regime probabilities are the usual second argument.
References
Harding, D., & Pagan, A. (2002). Dissecting the cycle: A methodological investigation. Journal of Monetary Economics, 49(2), 365-381.
Harding, D., & Pagan, A. (2006). Synchronization of cycles. Journal of Econometrics, 132(1), 59-79.
Example
>>> import numpy as np >>> a = np.array([True, True, False, False, False]) >>> concordance(a, np.array([0.9, 0.6, 0.4, 0.1, 0.2])) 1.0 >>> concordance(a, ~a), concordance(a, [1, 1, 0, 0, 1]) (0.0, 0.8) >>> concordance(a, np.zeros(4)) Traceback (most recent call last): ... cultivars.exceptions.DimensionError: chronologies must align; got lengths 5 and 4.