Open In App

Covariance and Correlation

Last Updated : 27 May, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

Covariance and correlation are the two key concepts in Statistics that help us analyze the relationship between two variables. Covariance measures how two variables change together, indicating whether they move in the same or opposite directions.

independent_variables
Relationship between Independent and dependent variables

To understand this relationship better, consider factors like sunlight, water, and soil nutrients (as shown in the image), which are independent variables that influence plant growth our dependent variable. Covariance measures how these variables change together, indicating whether they move in the same or opposite directions.

What is Covariance?

Covariance is a statistical measure that indicates the direction of the linear relationship between two variables. It assesses how much two variables change together from their mean values. Covariance is calculated by taking the average of the product of the deviations of each variable from their respective means. Covariance helps us understand the direction of the relationship but not how strong it is because the number depends on the units used. It’s an important tool to see how two things are connected.

  1. It is the relationship between a pair of random variables where a change in one variable causes a change in another variable.
  2. It can take any value between - infinity to +infinity, where the negative value represents the negative relationship whereas a positive value represents the positive relationship.
  3. It is used for the linear relationship between variables.
  4. It gives the direction of relationship between variables.

Covariance Formula

For Population:

Covariance Formula

For Sample:

Covariance

Here,

  • x' and y' = mean of given sample set
  • n = total no of sample
  • xi and yi = individual sample of set

Types of Covariance

  • Positive Covariance: When one variable increases, the other variable tends to increase as well, and vice versa.
  • Negative Covariance: When one variable increases, the other variable tends to decrease.
  • Zero Covariance: There is no linear relationship between the two variables; they move independently of each other.

Example

Covariance and Correlation

What is Correlation?

Correlation is a standardized measure of the strength and direction of the linear relationship between two variables. It is derived from covariance and ranges between -1 and 1. Unlike covariance, which only indicates the direction of the relationship, correlation provides a standardized measure.

  • Positive Correlation (close to +1): As one variable increases, the other variable also tends to increase.
  • Negative Correlation (close to -1): As one variable increases, the other variable tends to decrease.
  • Zero Correlation: There is no linear relationship between the variables.

The correlation coefficient \rho (rho) for variables X and Y is defined as:

  1. It show whether and how strongly pairs of variables are related to each other.
  2. Correlation takes values between -1 to +1, wherein values close to +1 represents strong positive correlation and values close to -1 represents strong negative correlation.
  3. In this variable are indirectly related to each other.
  4. It gives the direction and strength of relationship between variables.

Correlation Formula

Correlation Formula

Here,

  • x' and y' = mean of given sample set
  • n = total no of sample
  • xi and yi = individual sample of set

Example

Covariance and Correlation

Difference between Covariance and Correlation

This table shows the difference between Covariance and Covariance:

CovarianceCorrelation
Covariance is a measure of how much two random variables vary togetherCorrelation is a statistical measure that indicates how strongly two variables are related.
Involves the relationship between two variables or data sets Involves the relationship between multiple variables as well
Lie between -infinity and +infinity Lie between -1 and +1
Measure of correlation Scaled version of covariance
Provides direction of relationship Provides direction and strength of relationship
Dependent on scale of variable Independent on scale of variable
Have dimensions Dimensionless

Applications of Covariance and Correlation

Applications of Covariance

  • Portfolio Management in Finance: Covariance is used to measure how different stocks or financial assets move together, aiding in portfolio diversification to minimize risk.
  • Genetics: In genetics, covariance can help understand the relationship between different genetic traits and how they vary together.
  • Econometrics: Covariance is employed to study the relationship between different economic indicators, such as the relationship between GDP growth and inflation rates.
  • Signal Processing: Covariance is used to analyze and filter signals in various forms, including audio and image signals.
  • Environmental Science: Covariance is applied to study relationships between environmental variables, such as temperature and humidity changes over time.

Applications of Correlation

  • Market Research: Correlation is used to identify relationships between consumer behavior and sales trends, helping businesses make informed marketing decisions.
  • Medical Research: Correlation helps in understanding the relationship between different health indicators, such as the correlation between blood pressure and cholesterol levels.
  • Weather Forecasting: Correlation is used to analyze the relationship between various meteorological variables, such as temperature and humidity, to improve weather predictions.
  • Machine Learning: Correlation analysis is used in feature selection to identify which variables have strong relationships with the target variable, improving model accuracy.

Also Read


Next Article

Similar Reads