Brinson attribution
PortfolioOptimisers.brinson_attribution — Function
brinson_attribution(X::TimeArray, w::VecNum, wb::VecNum,
asset_classes::DataFrame, col,
date0::Option{<:Dates.AbstractTime} = nothing,
date1::Option{<:Dates.AbstractTime} = nothing)Compute the Brinson performance attribution of each asset class [3].
brinson_attribution returns a DataFrame with the Brinson attribution of each asset class. It splits the total excess return of the class into asset allocation, security selection and interaction. The function reads the asset weights, the benchmark weights and the class of each asset over the date range.
date0 and date1 are positional arguments after col. Each bound applies on its own, and both are inclusive. A call that gives only date0 attributes from date0 to the last observation of X, and a call that gives only date1 attributes from the first observation of X to date1. The bounds must compare with the timestamps of X, see assert_timestamp_type. So zoned prices take zoned bounds, and a Date bound of DateTime prices is midnight of that day.
X holds prices, not returns. The period return of an asset is the ratio of its last value in the range to its first value, minus one. This ratio is a return only when the entries are prices.
The function attributes one evaluation period, between the two dates, and it reads no weight path. w and wb stay the same over that period. So the function attributes a fund whose holdings drifted in the period at its weights at the start. A multi-period attribution that follows the drift needs a rule that links the effects of the single periods into a cumulative effect. This library has no such rule, so it has no such method. Attribute each period alone, and link the results outside the library.
Both class returns divide by the weight of the class, and no guard stops a division by zero. A class with zero portfolio weight makes its $r_{i}$ a NaN. A class with zero benchmark weight makes its $r_{i}^{b}$ a NaN. The two cases spread differently, because $\mathrm{AA}_{i}$ reads only $r_{i}^{b}$. A zero portfolio weight keeps $\mathrm{AA}_{i}$ finite, and it makes the other three rows of that class a NaN. A zero benchmark weight makes all four rows a NaN.
The Total column is a row sum, so its entry of a row is a NaN when one of the class entries of the row is a NaN. The columns of the other classes stay finite, because each column reads only its own class and $r^{b}$. Do not remove the rows of the empty class from asset_classes alone. Then asset_classes and w have different lengths, and the function raises a DimensionMismatch.
Mathematical definition
\[\begin{align} r_{j} &= \dfrac{P_{j,\,1}}{P_{j,\,0}} - 1\\ r^{b} &= \sum_{j} w_{j}^{b}\, r_{j}\\ r_{i} &= \dfrac{\sum_{j \in \mathcal{C}_{i}} w_{j}\, r_{j}}{\sum_{j \in \mathcal{C}_{i}} w_{j}}\\ r_{i}^{b} &= \dfrac{\sum_{j \in \mathcal{C}_{i}} w_{j}^{b}\, r_{j}}{\sum_{j \in \mathcal{C}_{i}} w_{j}^{b}}\\ \mathrm{AA}_{i} &= \left(w_{i} - w_{i}^{b}\right) \left(r_{i}^{b} - r^{b}\right)\\ \mathrm{SS}_{i} &= w_{i}^{b} \left(r_{i} - r_{i}^{b}\right)\\ \mathrm{I}_{i} &= \left(w_{i} - w_{i}^{b}\right) \left(r_{i} - r_{i}^{b}\right)\\ \mathrm{TER}_{i} &= \mathrm{AA}_{i} + \mathrm{SS}_{i} + \mathrm{I}_{i}\,. \end{align}\]
Where:
- $\mathcal{C}_{i}$: The $i$-th asset class, the set of assets whose
colentry is that class. - $P_{j,\,0}$, $P_{j,\,1}$: Price of asset $j$ at the first and at the last observation of the range.
- $r_{j}$: Return of asset $j$ over the range.
- $w_{j}$, $w_{j}^{b}$: Portfolio and benchmark weight of asset $j$.
- $w_{i} = \sum_{j \in \mathcal{C}_{i}} w_{j}$, $w_{i}^{b} = \sum_{j \in \mathcal{C}_{i}} w_{j}^{b}$: Portfolio and benchmark weight of the class.
- $r_{i}$, $r_{i}^{b}$: Portfolio and benchmark return of the class. Each is the weighted sum of the returns of its members, divided by the weight of the class. So a class return is a weighted average and not a weighted sum.
- $r^{b}$: Benchmark return of the whole universe.
- $\mathrm{AA}_{i}$: Asset allocation of the class, the part of the excess return that comes from the weight of the class.
- $\mathrm{SS}_{i}$: Security selection of the class, the part that comes from the choice of assets in the class.
- $\mathrm{I}_{i}$: Interaction of the class, the product of the two differences.
- $\mathrm{TER}_{i}$: Total excess return of the class, the sum of the three.
Algorithm
- Filter the date range. Check the type of each bound. A bound that is
nothingbecomes the first or the last timestamp ofX.idx1is the first observation ofXat or afterdate0, throughsearchsortedfirst.idx2is the last observation at or beforedate1, throughsearchsortedlast. Throw whenidx1 > idx2, because the window then holds no observation. - Make
ret, the period return of each asset, from the values atidx1andidx2. - Take the dot product of
retandwb. This isret_b, the benchmark return of the whole universe. - Read the class of each asset from column
colofasset_classes. Buildsets_mat, the membership matrix. Its entry istruewhen the asset belongs to the class. - Take the next class. Sum the two weight vectors over its members, to get
w_iandwb_i. Divide the two weighted sums of the returns of its members by those weights, to getret_iandret_b_i. - Compute
AA_i,SS_i,I_iandTER_iof that class. Write the four numbers as the column of the class indf. - Repeat steps 5 and 6 for the other classes.
- Add the
Totalcolumn, the sum of the class columns for each row.
Arguments
X: TimeArray of asset prices.w: Vector of portfolio weights.wb: Vector of benchmark weights.asset_classes: DataFrame that gives the class of each asset.col: Column ofasset_classesthat holds the class of each asset.date0: Optional start date of the attribution period, inclusive.date1: Optional end date of the attribution period, inclusive.
Validation
date0anddate1compare with the timestamps ofX. Raises anArgumentError. Seeassert_timestamp_type.- The window holds at least one observation of
X. Raises anArgumentErrorthat names both bounds.
Returns
df::DataFrame: DataFrame with one row each for asset allocation, security selection, interaction and the total effect. It has one column for each asset class, and aTotalcolumn.
Related
VecNumperformance_summary: It summarises one realised return series. This function splits one period across the classes.calc_net_returns: It gives the net return series of a portfolio, and it charges fees. This function charges no fees.AssetSetsMatrixEstimator: It builds the group membership matrix of the library. Step 4 builds its own matrix from a DataFrame column.
References
- [3] G. P. Brinson and N. Fachler. Measuring non-US. equity portfolio performance. The Journal of Portfolio Management 11, 73–76 (1985). Pages 73-76. The original source of this formulation was not found. The formulation follows this work and is not checked against the original.
References
- [3]
- G. P. Brinson and N. Fachler. Measuring non-US. equity portfolio performance. The Journal of Portfolio Management 11, 73–76 (1985).