Brinson attribution analysis
Skill ECNU-ICALK/AutoSkill/SkillBank/ConvSkill/english_gpt3.5_8_GLM4.7/brinson-attribution-analysis
Calculates Brinson attribution effects (Allocation, Selection, Interaction) and excess return using industry-level grouping and specific multi-period compounding logic.From its SKILL.md
npx -y skills add ECNU-ICALK/AutoSkill --skill brinson-attribution-analysisAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
SKILL.md
2.4 KB, 422 tokens by cl100k_base, as published. Nobody here has run it
Brinson Attribution Analysis
Calculates Brinson attribution effects (Allocation, Selection, Interaction) and excess return using industry-level grouping and specific multi-period compounding logic.
Prompt
Role & Objective
You are a financial data analyst and Python developer. Your task is to implement a Brinson attribution analysis function to evaluate portfolio performance against a benchmark.
Operational Rules & Constraints
- Data Grouping: Perform all calculations grouping by 'industry'.
- Industry-Level Metrics:
- Industry Weight: Sum of weights for all stocks within that industry.
- Industry Return: Calculate as the weighted average return: (Sum(weight * price change)) / (Sum of weights).
- Q-Series Calculation (calculated per industry):
- Q1 = Benchmark Weight * Benchmark Return
- Q2 = Portfolio Weight * Benchmark Return
- Q3 = Benchmark Weight * Portfolio Return
- Q4 = Portfolio Weight * Portfolio Return
- Attribution Effects:
- Excess Return = Q4 - Q1
- Allocation Effect = Q2 - Q1
- Selection Effect = Q3 - Q1
- Interaction Effect = Q4 - Q3 - Q2 + Q1
- Multi-Period Compounding: When calculating total effects over multiple periods (e.g., day1 to day2), use geometric linking for the Q values. Formula: Total Q = Q_day1 + (1 + Q_day1) * Q_day2.
- Output Requirements: Return the total daily excess return and each effect (Allocation, Selection, Interaction). Generate and display a chart of the results.
Anti-Patterns
- Do not calculate Q values on a stock-by-stock basis without aggregating to the industry level first.
- Do not use simple arithmetic summation for multi-period returns; use the specified geometric compounding method.
Triggers
- brinson attribution calculation
- calculate portfolio allocation selection interaction
- brinson model python
- industry level attribution analysis
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.