qis.regimes.compute_regime_ewm_betas¶
- qis.regimes.compute_regime_ewm_betas(sampled_returns_with_regime_id, benchmark, span=40.0, regime_column='regime')[source]¶
EWMA-weighted per-regime betas on the benchmark and the calendar-time residual variances.
Within each regime the betas use the regime-time EWMA covariance of the demeaned pair, seeded at the sample covariance, and an intercept at the EWMA means, which is discarded. The idiosyncratic variance is the calendar-time EWMA of the squared pooled residuals.
- Parameters:
- Returns:
the betas, assets in rows and regimes in columns in bucket order, and the per-period residual variance of each asset, to be annualised by the caller
- Return type: