qis.regimes.compute_regime_betas¶
- qis.regimes.compute_regime_betas(sampled_returns_with_regime_id, benchmark, af, min_periods=24, regime_column='regime')[source]¶
Per-regime OLS betas of every asset on the benchmark, with the intercepts discarded.
Each asset uses the periods where it and the benchmark both have a return; the regimes are those of the sampled frame, set on the whole benchmark sample.
- Parameters:
sampled_returns_with_regime_id (DataFrame) – periodic returns with a regime column
benchmark (str) – name of the benchmark column
af (float) – annualisation factor of the periodic returns, for the idiosyncratic volatility
min_periods (int) – fewest common periods an asset needs
regime_column (str) – name of the regime column
- Returns:
one row per asset other than the benchmark and, per regime id in bucket order,
beta_<id>andn_<id>, thenbeta_totalandidio_vol, the annualised standard deviation of the pooled piecewise residuals- Raises:
ValueError – if an asset has fewer than
min_periodscommon periods- Return type: