/ factorpad.com / fin / glossary / covariance-matrix.html
An ad-free and cookie-free website.
Intermediate
Covariance Matrix is a convenient structure for storing variance and covariance figures for securities and factors. Covariance represents the co-movements between securities and can be generated using a single-variable linear regression. Alternatively, in a multi-variable regression it is common to use factors to measure co-movements. The matrix is used for the evaluation and analysis of risk and for portfolio construction.
Synonym: variance-covariance matrix
For context, think of the covariance matrix sitting in the background behind portfolio risk analysis software that aids in mean variance optimization and risk measurement. When constructed on an asset-by-asset basis it is a square matrix with the dimensions of the number of securities squared. So for a 30 stock portfolio its dimensions are 30-by-30, so 900 total covariance calculations. When constructed using fundamental factors like size, style and momentum, the number of dimensions shrinks materially.
Doc: Because variance-covariance is redundant
let's use covariance matrix from here forward.
Tom: So it's like calling it tuna insted of
ahi tuna?
This video can be accessed in a new window or App , at the YouTube Channel or from below.
Covariance matrix definition for investment modeling (4:29)
The script includes two sections where we visualize and demonstrate the calculation of the covariance matrix.
We're sitting here in Excel, and this is a snippet from our boot camp course.
This is one depiction of the covariance matrix, generated using the monthly returns for four stocks located on the Returns tab.
In this state, the covariance matrix isn't very interpretable to the naked eye, and useful for analysis, but that's not what it is for. It sits behind software for portfolio analysis and optimization.
If you'd like to brush up on the calculation of covariance, there will be a link to the video at the end.
A correlation matrix, like this, is interpretable because the scale of correlation ranges from -1 to +1. It is created from the covariance matrix. The creation of the covariance matrix helps, so let's head there now.
We will create a covariance matrix for four stocks.
So third-party risk model providers use linear algebra in statistical programming languages to generate the covariance matrix at scale for thousands of securities, but here we'll calculate one manually in Excel.
There are three types of covariance matrices: historical, single-index and multi-factor. We are using the easiest one here called historical.
The matrix structure is actually borrowed form linear algebra and is used for matrix multiplication, which we cover in the boot camp.
Set up a table like this with matching rows and column labels for holding the co-movements between each stock. And if you notice, down the diagonal in blue, is the calculation for covariance of a stock versus itself, which mathematically is variance, and that's where the name name variance-covariance matrix comes from, but it is more clear to call it a covariance matrix.
In the first cell, use the sample covariance using the
=COVARIANCE.S
function, then open
parenthesis, select the first array, comma, second array, closed
parenthesis and Enter. That's the variance of Microsoft.
Next, in the next row, we do the same thing but use the returns on Microsoft, then eBay and come up with a covariance of 0.0016 for the pair of stocks. See how it matches with this cell, logically.
Click box for answer.
False, 6 unique cells total, 3 variances and 3 covariance pairs
True
Still unclear on the covariance matrix? Leave a question in the comments section on YouTube or check out the Quant 101 series, specifically the tutorial Create a Covariance Matrix.
Our trained humans found other terms in the category risk forecasting you may find helpful.
Keep the learning going. Subscribe, link and follow so you don't miss out.
/ factorpad.com / fin / glossary / covariance-matrix.html
A newly-updated free resource. Connect and refer a friend today.