Covariance | Brilliant Math & Science Wiki (2024)

The covariance generalizes the concept of variance to multiple random variables. Instead of measuring the fluctuation of a single random variable, the covariance measures the fluctuation of two variables with each other.

Contents

  • Definition
  • Calculation of the Covariance
  • Covariance - Properties
  • Covariance Matrix
  • References

Definition

Recall that the variance is the mean squared deviation from the mean for a single random variable \( X \):\[ \text{Var}(X) = E[\left(X - E[X]\right)^2]. \]The covariance adopts an analogous functional form.

The covariance \( \text{Cov}(X, Y) \) of random variables \( X \) and \( Y \) is defined as\[ \text{Cov}(X, Y) = E\left[(X - E[X])(Y - E[Y])\right]. \]

Now, instead of measuring the fluctuation of a single variable, the covariance measures how two variables fluctuate together. For the covariance to be large, both \( X - E[X] \) and \( Y - E[Y] \) must be large at the same time or, in other words, change together.

Calculation of the Covariance

It is generally simpler to find the covariance by taking\[ \begin{align} \text{Cov}(X, Y) &= E[XY - E[X] Y - X E[Y] + E[X] E[Y]] \\&= \boxed{E[XY] - E[X] E[Y].}\end{align} \]In other words, to compute the covariance, one can equivalently find \( E[XY] \) (in addition to the means of \( X \) and \( Y \)).

Let \( X \) and \( Y \) be random variables such that

  • \( P(X = 0, Y = -1) = 1/5 \)
  • \( P(X = 0, Y = 1) = 1/5 \)
  • \( P(X = 1, Y = -1) = 1/2 \)
  • \( P(X = 1, Y = 1) = 1/10 \).

Find \( \text{Cov}(X, Y) \).

Similarly, one can find an expression in terms of variances:\[ \begin{align} \text{Var}(X + Y) &= E\left[(X + Y - E[X] - E[Y])^2\right] \\&= E[\left(X - E[X]\right)^2] + E[\left(Y - E[Y]\right)^2] + 2 E\left[(X - E[X])(Y - E[Y])\right] \\&= \boxed{\text{Var}(X) + \text{Var}(Y) + 2 \text{Cov}(X, Y).}\end{align} \]

A generalized statement of this result is as follows.

Variance of a sum. Given random variables \( X_i \), each with finite variance,

\[ \text{Var}\left( \sum_i X_i \right) = \sum_i \ \text{Var}(X_i) + 2 \sum_{i<j} \text{Cov}(X_i, X_j). \]

Covariance - Properties

The covariance inherits many of the same properties as the inner product from linear algebra. The proof involves straightforward algebra and is left as an exercise for the reader.

Given a constant \( a \) and random variables \( X \), \( Y \), and \( Z \), the following properties hold:

  • \( \text{Cov}(X, X) = \text{Var}(X) \geq 0 \)
  • \( \text{Cov}(X, Y) = \text{Cov}(Y, X) \)
  • \( \text{Cov}(aX, Y) = a \text{Cov}(X, Y) \)
  • \( \text{Cov}(X, a) = 0 \)
  • \( \text{Cov}(X + Y, Z) = \text{Cov}(X, Z) + \text{Cov}(Y, Z) \).

I, II, III, and IV I, III, and IV only I only I and II only I, II, and IV only

Given knowledge of \( \text{Cov}(W, Y) \), \( \text{Cov}(W, Z) \), \( \text{Cov}(X, Y) \), and \( \text{Cov}(X, Z) \), which of the following can necessarily be computed?

I. \( \text{Cov}(W + X, Y + Z) \)

II. \( \text{Cov}(Y + Z, W + X) \)

III. \( \text{Cov}(W, X + Y + Z) \)

IV. \( \text{Cov}(W, X + Y + Z) \), if it known that \( W \) and \( X \) are independent

Let \( X \) and \( Y \) be random variables such that \( \text{Var}(X) = \sigma^2 \) and \( Y = aX \), where \( \sigma \) and \( a \) are constants. Determine \( \text{Cov}(X, Y) \).

The inner product properties yield

\[ \text{Cov}(X, Y) = \text{Cov}(X, aX) = \text{Cov}(aX, X) = a\text{Cov}(X, X) = a \sigma^2. \]

if \( X \) is a standard normal random variable and \( Y = 3X \), what is \( \text{Cov}(X, Y) \)?

As a result, the Cauchy-Schwarz inequality holds for covariances.

Cauchy-Schwarz inequality. Given random variables \( X \) and \( Y \),

\[ \left[ \text{Cov}(X ,Y) \right]^2 \leq \text{Var}(X) \text{Var}(Y). \]

One of the key properties of the covariance is the fact that independent random variables have zero covariance.

Covariance of independent variables. If \( X \) and \( Y \) are independent random variables, then \( \text{Cov}(X, Y) = 0. \)

If \( X \) and \( Y \) are independent, then \( E[XY] = E[X] E[Y] \) and therefore \( \text{Cov}(X, Y) = 0 \). (Recall that \( E[XY] = E[X] E[Y] \) is a simple consequence of the fact that \( P(X | Y) = P(X) \).)

Dependent variables with zero covariance. However, the converse is not in general true. As a simple example, suppose that \( X \) is a standard normal random variable and that \( Y = X^2 \). Notice that knowledge of \( X \) completely determines \( Y \), in which case \( X \) and \( Y \) are very clearly dependent. However, by symmetry it holds that\[ \text{Cov}(X, Y) = E[XY] - E[X] E[Y] = 0. \]

A simple corollary is as follows.

Variance of the sum of independent variables. Given independent random variables \( X_i \), each with finite variance,

\[ \text{Var}\left( \sum_i X_i \right) = \sum_i \ \text{Var}(X_i). \]

