Many elements of mathematics and statistics are used in evaluating stocks. Covariance calculations can give an investor insight into how two stocks might move together in the future. Looking at historical prices, we can determine if the prices tend to move with each other or opposite each other. This allows you to predict the potential price movement of a two-stock portfolio.

You might even be able to select stocks that complement each other, which can reduce the overall risk and increase the overall potential return. In introductory finance courses, we are taught to calculate the portfolio's standard deviation as a measure of risk, but part of this calculation is the covariance of these two, or more, stocks. So, before going into portfolio selections, understanding covariance is very important.

What Is Covariance?
Covariance measures how two variables move together. It measures whether 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 they can be anything.

In the stock market, a strong emphasis is placed on reducing the risk amount 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.

Calculating Covariance
Calculating a stock's covariance 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

From here, we need to calculate the average return for each stock:

For ABC it would be (1.1 + 1.7 + 2.1 + 1.4 + 0.2) / 5 = 1.30

For XYZ it would be (3 + 4.2 + 4.9 + 4.1 + 2.5) / 5 = 3.74

Now, it is a matter of taking the differences between ABC's return and ABC's average return, and multiplying it by the difference between XYZ's return and XYZ's average return. The last step is to divide the result by the sample size and subtract one. If it was the entire population, you could just divide by the population size.

This can be represented by the following equation:

Using our example on ABC and XYZ above, the covariance is calculated as:

= [(1.1 - 1.30) x (3 - 3.74)] + [(1.7 - 1.30) x (4.2 - 3.74)] + [(2.1 - 1.30) x (4.9 - 3.74)] + …
= [0.148] + [0.184] + [0.928] + [0.036] + [1.364]
= 2.66 / (5 - 1)
= 0.665

In this situation we are using a sample, so we divide by the sample size (five) minus one.

You can see that the covariance between the two stock returns is 0.665. Because this number is positive, it means the stocks 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
= 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 two arrays ishould be nside the brackets, separated by a comma.

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. Covariance can tell how the stocks move together, but to determine the strength of the relationship, we need to look at the correlation. The correlation should therefore be used in conjunction with the covariance, and is represented by this equation:

A correlation between two variables is the covariance between each divided by the product of each variables standard deviation

where cov (X,Y) = covariance between X and Y

σX = standard deviation of X

σY = standard deviation of Y

The equation above reveals that the correlation between two variables is simply the covariance between both variables divided by the product of the standard deviation of the variables X and Y. While both measures reveal whether two variables are positively or inversely related, the correlation provides additional information by telling you the degree to which both variables move together. The correlation will always have a measurement value 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. In short, the covariance just tells you that two variables change the same way, while correlation reveals how a change in one variable effects a change in the other.

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 this is extremely important when selecting stocks. Typically, you would want to select stocks that move in opposite directions. If the chosen stocks move in opposite directions, then the risk might be lower given the same amount or potential return.

The Bottom Line
Covariance is a common statistical calculation that 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, covariance should not be used on its own. Instead, it can be used in other, more important, calculations such as correlation or standard deviation.

Related Articles
  1. Investing

    Measure Your Portfolio's Performance

    Learn three ratios that will help you evaluate your investment returns.
  2. Investing Basics

    Introduction To Investment Diversification

    Reducing risk and increasing returns in your portfolio is all about finding the right balance.
  3. Personal Finance

    Could Higher Correlations Wreck Your Diversification Strategy?

    Rising asset correlations could make your portfolio riskier than you think.
  4. Forex Education

    How To Trade Currency And Commodity Correlations

    Relationships between currencies and commodities exist throughout the financial markets. Find out how to trade these trends.
  5. Forex Education

    A Simplified Approach To Calculating Volatility

    Though most investors use standard deviation to determine volatility, there's an easier and more accurate way of doing it.
  6. Mutual Funds & ETFs

    Top 3 Muni California Mutual Funds

    Discover analyses of the top three California municipal bond mutual funds, and learn about their characteristics, historical performance and suitability.
  7. Investing Basics

    What Does In Specie Mean?

    In specie describes the distribution of an asset in its physical form instead of cash.
  8. Economics

    Calculating Cross Elasticity of Demand

    Cross elasticity of demand measures the quantity demanded of one good in response to a change in price of another.
  9. Professionals

    How to Sell Mutual Funds to Your Clients

    Learn about the various talking points you should cover when discussing mutual funds with clients and how explaining their benefits can help you close the sale.
  10. Professionals

    Fund and ETF Strategies for Volatile Markets

    Looking for short-term fixes in reaction to market volatility? Here are a few strategies — and their downsides.
  1. What licenses does a hedge fund manager need to have?

    A hedge fund manager does not necessarily need any specific license to operate a fund, but depending on the type of investments ... Read Full Answer >>
  2. Can mutual funds invest in hedge funds?

    Mutual funds are legally allowed to invest in hedge funds. However, hedge funds and mutual funds have striking differences ... Read Full Answer >>
  3. When are mutual funds considered a bad investment?

    Mutual funds are considered a bad investment when investors consider certain negative factors to be important, such as high ... Read Full Answer >>
  4. What fees do financial advisors charge?

    Financial advisors who operate as fee-only planners charge a percentage, usually 1 to 2%, of a client's net assets. For a ... Read Full Answer >>
  5. Is Colombia an emerging market economy?

    Colombia meets the criteria of an emerging market economy. The South American country has a much lower gross domestic product, ... Read Full Answer >>
  6. What assumptions are made when conducting a t-test?

    The common assumptions made when doing a t-test include those regarding the scale of measurement, random sampling, normality ... Read Full Answer >>

You May Also Like

Hot Definitions
  1. Capitalization Rate

    The rate of return on a real estate investment property based on the income that the property is expected to generate.
  2. Gross Profit

    A company's total revenue (equivalent to total sales) minus the cost of goods sold. Gross profit is the profit a company ...
  3. Revenue

    The amount of money that a company actually receives during a specific period, including discounts and deductions for returned ...
  4. Normal Profit

    An economic condition occurring when the difference between a firm’s total revenue and total cost is equal to zero.
  5. Operating Cost

    Expenses associated with the maintenance and administration of a business on a day-to-day basis.
  6. Cost Of Funds

    The interest rate paid by financial institutions for the funds that they deploy in their business. The cost of funds is one ...
Trading Center
You are using adblocking software

Want access to all of Investopedia? Add us to your “whitelist”
so you'll never miss a feature!