I have some financial data which contain stock indexes prices per 30 minutes (I also have them in 5 minute intervals but the logic is the same).

I want to calculate the volatility of this data.

I came across this post here :


which claims that the command

egen st=sd(return), by(date) 

gets the job done. So I did that, and I have one value of volatility per day, which basically means that all 30 minute prices (of the same day) have the same volatility calculated.

1) So my first question is, is there a way to calculate a volatility for every price, or different volatilities for the same day ("intraday" volatilities for different "intraday" prices) ? Would that even make sense? Could I use something like the squared returns of every 30 minutes as a proxy for high frequency volatility, or not ?

Or is having one value per day the only way? I understand that since you sum up the squares of the differences and all that to calculate the standard deviation, that the answer could be that you have 1 value, cause you need more than one values to calculate the SD in the first place, right? Or not?

2) My second question is, is there some more sophisticated way to calculate the volatility, instead of using the standard deviation? Maybe a GARCH model would make sense? Any other suggestions

Thanks for the clarification in advance guys, seems I am a little bit confused here!



In general, one observation $x$ of a random variable $X$ is not enough to obtain a sensible estimator of the variance of $X$, $\widehat{\operatorname{Var}}(X)$. Technically, you need at least two points $x_1$ and $x_2$. In practice, you need even more to be able to trust the estimate (to get the variance of the estimator down to a sensible level). However, given extra assumptions more could be achieved.

Using squared returns as proxy for volatility may not be a very good idea because this proxy will be noisy.
Let $x$ now denote a random process and let $\Delta x_t$ denote a one-period return.
If you assume that $\operatorname{E}(\Delta x_t)=0 \ \forall t$, then $\operatorname{Var}(\Delta x_t)=\operatorname{E}((\Delta x_t)^2)$.
You could be tempted to use an estimator $\widehat{\operatorname{Var}}(\Delta x_t):=(\Delta x_t)^2$.
However, the reliability of this estimator may be poor; actually, the variance of the estimator is undefined, if I am not mistaken. This is essentially like trying to determine the population mean from just one observation. How much precision can you expect from that? You cannot even quantify that, loosely speaking.

Again, under extra assumptions you could get further.
For example, assuming that the variance of all 30-minute returns on a given day is the same, you could use the empirical variance of all the 30-minute observations on the given day to estimate the true variance.
Alternatively, assuming that the conditional variance of the 30-minute returns follows a GARCH(1,1) process could give less noisy estimates of the true variance than using squared returns, if GARCH(1,1) approximates the true process reasonably well. Unfortunately, you cannot assess the latter property given just the data used for fitting the GARCH model; the true variance is unobserved, so you cannot see if a model fits it well. Still, GARCH(1,1) is quite a popular model for financial returns, so you could give it a try.


If you are willing to accept extra assumptions, you could use a GARCH model. See the previous paragraph for more details.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.