Calculating Covariance For Stocks
What Is Covariance?Covariance is a measure of how two variables move together. It measures if the two move in the same direction (a positive covariance) or in opposite directions (a negative covariance). In this article, the variables will usually be stock prices, but it can be anything.
In the stock market, there is a strong emphasis placed on reducing the amount of risk taken on for the same amount of return. When constructing a portfolio, an analyst will select stocks that will work well together. This usually means that these stocks do not move in the same direction. Covariance can tell how the stocks move together, but to determine the strength of the relationship, we need to look at the correlation.
Calculating CovarianceThe calculation for covariance of a stock starts with finding a list of previous prices. This is labeled as "historical prices" on most quote pages. Typically, the closing price for each day is used to find the return from one day to the next. Do this for both stocks, and build a list to begin the calculations.
For example:
Day | ABC Returns (%) | XYZ Returns (%) |
1 | 1.1 | 3 |
2 | 1.7 | 4.2 |
3 | 2.1 | 4.9 |
4 | 1.4 | 4.1 |
5 | 0.2 | 2.5 |
Table 1: Daily returns for two stocks using the closing prices |
Represented by this equation:
For example:
= [0.148] + [0.184] + [0.928] + [0.036] + [1.364]
= 2.66 / (5 - 1)
= 0.665
You can see that the covariance between the two stock returns is 0.665, which means that they move in the same direction. When ABC had a high return, XYZ also had a high return.
Using Microsoft Excel
In Excel, you can easily find the covariance by using one the following functions:
= COVARIANCE.S() for a sample
or
= COVARIANCE.P() for a population
You will need to set up the two lists of returns in vertical columns, just like in Table 1. Then, when prompted, select each column. In Excel, each list is called an "array," and there should be two arrays inside the brackets, separated by a comma.
Meaning
In the example, there is a positive covariance so the two stocks tend to move together. When one has a high return, the other tends to have a high return as well. If the result was negative, then the two stocks would tend to have opposite returns; when one had a positive return, the other would have a negative return.
Uses of Covariance
Finding that two stocks have a high or low covariance might not be a useful metric on its own, but the covariance can be used to calculate the correlation. The correlation will give a measurement between -1 and 1, and adds a strength value on how the stocks move together. If the correlation is 1, they move perfectly together, and if the correlation is -1, the stocks move perfectly in opposite directions. If the correlation is 0, then the two stocks move in random directions from each other. (To know more about correlation and portfolio management.
The covariance can also be used to find the standard deviation of a multi-stock portfolio. The standard deviation is the accepted calculation for risk, and is extremely important when selecting stocks. Typically, you would want to select stocks that move in opposite directions. If the chosen stocks work well together, then the risk will be lower given the same amount or potential return.
ConclusionCovariance is a common statistical calculation which can show how two stocks tend to move together. We can only use historical returns so there will never be complete certainty about the future. Also, it should not be used on its own. Instead, it can be used in other, more important, calculations such as correlation, or standard deviation