Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Rolling regression GARCH volatility prediction

    Hello Statalisters,

    I have been attempting to run a rolling GARCH model that predicts variance without much success, and so assistance would be much appreciated. My most recent attempts to get the model working have resulted in variance predictions that are constant throughout the prediction period, and thus my attempt at rolling clearly has worked. Please find below my code:


    Code:
        //    Generate empty variables to fill
        gen t4=_n
        gen testing4 = .
        // Rolling Window of 200 obervations until the 500th observation
    quietly forvalues Date = 200/500 {
        if insample ==0 arch Returns, arch(1) garch(1)  
        //Predict the variance and fill in empty variable
        predict Yhat if t4==`Date', variance
        replace testing4 = Yhat if t4==`Date'
        drop Yhat
        }
    From reading across the forums there are multiple methods for rolling, and that this is the 'brute force' way. The dataset is quite long (I cut it down to 500 observations for conveneince whilst I figure this out), and so these regressions are quite time consuming, however given my limited Stata ability right now I would just like to get this method working and then investigate more efficient methods later.
    Overall the purpose of this code is for a project that tests the implications of changing the size of the estimation window on the accuracy of variance predictions.

    Kind regards,
    Connor
Working...
X