Skip to content

Performance Attribution

Intermediate / Risk & Performance / Python / source

Brinson decomposition splits portfolio active return into allocation and selection effects — answering "did we beat the benchmark by picking the right sectors or the right stocks?"

Functions

Function Description
brinson_attribution(...) Three-factor BHB: allocation + selection + interaction
two_factor_brinson(...) Two-factor: allocation + (selection inc. interaction)
information_ratio(rp, rb) Annualized IR = active return / tracking error
tracking_error(rp, rb) Annualized std of active returns

Brinson-Hood-Beebower Decomposition

Allocation_i  = (w_p,i - w_b,i) * (r_b,i - r_b)
Selection_i   = w_b,i * (r_p,i - r_b,i)
Interaction_i = (w_p,i - w_b,i) * (r_p,i - r_b,i)

Active = sum(Allocation) + sum(Selection) + sum(Interaction)

Example

from performance_attribution import brinson_attribution, information_ratio

res = brinson_attribution(wp, rp, wb, rb)
print(res['total_allocation'], res['total_selection'])

ir = information_ratio(daily_port, daily_bench)

Practical Notes

  • Allocation > 0: overweighted sectors that beat the benchmark.
  • Selection > 0: stocks within sectors outperformed sector index.
  • Interaction is small and often combined with selection (two-factor model).
  • IR > 0.5 is good; > 1.0 is exceptional.

Running it

cd "Finance - Performance Attribution"
python "performance_attribution.py"

More in Risk & Performance

  • Finance - Calmar Ratio: The Sharpe ratio judges a strategy by how much its returns wobble around their average.
  • Finance - Information Ratio: When a portfolio is judged against a benchmark, what matters is how much it beat the benchmark by — and how reliably.
  • Finance - Jensens Alpha: Beta tells you how much of a portfolio's return came from simply riding the market.
  • Finance - Omega Ratio: The Sharpe ratio squeezes a whole return distribution into a mean and a standard deviation, which throws away everything interesting about its shape.
  • Finance - Treynor Ratio: The Sharpe ratio divides excess return by total volatility, which mixes two very different kinds of risk.
  • Risk Metrics: This module gives you quick, professional stats about risk in any list or array of investment returns.

Every module on one page or suggested reading orders.