qis.regimes.compute_regime_mixture_covar_from_sample¶
- qis.regimes.compute_regime_mixture_covar_from_sample(sampled_returns_with_regime_id, benchmark, af, betas=None, regime_column='regime')[source]¶
Annualised regime-mixture covariance of one complete classified panel.
Equation (10) of Sepp and Kastenholz (2026) in one call. The betas come from
compute_regime_betasunless a frozen sheet is supplied, andcompute_regime_mixture_covarassembles the covariance with the empirical regime frequencies and the population benchmark moments ofcompute_sample_regime_moments, all over the classified periods. The residual volatilities keep the sample convention ofcompute_regime_betas(ddof=1). Residuals are uncorrelated across assets and with the benchmark, and the fitted regime intercepts are discarded. A ragged panel is rejected: choose the common sample before classifying it.- Parameters:
sampled_returns_with_regime_id (DataFrame) – periodic simple returns with a regime column; unclassified periods are excluded and every other asset return must be finite. The regime label
total, in any case, is reserved by thebeta_totalcolumnbenchmark (str) – name of the benchmark column, inserted first with unit betas and zero residual
af (float) – annualisation factor of the periodic returns, finite and positive
betas (DataFrame | None) – optional frozen sheet in the format of
compute_regime_betas, indexed by exactly the non-benchmark assets, withbeta_<regime id in lower case>columns and a finite, non-negativeidio_volannualised with the sameaf; other columns are ignored. None estimates the betas on this panel, which needs 24 periods and two distinct benchmark returns in every regimeregime_column (str) – name of the regime column
- Returns:
the annualised covariance, the benchmark first and then the other assets in the panel’s column order. On a full sample it is descriptive; a rolling caller passes only the periods, and frozen betas, known at the decision date, and answers for the estimation dates and the annualisation of frozen betas
- Raises:
ValueError – if the panel,
af, the identification of a regression or the frozen betas are invalid- Return type: