qis.compute_model_layer_alpha_beta_attribution¶
- qis.compute_model_layer_alpha_beta_attribution(benchmark_nav, risk_layer_nav, signal_layer_nav, full_model_nav, freq='QE', full_model_net_nav=None, hac_lags=3, confidence_level=0.95)[source]¶
Compute a full-sample OLS decomposition of model-layer log returns.
Each observed layer is regressed on the benchmark. The full-model log return is then decomposed into its systematic return, risk-layer alpha, signal-layer alpha and integration alpha. The integration term captures the non-additivity of the risk and signal layers relative to the fully constrained model. The four gross contributions reconstruct the full-model log return in every observation. When
full_model_net_navis supplied, trading-cost drag is the exact log-return difference between the net and gross full models and extends the bridge to the net return.Alpha p-values and confidence intervals use Bartlett-kernel heteroskedasticity and autocorrelation-consistent standard errors with
hac_lagsBartlett lags (default three). Confidence bounds useconfidence_leveland are annualised linearly using the factor implied byfreq.- Parameters:
benchmark_nav (Series) – Benchmark NAV or price index.
risk_layer_nav (Series) – NAV produced using the risk layer without alpha signals.
signal_layer_nav (Series) – NAV of the portfolio built from the signals alone.
full_model_nav (Series) – NAV of the fully integrated model.
freq (str) – Regression and return frequency. Defaults to quarter-end.
full_model_net_nav (Series | None) – Optional NAV of the same fully integrated model after trading costs.
hac_lags (int) – Bartlett-kernel lag count for alpha HAC covariance. Defaults to three periods.
confidence_level (float) – Two-sided alpha confidence-interval level. Defaults to 0.95.
- Returns:
Alpha/beta regression statistics and exact log-return components.
- Raises:
TypeError – If the inputs do not have a DatetimeIndex.
ValueError – If HAC settings are invalid, any NAV is entirely missing, the NAVs have no common valid range, the common sample is too short, or the benchmark has no variation.
RuntimeError – If any component return is non-finite.
- Return type: