Covariance Ellipses

In my quest to understand correlation and covariance better, I took a short trip down the rabbit hole to visit eigen vectors and returned carrying a covariance ellipse. In my next post I will tie these concepts together when I re-visit the real-world issue of correlation and volatility. In the mean time, here is some useful background if you don't already have it.

I am going to start by looking at correlation then covariance matrices for 2 data series. Then extend the ideas to multiple data series. I want to try to provide an intuitive understanding of what the eigen values and eigen vectors of these matrices mean.

Let's start by considering a correlation matrix for two series:

\boldsymbol{\rho } = \bigl(\begin{smallmatrix}
1 & \rho \\
\rho & 1
\end{smallmatrix}\bigr)

If \inline \textbf{e}_{1} \textup{ and } \textbf{e}_{2} are 2 dimensional column vectors and \inline \lambda _{1} \textup{ and } \lambda _{2} are scalars and we define them as follows: \inline \boldsymbol{\rho} . \textbf{e}_{i} = \lambda _{i} . \textbf{e}_{i}, then \inline \lambda _{i} \textup{ and } \textbf{e}_{i} are the eigen values and eigen vectors, respectively, of the correlation matrix, \inline \boldsymbol{\rho }. Each pairing of an eigen value and an eigen vector is actually a representative of an infinite set of solutions (since for any value of k, if \inline \lambda _{i} \textup{ and } \textbf{e}_{i} is a solution, then \inline k . \lambda _{i} \textup{ and } \textbf{e}_{i} / k is also a solution). Since the eigen value has a "scale" interpretation while the eigen vector has a "direction" interpretation, it is usual to choose \inline \left | \textbf{e}_{i} \right | = 1.

We find that the eigen values are (1 + \inline \rho ) and (1 - \inline \rho ) and their respective eigen vectors are (\inline \frac{1}{\sqrt{2}} , \inline \frac{1}{\sqrt{2}} ) and (\inline \frac{-1}{\sqrt{2}} , \inline \frac{1}{\sqrt{2}} ). This makes intuitive sense since by computing the correlation (rather than covariance) matrix we have normalized the sample series to mean zero and standard deviation 1: we have calculated the covariance of the z-values.

The eigen vectors represent two alternative portfolios, the first being a 1:1 mix of the z-scores of the pairs in the data series, the second being a 1:-1 mix. If the series are positively correlated, the 1:1 portfolio will have a larger variance than the 1:-1 portfolio. In fact, it will have the largest variance of any portolio we can create from the original two series. We find in this case that the larger eigen value is associated with the eigen vector with the two positive values. So the eigen value has something to do with the portfolio with the largest possible variance. This brings us to our first "aha" moment: any correlation matrix is actually the covariance matrix of the z-values of the series, but the eigen values and vectors have no useful interpretation in the real world. By using correlation rather than covariance we have given up some useful information: the actual variances! Furthermore, we have lost useful information from the resulting eigen values.

So let's go through the same process using the covariance matrix instead ...

Consider two stationary series, \inline \textbf{x} = x_{i} \sim \textit{N}(\mu _{x}, \sigma _{x}) \textup{ and } \textbf{y} = y_{i}\sim \textit{N}(\mu _{y}, \sigma _{y}) with a correlation coefficient, \inline \rho. The covariance matrix looks like this:

\textbf{cov} = \begin{pmatrix}
\sigma{_{x}}^{2} & \rho.\sigma _{x}.\sigma _{y} \\
\rho.\sigma _{x}.\sigma _{y} & \sigma{_{y}}^{2}
\end{pmatrix}

This time, when we complete the eigen decomposition of the covariance matrix we get something more meaningful: the eigen vectors describe the maximum and minimum variance portfolios and the eigen values tell us the variance of these portfolios. It is more precise to say that the eigen vectors describe the maximum variance portfolio and the next largest variance portfolio that has zero covariance with the first portfolio, but when there are only two eigen values, this amounts to the same thing.

We can demonstrate these results by using the eigen vectors to create a portfolio of x and y for each eigen vector and examining the covariance of these portfolios. Create vectors representing the portfolio series and calculate the covariance matrix:

