I have a model which takes time series stock return data and categorises by the size of the return. The sizes of the categories are defined by number of standard deviations. I currently use the cut function to do this, my code is:
Division <- cut(return, br=c(min(return),-2*sd(return),-1*sd(return),-0.5*sd(return),0*sd(return),0.5*sd(return),1*sd(return),2*sd(return),max(return)))
This works fine and everything seems ok. So the next thing I'd like to do is treat these divisions as dummy variables in an EGARCH model. I simply thought of specifying in the normal way but this does not work. The code I use is:
spec = ugarchspec(variance.model = list(model = "eGARCH", garchOrder = c(2,2)), mean.model = list(armaOrder = c(0,0), include.mean = TRUE))
fit = ugarchfit(spec = spec, data = Division)
The error I get is:
Error in if (mean(data) == 0) { : missing value where TRUE/FALSE needed
Any help on what I am trying to do would be appreciated.