# Measuring volatility

The volatility $$\sigma$$ of an asset is a measure of the uncertainty about the asset's returns. Volatility measures how much the price varies over time.

There are two types of volatility we can consider: implied and realised. Implied volatility can be extracted from option prices (it's implied from the prices). Realised volatility is the actual volatility experienced by the underlying, which could be a stock, futures contract, etc.

Unlike prices, volatility is not something that can be directly observed, instantaneous volatility is unobservable. Volatility requires time to manifest itself.

## Simple estimation

The standard definition of volatility is the square root of the variance. We're going to use the formula for estimating the population variance:

\begin{equation*} \sigma^2 = \frac{1}{N-1}\sum_{i=1}^{N‎}(x_i - \bar{x})^2 \end{equation*}

Where $$x_i$$ is the i'th logarithmic return, defined as:

\begin{equation*} x_i = ln\left(\frac{S_i}{S_{i-1}}\right) \end{equation*}

Example: daily closing prices over the month of August 2013 for the stock GOOG.

Date Price Return Mean Return Squared Diff
01-Aug-13 904.22
02-Aug-13 906.57 0.002596 -0.003119 0.000033
05-Aug-13 905.00 -0.001733 -0.003119 0.000002
06-Aug-13 896.57 -0.009359 -0.003119 0.000039
07-Aug-13 890.65 -0.006625 -0.003119 0.000012
08-Aug-13 892.66 0.002254 -0.003119 0.000029
09-Aug-13 890.41 -0.002524 -0.003119 0.000000
12-Aug-13 885.51 -0.005518 -0.003119 0.000006
13-Aug-13 881.25 -0.004822 -0.003119 0.000003
14-Aug-13 869.81 -0.013067 -0.003119 0.000099
15-Aug-13 859.66 -0.011738 -0.003119 0.000074
16-Aug-13 856.91 -0.003204 -0.003119 0.000000
19-Aug-13 865.65 0.010148 -0.003119 0.000176
20-Aug-13 865.42 -0.000266 -0.003119 0.000008
21-Aug-13 869.33 0.004508 -0.003119 0.000058
22-Aug-13 873.71 0.005026 -0.003119 0.000066
23-Aug-13 870.21 -0.004014 -0.003119 0.000001
26-Aug-13 866.39 -0.004399 -0.003119 0.000002
27-Aug-13 850.15 -0.018922 -0.003119 0.000250
28-Aug-13 848.55 -0.001884 -0.003119 0.000002
29-Aug-13 855.43 0.008075 -0.003119 0.000125
30-Aug-13 846.90 -0.010022 -0.003119 0.000048

Summing the squared differences gives us 0.001025. We have 22 days of prices, which gives us returns for 21 days (N = 21). Plugging these numbers into the formula above gives us:

\begin{equation*} \sigma^2 = \frac{1}{N-1} 0.001025 = \frac{1}{20} 0.001025 = 0.00005125... \end{equation*}

Square rooting gives us our estimate for the daily volatility.

\begin{equation*} \sigma_{daily} = \sqrt{0.00005125...} = 0.0072... = 0.72\% \end{equation*}

This means that we expect Google's stock price to move by 0.72% every day.

Generally, the market convention is to quote in terms of annualised volatility. To convert our daily volatility we multiply our value by the square root of how many periods there are in a year. If we had monthly volatility we'd multiply by $$\sqrt{12}$$ , but as we have daily we'll multiply by $$\sqrt{252}$$ as there are generally around 252 trading days in a year.

\begin{equation*} \sigma_{annual} = \sigma_{daily} \sqrt{252} = 11.36\% \end{equation*}

When looking at a financial time series, it's difficult to distinguish mean returns ( $$\bar{x}$$ ) from variance. We have to estimate both the mean and the variance, which is very difficult to do accurately. For this reason it's common to set the mean return in the equation to 0, making our formula:

\begin{equation*} \sigma^2 = \frac{1}{N-1}\sum_{i=1}^{N‎}x_i^2 \end{equation*}

If we repeated our calculation using a mean return of zero, our annual volatility changes from 11.36% to 12.48%.

This method is known as the simple close-close estimator, as it only uses the closing prices to calculate a volatility estimate.

## Bias & efficiency

As we mentioned above, instantaneous volatility is unobservable, we're merely estimating volatility. How do we know if our estimate is good or bad?

### Bias

Bias is defined as the difference between an estimator's expected value and the true value of the parameter being estimated. When the difference is zero it's considered to be unbiased, otherwise it's said to be biased.

For example, an estimator may consistently over- or under-estimate, this would make it biased. But, if an estimator is sometimes too high and sometimes too low, it could still be unbiased, it may just be a poor estimator.

### Efficiency

An efficient estimator needs fewer samples than a less efficient one to produce a precise estimate. In practice an efficient estimator needs fewer data points to achieve the same degree of precision as a less efficient estimator.

## Improving our estimation

The close-close estimator converges to the true measure of volatility very slowly, meaning we need to use more prices for it to give an accurate estimation.

To improve our estimate we can do two things:

1. Use higher frequency data, such as intraday prices.

This will increase the sample size (and thus our accuracy) but it won't increase how far back in time we look. For example instead of using 10 days of closing prices, we could use 5 days of mid-day and closing prices.

2. Use a better estimator.

The closing price isn't the only price published at the end of every day, we also have the highest and lowest prices for the day. An estimator can use this data.

## The Parkinson Estimator

\begin{equation*} \sigma = \sqrt{\frac{1}{4 N ln(2)} \sum_{i=1}^{N} ln \left( \frac{h_i}{l_i}\right) ^2} \end{equation*}

This volatility estimator was created by Michael Parkinson and published in 1980 in the paper "The Extreme Value Method for Estimating the Variance of the Rate of Return".

This estimator uses the high and low prices for a day, rather than just the day's closing price, which improves the estimator's efficiency. Intuitively it makes sense that by using the range of the day's prices you can estimate volatility. The Parkinson estimator is about five times more efficient at estimating volatility than the close-close estimator.

One drawback of this estimator is that it assumes that trading is continuous and that the markets never close. Because of this, price movements like overnight jumps are ignored, and therefore it systematically underestimates volatility.