# Calculate correlation between two sub portfolios and the combined portfolio

I have two sub portfolios (lets call them portfolio a & portfolio b - a portfolio is just a vector of weights that sum to 1) that combine to create a total portfolio. I also have a 2 x 2 covariance matrix.

 | Variance a     Covariance ab |
| Covariance ab  Variance b    |


By taking the square root of the diagonals of this covariance matrix and I able to create a 2 x 2 correlation matrix so I can get the correlation between portfolio a and b.

What I would like to know is the correlation of portfolio a with the total portfolio (that is portfolio a and portfolio b combined) & the correlation of portfolio b with the total portfolio?

Edit

I should mention that portfolios a & b have the same investable universe. So let says our investable universe is 2000 stocks. portfolio a is a 2000 x 1 vector as is portfolio b. Row i in both vectors correspond to the same company which is linked to another matrix.

  Company             Portfolio a        portfolio b
ABC                 0                  0.25
DEF                 0.1                0.05
GHJ                 0.05               0.05
IJK                 0.12               0
...                 ...                ...
2000th Company      0.03               0.02

Total               1                  1


The 2 x 2 covariance matrix was calculated by the following,

   P' * COV * P

P is a 2000 x 2 matrix column 1 is portfolio a, 2nd column is portfolio b
COV is a 2000 x 2000 matrix of all the stock variance & covariances.


Edit In reference to user12348 post. Another Post provides alternate solution, while Marco's solution also works.

• From the answer you accepted and from your edit, it seems you only wanted to calculate covariance (or correlation) matrix between a and b, but your question wanted to know correlation between a and (a+b), and b and (a+b). It is misleading, however, what was the reason for asking for correlation between a, and b with (a+b)? May 10, 2014 at 23:07
• Hi @user13248 I can understand why you would be confused. There were quite a few comments between myself and Matt Wolf. It was suggested that we delete the comments due to the high number. However it appears we were over zealous in doing so. As one of the comments from Matt was a link to a previous answer. I will try to find this link and add it to my post. This was the reason I accepted Matt's answer. After I had accepted the question Marco provided a very detailed and clear answer. May 12, 2014 at 8:56
• That link is more general and easy to implement and should work on multiple sub portfolios. @Marco-Breitig's solution is for binary mix. I reconciled them long hand, they both match. May 13, 2014 at 7:07

You can obtain the covariance between 2 portfolios by multiplying the row vector, containing the weights of portfolio A with the variance-covariance matrix of the assets and then multiplying with the column vector, containing the weights of assets in portfolio B.

Equally you can set up a new portfolio A+B by creating a new column vector that contains the combined weights of column vectors A and B and perform same as above to obtain your covariance between A and A+B. Same follows for B and A+B.

Hope this helps.

• downvoter, care to comment? Anything wrong with my logic? May 13, 2014 at 4:57
• What you described will lead to covariance between portfolios a and b. The OP asked for correlation (covariance will do, too) between (a+b) and a or b. If (a+b) portfolio is c then the answer should show how to get covariance(a,c) or covariance(b,c). This does not answer the question. Hence, down voted. I will be happy to up vote if I am wrong. Just wanted to make sure that someone looking for a quick answer is misled. May 13, 2014 at 6:46
• Sure, and combined portfolio weight vectors can simply be set up by combining portfolio a and b weightings. Hence, you can easily derive the covariance between portfolio a and (a+b). I am a bit rusty on linear algebra so I am only 90% confident this is right, please correct and explain why if not. May 13, 2014 at 7:04
• You really need to work with variance-covariance matrix of the two portfolios and their respective weights in combined portfolio. Please see the edit to the OP. May 13, 2014 at 7:13
• I saw that edit but that link (though I was the one who initially provided it) leads one down an incorrect road because the question there is about portfolio correlations with their own assets. Using my approach you should get the correct covariance and from that correlation between two portfolios if you construct the weight vectors carefully. If you downvoted it can you explain why this approach would not work (in detail if possible as I like to learn what I got wrong). May 13, 2014 at 7:20

