Rocke S-Estimator

The Rocke S-Estimator is a robust covariance that keeps its robustness when there are many assets, where an S-estimator with the bisquare function of the MM-Estimator grows ever more efficient and ever less robust (Rocke, 1996): the translated biweight of Rocke (1996) only counts squared distances near their typical value (Maronna, Martin, Yohai and Salibián-Barrera, 2019).

The formula for the Rocke S-Estimator starts from the width gamma of the translated biweight, with \(Q_{N} (0.995)\) the 0.995 quantile of the chi-squared distribution with N degrees of freedom:

\[\gamma = \min\left(\frac{Q_{N}(0.995)}{N} - 1, 1\right)\]

The function rho weighs the squared distance x of a period, scaled so that its median matches that of the normal distribution, by how far it lies from 1, and is 0 below 1 - gamma and 1 above 1 + gamma:

\[\rho(x) = \left(\frac{x - 1}{4 \cdot \gamma}\right) \cdot \left(3 - \left(\frac{x - 1}{\gamma}\right)^{2}\right) + \frac{1}{2} \quad \text{if } \left\lvert x - 1\right\rvert \leq \gamma\]

The scatter with the smallest scale for that function is the estimate. It suits ten or more assets; with fewer, gamma is 1 and many ordinary periods get low weights, so the MM-Estimator is the more efficient there.

Its parameters can be set, and it can be shown as a correlation matrix. The covariance matrix holds the variance of every asset and the covariance of every pair, the risk input of the mean-variance analysis of Markowitz (1952). With N assets it holds N (N + 1) / 2 numbers to estimate, and when N is not small compared to the number of periods T, the sample estimate is noisy and ill-conditioned: its smallest eigenvalues come out too small, and an optimizer that inverts it puts large weights on the combinations of assets that only look safe in the sample. The estimators differ in how they deal with this: by shrinking towards a structured target, by cleaning the eigenvalues, by weighting recent periods, by counting only large moves or by resisting outliers. Every estimate is annualized with the number of periods in a year.

Also known as: Rocke estimator, translated biweight, S-estimator.

In the Finance Toolkit this is get_covariance_estimate with method="rocke", the same function as Covariance Estimate.

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

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

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_covariance_estimate(method="rocke")

Which returns:

References

  • Paper Rocke, D. M. (1996). “Robustness Properties of S-Estimators of Multivariate Location and Shape in High Dimension.” The Annals of Statistics, 24(3), 1327-1345.
  • Paper Maronna, R. A., Martin, R. D., Yohai, V. J. and Salibián-Barrera, M. (2019). “Robust Statistics: Theory and Methods (with R).” 2nd edition, Wiley.
  • Library Shares similar logic as PortfolioAnalytics (R)’s custom.covRob.Rocke (Rocke S-Estimator)
Share