## How to calculate standard deviation

### What is a standard deviation?

A standard deviation provides a measure of the variability of a set of data. In the article on Value-at-Risk, we considered a portfolio of three assets, whose value varies from one observation period to another. In the article, we accepted measurements of both the standard deviation of all the assets and the correlation between them. This article shows how the standard deviations were calculated from the raw (or observed) data.

Over the previous ten observation periods, the value of the three assets increased by the proportions shown in Table 1.

The mean return is calculated by adding all the observed returns together and dividing the total by the number of observations (in this case 10). However, whilst the mean measures the average movement over the time period, it does not give any indication of the range of observations. This can be seen by contrasting the observations of Asset 1 and Asset 2. Asset 1 ranges from 8% to 14%, whereas Asset 2 ranges from 2% to 21% – however the means are only 10.6% and 12% respectively. Standard deviation gives a much clearer view of the volatility of the two assets.

##### To calculate the standard deviation, use the following formula:
$$S.D. = v\:?\frac{x \: -\: \mu^2}{n\:-\:1}$$

Where:

• ? = Sum of
• x = an observation in the series
• μ = mean
• n = number of observations.

In words, for each observation, we calculate the difference between that observation and the mean, and square it. All these squared differences are then added together and then divided by the number of observations minus one. The square root of this figure is the standard deviation.

#### To calculate standard deviation for Asset 1

$$First \: calculate \: \mathord{?} \: \chi\:-\: \: \mu^2$$
Observation Asset 1 Mean Difference Difference2
1 14% 10.6% 3.4% 11.56%
2 12% 10.6% 1.4% 1.96%
3 10% 10.6% 0.6% 0.36%
4 11% 10.6% 0.4% 0.16%
5 13% 10.6% 2.4% 5.76%
6 10% 10.6% 0.6% 0.36%
7 9% 10.6% 1.6% 2.56%
8 8% 10.6% 2.6% 6.76%
9 9% 10.6% 1.6% 2.56%
10 10% 10.6% 0.6% 0.36%
Total (?(x-μ)2 32.40%

$$Then \: S.D. = v\frac{32.4}{10\:-\: 1} \: =\: \frac{32.4}{9} \: =\: 1.8974\%$$

Using the same formula, the S.D. for Asset 2 is 6.146% and for Asset 3 is 3.521%. Returning to our earlier point, the difference in the standard deviations between assets 1 and 2 gives us a much clearer indication as to the respective spreads of the observations detailed above.

If you use an Excel spreadsheet to record your data, you can use the STDEV formula to calculate the standard deviation. Assume the observations on Asset 1 are in column A, rows 1 to 10, in an Excel spreadsheet. To calculate the standard deviation, you would enter the following formula into a different square:

=STDEV A 1 : A 10

This would give the answer 0.018974 or 1.8974%.