Covariance: How to Calculate Covariance of Stocks

Covariance: How to Calculate Covariance of Stocks

Covariance is a statistical measure of how two variables — such as the returns of two stocks — move in relation to each other. A positive covariance means they tend to move in the same direction; a negative covariance means they tend to move in opposite directions. In investing, covariance is a building block for measuring portfolio risk and the benefits of diversification.

Overview
FAQs
Videos

Know the benefits of a demat account

Free Demat account in minutes | Low brokerage | Online account opening

Covariance measures the relationship between two variables by showing whether they move together or move in opposite directions. It is widely used in statistics, portfolio construction, and risk analysis.


Key takeaways:


  • A positive covariance means two variables generally move in the same direction.
  • A negative covariance means two variables generally move in opposite directions.
  • A covariance close to zero suggests little or no linear relationship.
  • Investors use covariance to understand how different stocks interact within a portfolio.
  • Covariance is a key input in portfolio risk and diversification analysis.
  • The covariance formula compares each variable's deviation from its mean.
Show More
Show Less

What is covariance?

What is covered call?
 

What is covered call?

Covariance is a statistical measure that indicates the direction of the relationship between two variables. It shows whether the variables tend to increase and decrease together or move in opposite directions.


The magnitude of covariance alone may be difficult to interpret because it depends on the scale of the variables. However, the sign of covariance provides useful information about the relationship.


Covariance valueInterpretation
PositiveVariables tend to move in the same direction
NegativeVariables tend to move in opposite directions
Zero or near zeroLittle or no linear relationship

For example, if two stocks frequently rise and fall together, they may have a positive covariance. If one stock generally rises when the other falls, their covariance may be negative.

Show More
Show Less

The covariance formula in statistics

Covariance is calculated by measuring how each observation differs from its mean and then evaluating how those deviations move together.


The sample covariance formula is:


Cov(X,Y) = Σ[(Xi − X̄)(Yi − Ȳ)] ÷ (n − 1)


Where:

SymbolMeaning
XiIndividual value of variable X
YiIndividual value of variable Y
Mean of variable X
ȲMean of variable Y
nNumber of observations
ΣSum of all observations

The formula multiplies the deviations of the two variables from their respective means. The average of these products determines whether the variables generally move together or apart.

Show More
Show Less

How to calculate the covariance of two stocks: worked example

Consider the monthly returns of two hypothetical stocks.


MonthStock A (%)Stock B (%)
145
267
354
478

 

Step 1: Calculate the mean return


StockMean return (%)
Stock A5.5
Stock B6.0

 

Step 2: Calculate deviations from the mean


MonthA − Mean AB − Mean B
1-1.5-1
20.51
3-0.5-2
41.52

 

Step 3: Multiply the deviations

MonthProduct of deviations
11.5
20.5
31.0
43.0

Sum of products = 6.0


Step 4: Calculate covariance


Covariance = 6 ÷ (4 − 1)

Covariance = 2.0


The positive covariance indicates that the returns of the two stocks generally move in the same direction. When one stock's return increases, the other tends to increase as well.

Show More
Show Less

Variance vs covariance vs correlation and why it matters

Variance, covariance, and correlation are related statistical concepts, but they measure different aspects of data behaviour.


MeasureWhat it measuresInterpretation
VarianceDispersion of a single variable around its meanMeasures individual volatility
CovarianceJoint movement of two variablesShows direction of relationship
CorrelationStrength and direction of a relationshipStandardised relationship measure

 

Variance vs covariance

Variance measures how much a single variable deviates from its average value. Covariance measures how two variables move relative to each other.

For example, variance can measure the volatility of a stock's returns, while covariance can measure how that stock moves relative to another stock.


Covariance vs correlation

Covariance indicates the direction of a relationship but does not provide a standardised measure of its strength. Correlation standardises the relationship and ranges from -1 to +1.


Because correlation is easier to interpret, analysts often use it alongside covariance when evaluating investment portfolios.


Why does covariance matter in investing?

Covariance helps investors understand how assets interact within a portfolio. Combining assets with different covariance characteristics can improve diversification.


For example, stocks with low or negative covariance may reduce overall portfolio volatility because they do not always move in the same direction. This makes covariance an important tool in portfolio construction and risk management.

Show More
Show Less

Conclusion

Covariance is a statistical measure that helps determine how two variables move in relation to each other. A positive covariance indicates that variables generally move together, while a negative covariance suggests they move in opposite directions.


In investing, covariance plays an important role in portfolio analysis, diversification, and risk management. Understanding covariance, along with variance and correlation, can help investors evaluate relationships between securities and make more informed investment decisions.

Features and Benefits of LAS

Tenure 36 months

Tenure 36 months

Flexible repayment from 7 days to 36 months

1000+ shares

1000+ shares

Get 50% value on 1000+ shares

All DP shares available

All DP shares available

All companies’ and DPs’ Demat accounts accepted for loans

Customer portal

Customer portal

Handle loans, shares, and statements — all in one place

Pro Tip

Invest in equities, F&O and upcoming IPOs effortlessly by opening a demat account online. Enjoy a free subscription for the first year with Bajaj Broking

Frequently Asked Questions

Covariance

What is covariance?

Covariance is a statistical measure that shows how two variables move in relation to one another. A positive covariance indicates that the variables generally move in the same direction, while a negative covariance suggests that they tend to move in opposite directions.

 

What is the covariance formula in statistics?

The sample covariance formula is Cov(X,Y) = Σ[(Xi − X̄)(Yi − Ȳ)] ÷ (n − 1). It measures how deviations from the mean of two variables move together across a set of observations.

How do you calculate the covariance of two stocks?

To calculate the covariance of two stocks, determine the average return of each stock, calculate deviations from those averages, multiply the deviations for each observation, add the results, and divide the total by n − 1.

What is the difference between variance and covariance?

Variance measures how much a single variable deviates from its mean. Covariance measures how two variables move relative to each other and indicates whether their movements are generally in the same or opposite directions.

Show More Show Less

Disclaimer

Standard Disclaimer

Investments in the securities market are subject to market risk, read all related documents carefully before investing.

Broking services offered by Bajaj Financial Securities Limited (Bajaj Broking). Reg Office: Bajaj Auto Limited Complex, Mumbai –Pune Road Akurdi Pune 411035. Corporate Office: Bajaj Financial Securities Limited, 1st Floor, Mantri IT Park, Tower B, Unit No 9 & 10, Viman Nagar, Pune, Maharashtra 411014. SEBI Registration No.: INZ000218931 | BSE Cash/F&O/CDS (Member ID:6706) | NSE Cash/F&O/CDS (Member ID: 90177) | DP registration No: IN-DP-418-2019 | CDSL DP No.: 12088600 | NSDL DP No. IN304300 | AMFI Registration No.: ARN –163403.

Details of Compliance Officer: Mr. Boudhayan Ghosh (For Broking/DP/Research) | Email: compliance_sec@bajajbroking.in | Contact No.: 020-4857 4486. For any investor grievances write to compliance_sec@bajajbroking.in/ compliance_dp@bajajbroking.in (DP related)

This content is for educational purpose only. Securities quoted are exemplary and not recommendatory.

Research Services are offered by Bajaj Broking as Research Analyst under SEBI Regn: INH000010043.

For more disclaimer, check here: https://www.bajajbroking.in/disclaimer