Since the \( X_i \) are independent, it must be the case that \( \text{Cov}(X_i, X_j) = 0 \) for all \( i \neq j \), and the result follows directly from the variance of a sum theorem.

Covariance Matrix

When dealing with a large number of random variables \( X_i \), it makes sense to consider a covariance matrix whose \( m,n \)th entry is \( \text{Cov}(X_m, X_n) \).

Since \( \text{Cov}(X, Y) = \text{Cov}(Y, X) \), the covariance matrix is symmetric.

References

[1] DeGroot, Morris H. Probability and Statistics. Second edition. Addison-Wesley, 1985.

Covariance | Brilliant Math & Science Wiki (2024)

FAQs

Why is covariance difficult to interpret? ›

Covariance values alone can be challenging to interpret, as they are influenced by the scale of the variables. For one pair of variables, covariance value can be in for example of range of 100 while for some other pair of variables it can be in range of 500.

What is the idea behind covariance? ›

Covariance measures the total variation of two random variables from their expected values. Using covariance, we can only gauge the direction of the relationship (whether the variables tend to move in tandem or show an inverse relationship).

What is covariance in math? ›

Covariance is a measure of the relationship between two random variables and to what extent, they change together. Or we can say, in other words, it defines the changes between the two variables, such that change in one variable is equal to change in another variable.

Is covariance good or bad? ›

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. Investors might seek investments with a negative covariance to help them diversify their holdings.

What are the weakness of covariance? ›

There is only 1 disadvantage of the covariance, & that is it does not tell the strength/power by which those features are correlated. Covariance only tells the direction of the correlation between the features.

What is the problem with covariance? ›

A weak covariance in one data set may be a strong one in a different data set with different scales. The main problem with interpretation is that the wide range of results that it takes on makes it hard to interpret. For example, your data set could return a value of 3, or 3,000.

What is an example of a covariance in real life? ›

Example 1. In one study, a scientist looks at the covariance between two variables: outdoor temperature and ice cream consumption. The covariance for this data set is calculated as 35.89. This value means that the two variables move in the same direction as each other, so that as one rises so does the other.

What is a good covariance value? ›

The size of covariance values depends on the difference between values in variables. For instance, if the values are between 1000 and 2000 in the variable, it possible to have high covariance. However, if the values are between 1 and 2 in both variables, it is possible to have a low covariance.

How to calculate covariance by hand? ›

To calculate covariance of a sample, use the formula:Cov(X,Y) = Σ(Xi – μ)(Yj – ν) / (n-1)Where the parts of the equation are: Cov(X,Y) represents the covariance of sample X and covariance of sample Y. Σ(Xi) = μ, which represents the expected mean (average) value for your X values.

What is the analysis of covariance in simple terms? ›

The Analysis of Covariance, or ANCOVA, is a regression model that includes both categorical and numeric predictors, often just one of each. It is commonly used to analyze a follow-up numeric response after exposure to various treatments, controlling for a baseline measure of that same response.

What is the formula for calculating covariance? ›

To calculate covariance, you can use the formula:Cov(X, Y) = Σ(Xi-µ)(Yj-v) / nWhere the parts of the equation are: Cov(X, Y) represents the covariance of variables X and Y. Σ represents the sum of other parts of the formula. (Xi) represents all values of the X-variable.

What is covariance vs correlation for dummies? ›

Both covariance and correlation measure the relationship and the dependency between two variables. Covariance indicates the direction of the linear relationship between variables. Correlation measures both the strength and direction of the linear relationship between two variables.

What are the cons of covariance? ›

Covariance Drawbacks

Covariance can only measure the directional relationship between two assets. It cannot show the strength of the relationship between assets. The correlation coefficient is a better measure of that strength.

Why is covariance not a good measure? ›

It is also worth noting that covariance simply gauges how two variables change together, not whether one variable is dependent on another. Covariance is useful for determining the relationship; however, it is ineffective for determining the magnitude.

What is the risk of covariance? ›

”Covariance risk” is the risk that a project will have a strong (typically negative) relationship between generation and price — so an hour of abnormally high generation will correspond to a low power price, and vice versa.

What is the limitation of covariance? ›

The use of covariance does have drawbacks. Covariance can only measure the directional relationship between two assets. It cannot show the strength of the relationship between assets. The correlation coefficient is a better measure of that strength.

Why covariance is not a good measure of association? ›

All covariance values are positive so all pairwise associations are positive. But, the magnitudes do not tell us about the strength of the associations. To assess the strength of an association, we use correlation values. This suggests an alternative measure of association.

Why is the sample correlation easier to interpret than the sample covariance? ›

The values from PCA while using the correlation matrix are closer to each other and more uniform as compared to the analysis using the covariance matrix. The analysis with the correlation matrix definitely uncovers better structure in the data and relationships between variables.

Why would you say that the correlation coefficient is easier to interpret than the covariance? ›

Interpretation is easy! In summary, correlation is far more interpretable than covariance because it allows us to assess the direction and strength of relationships across different units.

Top Articles
Latest Posts
Article information

Author: Dr. Pierre Goyette

Last Updated:

Views: 5445

Rating: 5 / 5 (70 voted)

Reviews: 93% of readers found this page helpful

Author information

Name: Dr. Pierre Goyette

Birthday: 1998-01-29

Address: Apt. 611 3357 Yong Plain, West Audra, IL 70053

Phone: +5819954278378

Job: Construction Director

Hobby: Embroidery, Creative writing, Shopping, Driving, Stand-up comedy, Coffee roasting, Scrapbooking

Introduction: My name is Dr. Pierre Goyette, I am a enchanting, powerful, jolly, rich, graceful, colorful, zany person who loves writing and wants to share my knowledge and understanding with you.