qis.compute_model_layer_ewma_alpha_attribution¶
- qis.compute_model_layer_ewma_alpha_attribution(benchmark_nav, risk_layer_nav, signal_layer_nav, full_model_nav, freq='ME', beta_span=36, beta_lag=1, beta_init_value=1.0, mean_adj_type=MeanAdjType.EWMA, *, full_model_net_nav=None)[source]¶
Estimate model-layer alpha using point-in-time, lagged EWMA betas.
QIS estimates each layer beta after observing return
tand applies it only fromt + beta_lagonward.beta_init_valueis a one-observation prior, not only a placeholder:compute_ewm_beta_alpha_forecastreplaces the first informative observation of each layer (the first jointly finite pair with a non-zero centred benchmark returnx) by the pseudo-observation(x, beta_init_value * x), which also seeds both EWMA moments. The first finite estimate therefore equals the prior, and every later estimate keeps the pseudo-observation in both moments with weightlambda^kafterkfurther periods. An ordinary observation enters with weight1 - lambda, so the prior weighs as much as(beta_span + 1) / 2ordinary observations of its date, 18.5 at the default span of 36. The applied betas also use the prior while no lagged estimate exists. With the default EWMA mean adjustment andInitType.X0, the first centred observation is zero, so the first estimated beta remains NaN for audit while applied betas remain finite. Alpha is the realised step-ahead beta-adjusted log return; the contemporaneous EWMA alpha returned by the lower-level estimator is deliberately not used.- 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) – Return frequency. Defaults to month-end.
beta_span (int) – EWMA beta span in return periods. Defaults to 36.
beta_lag (int) – Periods between beta estimation and application. Defaults to one.
beta_init_value (float) – Finite one-observation beta prior, used as the applied beta before the first lagged estimate and retained in later estimates with weight
lambda^kafterkperiods. Defaults to one.mean_adj_type (MeanAdjType) – Point-in-time beta mean adjustment. Defaults to EWMA.
INSAMPLEis rejected because it is forward-looking.full_model_net_nav (Series | None) – Optional same-weights NAV after trading costs. Adds exact log-return cost drag and net total alpha on the unchanged gross-model beta basis.
- Returns:
Rolling betas, exact realised alpha components and expanding alpha estimates.
- Raises:
TypeError – If NAV inputs do not have a DatetimeIndex or
mean_adj_typeis not an enum.ValueError – If estimator settings or the common return sample are invalid.
RuntimeError – If beta estimates contain non-leading missing values or outputs are not finite.
- Return type: