Understanding 'Risk Management & Trading Psychology'

Lesson -> A Brief note on The Risk (Part 02)

3.1 - The Variance

We have already discussed the topic of expected returns in the previous chapter. In this chapter we will continue to discuss the concept of portfolio variance. Portfolio Variance is a way to understand portfolio risk. As a measure of risk, I hope you are familiar with the term 'Standard Deviation'. In previous modules, we have already discussed standard deviation several times. If you don't know what standard deviation is, I recommend you learn it. It is easy to calculate the risk of one stock by simply calculating its standard deviation. However, it is quite difficult to calculate the risk for a portfolio. A portfolio is a group of stocks. This chapter will help you to understand how to assess risk at portfolio level.

Before we move on, however, let's first understand what Variance and Covariance are. Both Variance, as well as Covariance, can be considered statistical measures. Let's start with Variance.

(image 1


s 2 = Variance

X = Daily Return

u = Average daily return

N = Total number

The variance is calculated as sigma squared. I won't go into detail about the reason for this because it is complex and could lead to digressions. As I said, variance is sigma squared. To help you understand how variance can be calculated, let me give you a simple example.

Consider the following:

Day 1 - +0.75%

Day 2 - +1.25%

Day 3 - -0.55%

Day 4 - -0.75%

Day 5: +0.8%

The average return in this instance is +0.3%. Now we need to calculate the daily return dispersion over the average return and square it.

Daily ReturnDispersion - AverageDispersion Squared
+ 0.75%0.3% = + 0.45% - 0.75% = 0.3%0.45% 2 = 0.002025%
+1.25%+1.25% - 0.3% = +0.95%0.95%2 = 0.099025%
-0.55%-0.55% – 0.3% = -8.5%-0.85%2 = 0.027225%
-0.75%-0.75% – 0.3% = -1.055%-1.05%2 = 0.011025%
+0.80%+0.8% - 0.3% = (+0.5%0.50%2 = 0.022500%

Now, we will add the dispersion squared and get 0.0318000%. To get the variance, we divide this by 5 (N).

0.0318000%/ 5

s = 0.0063600%.

What does this number tell you? This number gives us an indication of the spread between the expected daily returns and the daily returns. Investors should consider the variance in order to assess the investment's riskiness. Large variances can indicate that the stock is very risky, while small variances may indicate a lower risk. The variance in the above example is high because we have only 5 days of data.

Here's something you might be interested in: The following mathematical relationship shows how standard deviation and variance are related.

Square Root Of Variance = Standard Deviation

This can be applied to the above example and used to calculate the 5-day average deviation of stock.



Which is also known as the standard deviation. The stock's volatility over the past 5 days. At this point, however, I want to make sure you are aware of Variance and its true meaning. In the end, we will add variance and covariance to the portfolio variance equation.

3.2 - The Covariance

The covariance is the interaction of two or more variables. It indicates whether two variables move together (in this case, they share a positive or negative covariance). In the context of the stock market, covariance is the ratio of the stock prices of two or more stocks. If they have a positive correlation, the two stock prices will likely move in the same direction. Conversely, if they have negative covariance, they will move in opposite directions.

Although covariance sounds similar to correlation, I believe they are two different things. In the next chapter, we will discuss this topic in more detail.

Calculating covariance between two stocks is a good way to get a better understanding of covariance. Here's how to calculate covariance for two stocks: (image 2).


RtS1 = Daily stock returns of stock 1

Average Return of Stock 1 Over a Period

RtS2 = Daily stock returns of stock 2

Average Return of Stock 2 Over a Period

n The total number days

You can also calculate covariance by taking the average return of both stocks and the daily returns.

Does that sound confusing? It does sound confusing, I suppose.

Let's take an example to see how we can calculate covariance among two stocks.

This illustration uses two stocks: Idea Cellular Limited and Cipla Limited. We will use the following formula to calculate the covariance of these stocks. To implement the formula, we will use excel.

Let's see if you can guess the covariance between Cipla & Idea before we go any further. Imagine two large corporations, of similar size, operating in completely different sectors. What would you consider the covariance? Give it some thought.

Here are the steps to calculate covariance in Excel (notice that although excel has a function to calculate covariance directly, I will take the slightly more complicated approach just to be clear)

Step 1 Download daily stock prices. I have downloaded six months of data for each stock to illustrate the point.
(image 3


Step 2: Calculate the daily returns of both stocks. Divide the stock price today by yesterday's stock and subtract 1 from the end result. This calculates daily returns

(image 4

Step 3: Calculate the average daily returns

(mage 5

Step 4: Once you have calculated the average, subtract the daily return from its average

(image 6).

Step 5 Multiplying the two series that were calculated in the previous step

(image 7).

Step 6 – Add up the calculations from the previous step. Add up the data points. This can be done by using excel's count function and any field as the input array. Here, I used the count on dates.

(image 8

Step 7 This is the last step in computing the covariance. Divide the sum by count minus 01, that is (n-1) to do this. In this example, the count is 127. Therefore count-1 would be 126. The sum calculated in the previous step was 0.066642. Thus, covariance is

= 0.006642/126


(image 9

As you can see the covariance is very small. But that's not what matters. We don't need to look at the covariance between these stocks. The positive covariance between the stocks means that their returns move in the same direction. This means that both stocks will likely move in the same direction in a given market situation. Not to be confused, covariance doesn't tell us how much the stocks move. Correlation is a measure of the magnitude or degree of these stocks' movements. The correlation between Idea & Cipla is 0.106. This indicates that they are not closely correlated.

This is an interesting fact. Here is the mathematical equation that determines correlation between two stocks:

(image 10


Cov (xy,y) is the covariance of the two stocks

s x= Standard deviation from stock x

s y= Standard deviation stock y

The standard deviation of a stock simply represents the square root the variance of that stock. Let's do this: We have used the direct excel function to calculate the correlation between Idea & Cipla. You can verify the formula's accuracy by using it.

However, when it comes to building a stock portfolio do you believe a positive covariance is a good thing or a bad thing? Portfolio managers want stocks that have a positive covariance. Portfolio managers want stocks that share a negative covariance. It is simple: they want stocks that can last. They want the portfolio to be stable, so if one stock falls, they want it to fall. This helps to balance the portfolio and lowers overall risk.

Consider a regular portfolio. It will likely contain more than two stocks. A good portfolio will have at least 12-15 stocks. How does one measure covariance? Here is where things get complicated. You will need to compare the covariance of each stock and all other stocks in your portfolio. Let me show you how this works with a portfolio of 4 stocks. This is the portfolio.

  1. ABB
  2. Cipla
  3. Idea
  4. Wipro

In this instance, we will need to calculate the covariance between -

  1. ABB, Cipla
  2. ABB, Idea
  3. ABB, Wipro
  4. Cipla, Idea
  5. Cipla, Wipro
  6. Wipro, Idea

Notice that the covariance of stock 1 and stock 2 are the same as those between stock 2 or stock 1. As you can see, we need to calculate 6 covariances for 4 stocks. Imagine the complexity of having 15 to 20 stocks. If we have more than 2 stocks in our portfolio, the covariance of each stock is calculated and tabulated using a 'Variance Covariance Matrix. Although I would love to discuss this right now, I will save it for the next chapter.

Keep watching for more.

To Summarize

  1. Variance is the variation in returns relative to the expected average returns
  2. A higher variance means more risk. A lower variance means less risk
  3. Standard deviation is the square root of variance
  4. The covariance between returns of two stocks measures the differences in returns
  5. A positive covariance means that the returns move positively, while a negative covariance means that one stock returns increases and the other falls.
  6. Correlation is a measure of the strength or weakness of a movement
  7. A correlation is a mixture of two stocks that are covariant over their individual standard deviations.
  8. If there are more than 2 stocks in a portfolio we use a matrix to calculate the variance-covariance