Covariance

What Is Covariance?

Covariance measures the directional relationship between the returns on two assets. A positive covariance means that asset returns move together while a negative covariance means they move inversely.

Covariance is calculated by analyzing at-return surprises (standard deviations from the expected return) or by multiplying the correlation between the two random variables by the standard deviation of each variable.

Key Takeaways

  • Covariance is a statistical tool that is used to determine the relationship between the movements of two random variables.
  • When two stocks tend to move together, they are seen as having a positive covariance; when they move inversely, the covariance is negative.
  • Covariance is different from the correlation coefficient, a measure of the strength of a correlative relationship.
  • Covariance is a significant tool in modern portfolio theory used to ascertain what securities to put in a portfolio.
  • Risk and volatility can be reduced in a portfolio by pairing assets that have a negative covariance.
1:40

Covariance

Understanding Covariance

Covariance evaluates how the mean values of two random variables move together. If stock A's return moves higher whenever stock B's return moves higher and the same relationship is found when each stock's return decreases, then these stocks are said to have positive covariance. In finance, covariances are calculated to help diversify security holdings.

Formula for Covariance

When an analyst has a set of data, a pair of x and y values, covariance can be calculated using five variables drawn from the data being analyzed.

Covariance Formula
Covariance Formula.

Where:

  • xi = a given x value in the data set
  • xm = the mean, or average, of the x values
  • yi = the y value in the data set that corresponds with xi
  • ym = the mean, or average, of the y values

Special Considerations

Covariances have significant applications in finance and modern portfolio theory. For example, in the capital asset pricing model (CAPM), which is used to calculate the expected return of an asset, the covariance between a security and the market is used in the formula for one of the model's key variables, beta. In the CAPM, beta measures the volatility, or systematic risk, of a security in comparison to the market as a whole; it's a practical measure that draws from the covariance to gauge an investor's risk exposure specific to one security.

Meanwhile, portfolio theory uses covariances to statistically reduce the overall risk of a portfolio by protecting against volatility through covariance-informed diversification.

Possessing financial assets with returns that have similar covariances does not provide very much diversification; therefore, a diversified portfolio would likely contain a mix of financial assets that have varying covariances.

Types of Covariance

The covariance equation is used to determine the direction of the relationship between two variables–in other words, whether they tend to move in the same or opposite directions. This relationship is determined by the sign (positive or negative) of the covariance value.

Positive Covariance

A positive covariance between two variables indicates that these variables tend to be higher or lower at the same time. In other words, a positive covariance between variables x and y indicates that x is higher than average at the same times that y is higher than average, and vice versa. When charted on a two-dimensional graph, the data points will tend to slope upwards.

Negative Covariance

When the calculated covariance is less than zero, this indicates that the two variables have an inverse relationship. In other words, an x value that is lower than average tends to be paired with a y that is greater than average, and vice versa.

Covariance vs. Variance

Covariance is related to variance, a statistical measure for the spread of points in a data set. Both variance and covariance measure how data points are distributed around a calculated mean. However, variance measures the spread of data along a single axis, while covariance examines the directional relationship between two variables.

In a financial context, covariance is used to examine how different investments perform in relation to one another. A positive covariance indicates that two assets tend to perform well at the same time, while a negative covariance indicates that they tend to move in opposite directions. Most investors seek assets with a negative covariance in order to diversify their holdings.

Covariance vs. Correlation

Covariance is also distinct from correlation, another statistical metric often used to measure the relationship between two variables. While covariance measures the direction of a relationship between two variables, correlation measures the strength of that relationship. This is usually expressed through a correlation coefficient, which can range from -1 to +1.

While the covariance does measure the directional relationship between two assets, it does not show the strength of the relationship between the two assets; the coefficient of correlation is a more appropriate indicator of this strength.

A correlation is considered to be strong if the correlation coefficient has a value that is close to +1 (positive correlation) or -1 (negative correlation). A coefficient that is close to zero indicates that there is only a weak relationship between the two variables.

Example of Covariance Calculation

Assume an analyst in a company has a five-quarter data set that shows quarterly gross domestic product (GDP) growth in percentages (x) and a company's new product line growth in percentages (y). The data set may look like:

  • Q1: x = 2, y = 10
  • Q2: x = 3, y = 14
  • Q3: x = 2.7, y = 12
  • Q4: x = 3.2, y = 15
  • Q5: x = 4.1, y = 20

The average x value equals 3, and the average y value equals 14.2. To calculate the covariance, the sum of the products of the xi values minus the average x value, multiplied by the yi values minus the average y values would be divided by (n-1), as follows:

Cov(x,y) = ((2 - 3) x (10 - 14.2) + (3 - 3) x (14 - 14.2) + ... (4.1 - 3) x (20 - 14.2)) / 4 = (4.2 + 0 + 0.66 + 0.16 + 6.38) / 4 = 2.85

Having calculated a positive covariance here, the analyst can say that the growth of the company's new product line has a positive relationship with quarterly GDP growth. 

The Bottom Line

Covariance is an important statistical metric for comparing the relationships between multiple variables. In investing, covariance is used to identify assets that can help diversify a portfolio.

What Is Covariance vs. Variance?

Covariance and variance are both used to measure the distribution of points in a data set. However, variance is typically used in data sets with only one variable, and indicates how closely those data points are clustered around the average. Covariance measures the direction of the relationship between two variables. A positive covariance means that both variables tend to be high or low at the same time. A negative covariance means that when one variable is high, the other tends to be low.

What Is the Difference Between Covariance and Correlation?

Covariance measures the direction of a relationship between two variables, while correlation measures the strength of that relationship. Both correlation and covariance are positive when the variables move in the same direction, and negative when they move in opposite directions. However, a correlation coefficient must always be between -1 and +1, with the extreme values indicating a strong relationship.

How Is a Covariance Calculated?

For a set of n data points with two variables x and y, the covariance is measured by taking the difference between each x and y variable and their respective means. These differences are then multiplied together, and averaged across all of the data points. In mathematical notation, this is expressed as:

Covariance equation
How to calculate covariance.

Investopedia

What Does a Covariance of 0 Mean?

A covariance of zero indicates that there is no clear directional relationship between the variables being measured. In other words, a high x value is equally likely to be paired with a high or low value for y.

Take the Next Step to Invest
×
The offers that appear in this table are from partnerships from which Investopedia receives compensation. This compensation may impact how and where listings appear. Investopedia does not include all offers available in the marketplace.
Service
Name
Description