Gerber Statistic

The Gerber Statistic counts only the periods in which returns move beyond a threshold, as concordant when both move in the same direction and discordant when they move in opposite ones (Gerber, Markowitz, Ernst, Miao, Javid and Sargen, 2022). Small moves, which are mostly noise, do not count, and neither does the size of large ones.

The formula for the Gerber Statistic starts from the indicators \(U_{t , i}\) of an up move, a return of at least c times the standard deviation \(s_{i}\) of asset i (ddof=1), and \(D_{t , i}\) of a down move, at most -c times it, with c the threshold, and counts per pair the concordant moves \(n_{c}\), the discordant moves \(n_{d}\) and the periods \(n_{n}\) in which neither moved:

\[n_{c} = \sum_{t=1}^{T} (U_{t,i} \cdot U_{t,j} + D_{t,i} \cdot D_{t,j})\] \[n_{d} = \sum_{t=1}^{T} (U_{t,i} \cdot D_{t,j} + D_{t,i} \cdot U_{t,j})\] \[n_{n} = \sum_{t=1}^{T} (1 - U_{t,i} - D_{t,i}) \cdot (1 - U_{t,j} - D_{t,j})\]

The statistic \(g_{i , j}\) takes the concordant minus the discordant moves over the periods in which at least one of the two moved (the default statistic), over those in which both moved (the original statistic), or, with \(H_{i , j} = n_{c} - n_{d}\), over the square root of its diagonal (the matrix form); the distance \(d_{i , j}\) is the correlation distance:

\[g_{i,j} = \frac{n_{c} - n_{d}}{T - n_{n}}\] \[g_{i,j} = \frac{n_{c} - n_{d}}{n_{c} + n_{d}}\] \[g_{i,j} = \frac{H_{i,j}}{\sqrt{H_{i,i} \cdot H_{j,j}}}\] \[d_{i,j} = \sqrt{\frac{1 - g_{i,j}}{2}}\]

A high statistic means the assets make their large moves together; it is robust to outliers and ignores the noise of quiet periods.

It is the codependence that the hierarchical optimizers (HRP, HERC, NCO) and get_asset_clusters take, or the distance they cluster on. Hierarchical portfolio construction groups the assets by how much they move together and spreads the capital across the groups, so the codependence decides which assets end up together. The Pearson correlation captures only linear co-movement on average; the other codependences capture co-movement in ranks, in large moves only, in any form of dependence or in crashes. Each comes with a distance, zero for assets that move as one, that the clustering works on (Mantegna, 1999).

Also known as: Gerber correlation, Gerber co-movement.

In the Finance Toolkit this is get_codependence_matrix with method="gerber", the same function as Codependence Matrix.

Example · AAPL, MSFT, JNJ, XOM · 2021 to 2025

Install the Finance Toolkit with pip install financetoolkit -U, then call get_codependence_matrix:

from financetoolkit import Toolkit

toolkit = Toolkit(
    ["AAPL", "MSFT", "JNJ", "XOM"],
    api_key="FINANCIAL_MODELING_PREP_KEY",
    start_date="2021-01-01",
    end_date="2025-12-31",
)

toolkit.portfolio.get_codependence_matrix(method="gerber")

Which returns:

References

  • Paper Gerber, S., Markowitz, H. M., Ernst, P. A., Miao, Y., Javid, B. and Sargen, P. (2022). “The Gerber Statistic: A Robust Co-Movement Measure for Portfolio Optimization.” The Journal of Portfolio Management, 48(3), 87-102.
Share