# How to check if the volatility is stationary?

Please, take a look at the chart below.

As you can see the first period the volatility is high and the second is low.

How can I check if the volatility is stationary (homogeneous) during the entire period?

The plot represents the residuals of a simple linear regression.

-

A simple method, useful both for exploration and hypothesis testing, takes the Durbin Watson statistic and the semivariogram as its point of departure: denoting the sequence of residuals by $e_t$ (with $t$ the "index" of the plot), compute

$$\gamma(t) = \frac{1}{2}(e_{t+1}-e_t)^2.$$

The data (as presented in the question) result in this plot:

(The residual values have been uniformly rescaled compared to what is shown on the vertical axis in the original plot. This does not affect the subsequent analysis.) Typically there will be scatter, as shown here. To visualize this better, smooth it:

This plot is on a square root scale (let's call this the "dispersion") to dampen the extreme oscillations. The wiggly blue lines are a modest smooth (medians of 3 followed by a lag-13 moving average). The solid red line is an aggressive smooth of that. (Here, it's a Gaussian convolution; in general, though, I would recommend a Lowess smooth of $\sqrt{\gamma(t)}$.) Together, these lines trace out detailed fluctuations in dispersion and intermediate-range trends, respectively. The yellow and green thresholds, shown for reference, delimit (a) the lowest smoothed dispersion in the first 225 indexes and (b) the mean smoothed dispersion from index 226 onwards. I chose the changepoint of 225 by inspection.

Clearly almost all the smoothed dispersion values above 6 occurred during the first 225 indexes. From index=225 to index=350 or so, the smoothed dispersions decrease and then stay constant around 2.7.

The change in dispersion is now visually obvious. For most purposes--where the change is so clear and strong--that's all one needs. But this approach lends itself to formal testing, too. To identify a point where the dispersion changed, and to estimate the uncertainty of that point, apply a sequential online changepoint procedure to the sequence $(\gamma(t))$. An even more straightforward check, when you suspect there has been just one major change in volatility, is to use regression to check the dispersion for a trend. If one exists, you can reject the null hypothesis of homogeneous volatility.

-
:whuber The Durbin-Watson test is numerically "similar to" a test for a significant acf of Lag1 . This of course limits its value in concluding about randomness. If there are anomolous data points caused by omitted Deterministic Structure the variance of the errors is enlarged. The effect of increased variance of the residuals yields a downward bias when you consider that the ACF = Covariance/Variance thus the unusual values (untreated) cause to a false conclusion of "whiteness". –  IrishStat Aug 26 '11 at 20:29
@whuber thank you! I found Durbin Watson test in the lmtest package. are you referring to hosho.ees.hokudai.ac.jp/~kubo/Rdoc/library/lmtest/html/… ? –  Dail Aug 26 '11 at 21:28
@whuber last question, you wrote about: Durbin Watson statistic, semivariogram and changepoint procedure. I'm a bit confused. If I use DW test, do I also have to use the other to confirm it? thanks –  Dail Aug 26 '11 at 21:35
@Dail I am neither recommending nor applying the DW procedure; I merely commented that this approach uses the same technique of exploring squared differences between successive residuals. The recommendation is to compute the sequence $\gamma(t)$ (should be just one line of R :-) and look for changepoints in it, either by graphing $\gamma(t)$ against $t$ or with a formal method (or both). –  whuber Aug 26 '11 at 21:41
@Irish Please see the preceding comment addressed to Dail: I am not applying the DW test, nor am I looking at an acf. –  whuber Aug 26 '11 at 21:42

volatility (visually non-constant variability) can arise from a number of sources. To name a few

1. A non-constant mean of the errors caused by unspecified deterministic variables yielding Pulses, Level Shifts, Seasonal Pulses and /or Local Time Trends ( i.e. an underspecified model )

2. Actual parameter dynamics over time reflecting statistically significantly different model parameters ( for the same model ) for different time intervals. This can be detected by incorporating a variant of the Chow Test which actually searches for and finds the points in time that parameters have been proven to be statistically significantly different thus suggesting an underspecified model.

3. An autprojective (autoregressive/moving average structure (ARIMA)) present in the residuals as a result of an omitted stochastic cause series which has been untreated thus suggesting an under-specified model.

4. The need for a Weighted Least Squares optimization also known as Generalized least Squares where the "excess variability" i.e. the variability above and beyond a Gaussian process has been untreated reflecting the need for "weights" to be optimally applied to the observations. This can be remedied by identifying time regions where the error variance has had Structural Change of or Deterministic Change thus suggesting an underspecified model.

5. The presence of a "variance" that is stochastically/dynamically changing over time according to some Garch Model thus suggesting an under-specified model.

If you actually post your Residuals , I will use commercially available software which I have involved in the development of to actually determine which of these remedies are suggested/needed by your data. If you don't want to actually share your data with the list you can send it my privately at [deleted].

In terms of doing if programatically using "R" , it might take you a while. By actually showing you how this can be done might motivate you to try and emulate/copy/duplicate and write your own.

Edit: Upon rereading the possible causes of "volatility" or non-randomness in the residuals I should also have mentioned:

1. If you have incorrectly used predictor variables by omitting needed lag in these variables then this omission can yield errors that have "volatility". It suggests that one capture any and all lags of the predictor variables ( if any ! ) into your currently under=specified equation.
-
Thank you so much for your detailed answer! I will prepare an email with the data –  Dail Aug 26 '11 at 16:59
@ IrishStat I sent you the email, did you receive it? ... with the last point you edited are you referring to the intercept of the regression? –  Dail Aug 26 '11 at 21:19
@Dail, IrishStat Bear in mind that SE is not for private correspondence or consulting. Limit your conversation to publicly available information, please. –  whuber Aug 26 '11 at 21:53
:dail No. For example I was referring to he case when you have predictor series such as volume to predict price and you include the effect of today's volume on today's price but omit the impact of yesterday's volume reflecting the importance of changes in volume on price. –  IrishStat Aug 27 '11 at 12:39
One implementation of this idea is the vis.test function in the TeachingDemos package for R.