\textbf{p}_{1} = \textbf{e}_{1} . \begin{pmatrix}
\textbf{x}\\
\textbf{y}
\end{pmatrix} \textup{and } \textbf{p}_{2} = \textbf{e}_{2} . \begin{pmatrix}
\textbf{x}\\
\textbf{y}
\end{pmatrix} \Rightarrow \textup{COV}(\textbf{p}_{1}, \textbf{p}_{2}) = \begin{pmatrix}
\lambda_{1} & 0\\
0 & \lambda_{2}
\end{pmatrix}


i.e. the portfolios are uncorrelated (orthogonal - that's what eigen vectors do) with variances equal to the eigen values.

The icing on the cake is to use the eigen vectors and eigen values to plot an ellipse through the data. If you take the squareroot of the eigen values you have the standard deviations which have units of measure the same as the data. We can use these values (in the plot opposite I use 2 times the eigen value) as the semi-axes of an ellipse. The ellipse is centered on the means of the two series. It is rotated at an angle specified by the eigen vectors. Any point on the ellipse represents a portfolio of the two original series (given by the angle of the line from the point to the center of the ellipse). The distance from the center of the ellipse tells us the expected standard deviation of the portfolio!

Here's an example .  In this case I used my R function "CorrelatedRandomSeries" to generate 2 series with 1,000 points each. The series had means (0.1, -0.2) and standard deviations (0.02, 0.03) and correlation coefficient of 0.75.

The covariance matrix and eigen decomposition is as follows (I have rounded the numbers to make the results clear):

\textbf{cov} \textup{ = } \begin{pmatrix}
0.00040 & 0.00045\\
0.00045 & 0.00090
\end{pmatrix}

\lambda _{1} = 0.00118, \textbf{e}_{1} = \begin{pmatrix}
0.500\\
0.866
\end{pmatrix}; \lambda _{2} = 0.00013, \textbf{e}_{2} = \begin{pmatrix}
-0.866\\
0.500
\end{pmatrix}


As a check when we create a portfolio that is \inline 0.5 \textbf{x} + 0.866 \textbf{y} and another that is \inline - 0.866 \textbf{x} + 0.5 \textbf{y} and calculate the covariance matrix we get
\inline \begin{pmatrix}
0.00118 & 0\\
0 & 0.00013
\end{pmatrix}
as expected.

EDIT: I promised to extend these ideas beyond 2 series. There will be as many eigen value / vector combination as there are series. The largest eigen value will represent the maximum variance portfolio (whose make-up is specified by the eigen vector). The next largest eigen-value will be the variance of the portfolio with the largest variance that is uncorrelated to the first portfolio. And so on, until you reach the smallest eigen value which will be the minimum variance portfolio. This comes from the fact that the eigen vectors form an orthonormal basis - they are at right angles to each other, they have no covariance!

This is all part of Principal Component Analysis. My source for most of this has been Wikipedia.

EDIT 2: Corrected typo. Also, I wanted to point out that, although the ellipse axes do not look like they are in the right place, or look orthogonal, this is a result of the differences in the scales on each axis. Since \inline \textbf{e}_{1} . \textbf{e}_{2} = 0 the eigen vectors are clearly orthogonal. For the chart above, if you stretch the chart vertically until the semi-axes form a right-angle, the ellipse itself comes into perfect form as well!

EDIT 3: Strikeouts above - I am struggling to express these concepts well! The minimum / maximum covariance portfolios are minimum / maximum within the set of portfolios that have zero correlation to one another, not in an absolute sense. Any weighting (that sums to 1) of two series with a correlation coefficient less than 1 will have a variance lower than that of the series with the largest variance. So the maximum variance portfolio in the global sense has a 100% weighting of the series with the largest variance.

EDIT 4: I removed the strikeouts referred to above - I had it correct the foirst (sic) time! Rabbit hole indeed! The "eigen-portfolios", as I think of them, ARE the maximum, next maximum, etc. variance portfolios that can be created.

Edit 5: Fixed LaTeX rendering problems

0 comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Get widget