2
$\begingroup$

What I want to do is the following:

Let's say I have two assets 1 and 2, and have a 2x2 covariance matrix.

Then I have two portfolios A and B made of weights from assets 1 and 2.

What I would like to do is create a 4x4 covariance matrix of assets 1 and 2 and portfolios A and B.

I know how to calculate the covariance of the portfolios to the assets, I'm interested if there's a 'shortcut' to creating the 4x4 matrix using matrix algebra vs. building it from parts.

$\endgroup$

1 Answer 1

9
$\begingroup$

If your two assets are denoted by random variables $X_1$, $X_2$, with 2x2 covariance matrix $\mathbf{Q}$ and the portfolios:

$$ Z_1 = w_{11} X_1 + w_{12} X_2 $$ $$ Z_2 = w_{21} X_1 + w_{22} X_2 $$

Then,

$Cov(Z_1, X_1) = w_{11}Cov(X_1,X_1) + w_{12} Cov(X_2, X_1)$ , etc.

In matrix algebra:

$$ \mathbf{Z} = \mathbf{W} \mathbf{X}$$

The 4x4 covariance matrix, is:

$$ \begin{bmatrix} \mathbf{Q} & \mathbf{QW^T} \\ \mathbf{WQ} & \mathbf{WQW^T} \\ \end{bmatrix} $$

Where W is the identity matrix you can verify this reduces to your intuition.

$\endgroup$
2
  • $\begingroup$ Appreciate it! How would you go about building the last part in code? In R for example $\endgroup$ Feb 2, 2021 at 21:52
  • 2
    $\begingroup$ in pythons numpy you would just create the Q and W matrices, then uses a matrix multiplication method and then use a block method to piece them together. Look at numpy.array, numpy.matmul, and numpy.block $\endgroup$
    – Attack68
    Feb 2, 2021 at 21:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.