qis.compute_benchmarks_beta_attribution_from_prices

qis.compute_benchmarks_beta_attribution_from_prices(portfolio_nav, benchmark_prices, portfolio_benchmark_betas, residual_name='Alpha', time_period=None)[source]

Split each period’s portfolio return into benchmark contributions and a residual.

On the date grid of portfolio_benchmark_betas, with simple returns r_p of the NAV and r_q of each benchmark, the contribution of benchmark q at t is beta[t-1, q] * r_q[t] and the residual is r_p[t] - sum_q beta[t-1, q] * r_q[t]. The identity is exact in simple returns for whatever betas are supplied. Betas from compute_portfolio_ewm_benchmark_betas are estimated on log returns; applying them to simple returns is a second-order approximation, because a log-return and a simple-return regression slope differ by terms of the order of the squared per-period return.

Parameters:
  • portfolio_nav (Series) – Portfolio NAV; read as of each beta date.

  • benchmark_prices (DataFrame) – Benchmark prices, one column per benchmark; read as of each beta date.

  • portfolio_benchmark_betas (DataFrame) – Portfolio betas, dates by benchmarks, applied one date later.

  • residual_name (str) – Name of the residual column.

  • time_period (TimePeriod) – Optional period to which the output is restricted.

Returns:

Benchmark contributions and the residual, dates by columns. A row is NaN while any lagged beta is missing (the estimator warm-up), so the residual never absorbs the whole portfolio return.

Return type:

DataFrame