To clarify notation, you have an universe of $n=2000 \space$ stocks and two portfolio vectors $\mathbf{a},\mathbf{b}\in\mathbb{R}^{n}$ with $\left\|\mathbf{a}\right\|_{1}=\left\|\mathbf{b}\right\|_{1}=1$. Further, you have Estimators for the true Variance $\operatorname{Var}\left[\mathbf{a}\right]$ resp. $\operatorname{Var}\left[\mathbf{b}\right]$ and the Covariance $\operatorname{Cov}\left[\mathbf{a},\mathbf{b}\right]$.

Normally you'd multiply the portfolio weights with the random return vector $\boldsymbol{\mu}\in\mathbb{R}^{n}$ to get the portfolio returns $p_{\mathbf{a}} := \mathbf{a}^{T}\boldsymbol{\mu}$. This portfolio return now is a random variable and it makes sense to speak of its Variance etc. In slight abuse of Notation you can call the portfolio value $a$, which is now a real number. The same holds for the portfolio value $b$.

For a new portfolio $\alpha{a}+\beta{b}=:{c}\in\mathbb{R}\space$ with weights $\alpha+\beta=1$ you want to know $\operatorname{Var}\left[{c}\right]$.

For two correlated random vectors the following holds (http://en.wikipedia.org/wiki/Covariance#Properties): $$\operatorname{Var}\left[{c}\right] = \operatorname{Var}\left[\alpha{a}+\beta{b}\right] = \alpha^{2}\operatorname{Var}\left[{a}\right] + \beta^{2}\operatorname{Var}\left[{b}\right] + 2\alpha\beta\operatorname{Cov}\left[{a},{b}\right]$$

You can also see this if you write down the quadratic form of your Variance-Covariance-Matrix of portfolios ${a}, {b}$ with the corresponding weighting vector that forms portfolio ${c}$. For that, note that $${c} = \begin{pmatrix} \alpha\\\beta \end{pmatrix}^{T} \begin{pmatrix} {a} \\ {b} \end{pmatrix} = \alpha{a}+\beta{b}$$ holds. Therefore you can write $$\operatorname{Var}\left[{c}\right] = \operatorname{Var}\left[ \begin{pmatrix} \alpha\\\beta \end{pmatrix}^{T} \begin{pmatrix} {a} \\ {b} \end{pmatrix}\right] \overset{(1)}{=} \begin{pmatrix} \alpha\\\beta \end{pmatrix}^{T}\operatorname{Var}\left[ \begin{pmatrix} {a} \\ {b} \end{pmatrix}\right] \begin{pmatrix} \alpha\\\beta \end{pmatrix}$$ $$= \begin{pmatrix} \alpha\\\beta \end{pmatrix}^{T} \begin{pmatrix} \operatorname{Var}\left[{a}\right] & \operatorname{Cov}\left[{a},{b}\right] \\ \operatorname{Cov}\left[{a},{b}\right] & \operatorname{Var}\left[{b}\right] \end{pmatrix} \begin{pmatrix} \alpha\\\beta \end{pmatrix}$$ $$= \alpha^{2}\operatorname{Var}\left[{a}\right] + \beta^{2}\operatorname{Var}\left[{b}\right] + 2\alpha\beta\operatorname{Cov}\left[{a},{b}\right]\textrm{,}$$ with (1) the matrix-wise principle on how to get a constant out of the Variance, see (http://en.wikipedia.org/wiki/Covariance#A_more_general_identity_for_covariance_matrices).

You are interested in $$\operatorname{Cov}\left[{a},{c}\right] = \operatorname{Cov}\left[{a},\alpha{a}+\beta{b}\right]$$ $$\overset{(2)}{=} \alpha\operatorname{Cov}\left[a,a\right]+\beta\operatorname{Cov}\left[a,b\right] = \alpha\operatorname{Var}\left[a\right]+\beta\operatorname{Cov}\left[a,b\right] \textrm{.}$$ The equality (2) follows from the definition of Covariance and some manipulations: $$\operatorname{Cov}\left[{a},{c}\right] = \operatorname{Cov}\left[{a},\alpha{a}+\beta{b}\right]$$ $$= \mathbb{E}\left[\left(a-\mathbb{E}\left[a\right]\right)\left(\alpha{a}+\beta{b} - \mathbb{E}\left[\alpha{a}+\beta{b}\right]\right)\right]$$ $$= \mathbb{E}\left[\left(\alpha{a^{2}}-2\alpha{a}\mathbb{E}\left[a\right]+\alpha\mathbb{E}\left[a\right]^{2}\right) + \left(\beta{ab}-\beta{a\mathbb{E}\left[b\right]}-\beta{b}\mathbb{E}\left[a\right]+\beta\mathbb{E}\left[a\right]\mathbb{E}\left[b\right]\right)\right]$$ $$= \mathbb{E}\left[\alpha\left(a-\mathbb{E}\left[a\right]\right)^{2} + \beta\left(a-\mathbb{E}\left[a\right]\right)\left(b-\mathbb{E}\left[b\right]\right)\right] = \alpha\operatorname{Var}\left[{a}\right] + \beta\operatorname{Cov}\left[a,b\right]$$ You can get the Correlation from the Covariance in the obvious way, devide the Covariance by the square root of the product of the Variances of both random variables.

Hope I didn't miscalculate and that is the answer you were looking for.

• No that's a brilliant answer, very detailed and clear to follow! Cheers! May 8, 2014 at 16:21

Let there be n stocks, 2 portfolio a and b. c is a combined portfolio of portfolio a and portfolio b. $\Sigma$ is variance-covariance matrix of the n assets. Weight vectors for portfolios a and b are $$w_{pa},w_{pb}\in\mathbb{R}^{n} ,$$ $$\left\|w_{pa}\right\|_{1}=\left\|w_{pb}\right\|_{1}=1$$

then $$Var(a)= w_{pa}' \Sigma w_{pa}$$ $$Var(b)= w_{pb}' \Sigma w_{pb}$$ $$Cov(a,b)=w_{pa}' \Sigma w_{pb}$$

Let us define combined portfolio c such that its weight vector $$w_{pc}\in\mathbb{R}^{n},$$ $$\left\|w_{pc}\right\|_{1}=1$$ $$\alpha w_{pa}+\beta w_{pb}=:w_{pc}\in\mathbb{R}\space$$ with weights $\alpha+\beta=1$

Then we have in matrix form:

$$\begin{pmatrix} Cov(a,c) \\ Cov(b,c) \end{pmatrix}=\begin{pmatrix} Var(a) & Cov(a,b) \\ Cov(a,b)) & Var(b) \end{pmatrix} \begin{pmatrix} \alpha \\ \beta \end{pmatrix}$$ It can also be expressed in terms of the asset weights in the sub portfolios as: $$\begin{pmatrix} Cov(a,c) \\ Cov(b,c) \end{pmatrix}=\begin{pmatrix} \alpha w_{pa}' \Sigma w_{pa} + \beta w_{pa}' \Sigma w_{pb} \\ \beta w_{pb}' \Sigma w_{pb} + \alpha w_{pa}' \Sigma w_{pb} \end{pmatrix}$$

This reconciles the matrix calculations in solution to this question and what @MarcoBietig has posted here. Here is multivariate portfolio solution.

• Your answer would be more clear if you did relate the former relations to calculating Cov(a,c). If w_c = xw_a+yw_b, then Cov(a,c) = w_a'V w_c = xw_a'Vw_a + yw_a'Vw_b with V the Var-Cov matrix of returns. May 13, 2014 at 15:53
• Can anyone help with the derivation of Cov(a,b) from Var(a)=w′paΣwpa and Var(b)=w′pbΣwpb? I do not understand how this is derived...? Jan 30, 2018 at 3:12

Use Ledoit - Wolf estimator instead of normal cov matrix