0

I am using the rugarch package to forecast stock volatility. I want to add an external regressor and lagged versions of it if possible. The external.regressors element requires the input to be in a matrix and if I added a lagged variable it would have NA's in it, and so it would not run.

Currently, I have:

external.regressors=matrix(myts$ext_reg)

whereby myts is a time series data frame. I tried adding a one-lagged version of ext_reg into it but I am just not sure how to do that. I tried:

external.regressors=matrix(myts$ext_reg, myts$ext_reg_1)

where ext_reg_1 was produced using the Lag function from the Hmisc package. This resulted in this error:

# Error in h(simpleError(msg, call)) : 
# error in evaluating the argument 'variance.model' in selecting a method for function 'ugarchspec': invalid 'nrow' value (too large or NA)

How can I format the external regressors in order to be able to be passed into external.regressors?

L Tyrone
  • 1,268
  • 3
  • 15
  • 24
a_ssis
  • 7
  • 1

0 Answers0