6
$\begingroup$

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. Residual Chart

$\endgroup$

3 Answers 3

8
$\begingroup$

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:

Residual volatility 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:

Smoothed residual volatility

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.

$\endgroup$
12
  • $\begingroup$ :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". $\endgroup$
    – IrishStat
    Aug 26, 2011 at 20:29
  • $\begingroup$ @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/… ? $\endgroup$
    – Dail
    Aug 26, 2011 at 21:28
  • $\begingroup$ @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 $\endgroup$
    – Dail
    Aug 26, 2011 at 21:35
  • $\begingroup$ @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). $\endgroup$
    – whuber
    Aug 26, 2011 at 21:41
  • $\begingroup$ @Irish Please see the preceding comment addressed to Dail: I am not applying the DW test, nor am I looking at an acf. $\endgroup$
    – whuber
    Aug 26, 2011 at 21:42
2
$\begingroup$

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.
$\endgroup$
4
  • $\begingroup$ Thank you so much for your detailed answer! I will prepare an email with the data $\endgroup$
    – Dail
    Aug 26, 2011 at 16:59
  • $\begingroup$ @ 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? $\endgroup$
    – Dail
    Aug 26, 2011 at 21:19
  • $\begingroup$ @Dail, IrishStat Bear in mind that SE is not for private correspondence or consulting. Limit your conversation to publicly available information, please. $\endgroup$
    – whuber
    Aug 26, 2011 at 21:53
  • $\begingroup$ :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. $\endgroup$
    – IrishStat
    Aug 27, 2011 at 12:39
0
$\begingroup$

One approach to test many of the assumptions at once is using visual tests:

Buja, A., Cook, D. Hofmann, H., Lawrence, M. Lee, E.-K., Swayne, D.F and Wickham, H. (2009) Statistical Inference for exploratory data analysis and model diagnostics Phil. Trans. R. Soc. A 367, 4361-4383 doi: 10.1098/rsta.2009.0120

This plots your residual plot among several others for which the assumptions are true. You then try to pick out the real plot, if the assumptions hold and the only thing going on in your plot is random variation then you will have a difficult time picking your plot from the random ones (you should not familiarize yourself with the plot before hand, or if you have, then have another person not familiar with your analysis try to find the plot that does not belong). If the assumptions are violated (strongly enough) then the real plot will be easy to distinguish.

One implementation of this idea is the vis.test function in the TeachingDemos package for R.

$\endgroup$
2
  • $\begingroup$ can I do it programmatically using R? thanks $\endgroup$
    – Dail
    Aug 26, 2011 at 16:09
  • $\begingroup$ You can program R to create the plots, but to identify the plot is the job of a human, that is the idea of the test, to see if a person can pick out the real data as being different. This allows you to pick up on violations that you might otherwise not have thought to test for, and shows the amount of "signal" that can occur just by chance. $\endgroup$
    – Greg Snow
    Aug 26, 2011 at 20:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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