quantlab.portfolio.predefined.approximate.covariance#

The approximate backtest’s batched covariance estimates: every decision bar’s at once, in low-rank form.

quantlab.portfolio.approximate.estimate_all chooses one of these by the rule’s covariance estimator’s exact class and passes it the estimator’s config; each returns a LowRankCovariance: bar k’s covariance B F B' + diag(D) over the symbols it covers, the [symbols, symbols] matrix never built.

  • ledoit_wolf (LedoitWolfEstimator): the per-bar estimator’s coverage rule on each bar’s return window and staleness (DecisionPanel.return_windows, staleness) and sklearn.covariance.ledoit_wolf’s shrinkage computed for all bars at once, in Woodbury form (a I + U U', the per-bar estimator’s own shrunk_low_rank).

  • factor_risk (FactorRiskStoreEstimator): the factor risk model’s exposure_matrix of every bar’s exposures (one call), the estimate rows’ factor covariance and specific risks, with a coverage rule simpler than FactorRiskModel.forecast’s.

Functions

factor_risk

Every bar's factor risk forecast, B F B' + diag(D) per bar, with array operations over all bars.

ledoit_wolf

Every bar's Ledoit-Wolf estimate, as LedoitWolfEstimator.estimate gives it on the bar's context.