Skip to content
All library documents

Using PCA to Attribute Yield Curve Changes and Bond P&L

Article Quant Q&A · Author: One Pablo

Summary

The document explains how principal component analysis can break observed yield curve changes into contributions from a small set of curve factors. It constructs principal component time series from yield changes and the eigenvectors of their covariance matrix. For a selected date, multiplying the retained component scores by the corresponding eigenvector loadings reconstructs each tenor’s change and shows its component-wise contributions. The question reports that the first three components account for 98% of the variation in the yield changes.

For bond P&L attribution, the answer links rate changes to value changes through the bond’s sensitivities to curve tenors. Applying those sensitivities to the reconstructed rate moves gives an approximate P&L contribution for each component. The method is approximate: it linearizes the bond’s valuation response and discards components beyond the chosen cutoff. The document also distinguishes attributing yield changes themselves from attributing the resulting change in a bond’s present value; the latter requires the bond’s sensitivities and does not follow from the PCA decomposition alone.

Key ideas

  • PCA represents yield curve changes as component scores combined with tenor loadings.
  • Retaining leading components gives an approximate reconstruction of observed curve moves.
  • Component contributions for a specific tenor come from multiplying its loadings by the date’s component scores.
  • Bond P&L attribution also requires sensitivity of present value to each curve tenor.
  • P&L attribution is approximate because it linearizes valuation and may omit higher components.

Tags

Full text
# Principal Component Analysis for attributing yield curve changes


# Principal Component Analysis for attributing yield curve changes












I have calculated the Principal components using daily yield curve changes. After calculating these components, i noticed that 98% of the return can be attributed to the first 3 components.

How do i use these components to then say, if a bond with a specific maturity has returned +0.80%, i want to break that return by saying, e.g. 0.60% of the return comes from PC1, then 0.17% comes from PC2, etc. This is the step i am not getting. Below is an example of the desired output. Calculate the yield return, then show a pca decomposition of the return.

## Answer by Kermittfrog (score 3, accepted)

https://quant.stackexchange.com/a/69533

I added an update to answer your updated question below.

The PCA pertains to the attribution of changes (i.e. returns) of your valuation factors (e.g. zero rates across tenors) to latent "principal components", either thru eigendecomposition or thru SVD decomposition. Let $X$ denote the $T\times k$ matrix of observed zero rates shifts across the $k$ tenors of your curve, then

$$ Cov(X)=\frac{1}{T}X'X=E\Lambda E^T \quad \mathrm{(eigen\ decomposition)} $$ with $T \times k$ prinicipal component matrix $P=XE$ (columnwise: time series per principal component) and the approximation $$ X^*=P^* (E^*)^T $$ (where we have only kept the first $l\leq k$ components in $P^*,E^*$) as the approximation to $X$. As $X$ (already) represents a matrix of returns, we can now 'explain' any observation date using the first couple of components. But before that, we need to connect the change in present value to the change in zero rates.To this end, let's model the present value of a simple coupon-bearing bond as:

$$ PV = c\sum_i^n e^{-r(t_i)t_i}+e^{-r(t_n)t_n} $$ Note that the zero rate curve $r(t_i)$ is some interpolation function of the $k$ available interest rate tenors.

Disregarding the effect of the passage of calendar time (theta / decay), a first order approximation to the PnL of your instrument is

$$ dPV\approx\sum_{j=1}^k\frac{\partial PV}{\partial r_j}dr_j=\Delta^Tdr $$ From above, the vector of rates changes, $dr$, is a row in $X$, and hence, given one observation of the prinicipal components $p:(1\times k)$:$dr=Ep^T$, or as an approximation, $dr\approx E^*(p^*)^T$. And finally

$$ dPV\approx\Delta^Tdr\approx\Delta^TE^*(p^*)^T $$

where we have two sources of approximation: The linearization of the PnL and the cutoff of higher-order principal components.

Does that help?

### Update

I think you are not asking for the change in value of a bond, but of the values in $X$ above.

In a nutshell, we can re-use the above. Given a time series of yield changes $X$:

- Estimate your eigen decomposition and store the $k\times k$ eigen vector matrix $E$, with components of $E$ ordered by magnutide of the corresponding eigen value in $\Lambda$ (I think any software library will do this automagically)

- Calculate $P$, the collection of principal component time series, as above

- Keep only the first relevant columns of $P$ (say four), and call this matrix $P^*$

- Say your target is to explain the first entry in $X$, call it $x_1$. Then, $x_1\approx (P^*)_{1}(E^*)^T$, where $E^*$ contains only the first (say four) relevant eigen vectors, and $(P^*)_{i}$ is the $i$th row of $P^*$. I.e. you multiply the (first) principal components by the corresponding elements of the eigen vector; the result is the set of contributions to your PCA decomposition.

Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.