What is the proper formatting of the variable provided to external.regressors = ..? My data looks like this:
regressor dependent
2008-01-04 3 0.0243990059
2008-01-08 3 0.0057341705
2008-01-09 3 0.0047333058
2008-01-10 3 0.0003631741
2008-01-11 3 -0.0019384547
2008-01-14 3 -0.0016992358
I am using the Rugarch package to estimate an ARMA(2,0)-GARCH(1,1) process with an external regressor in both the mean and varince. As (of course) I am dealing with the Time series, my data is formatted as zoo.
If I provide the zoo variable as here:
garch.spec <- ugarchspec(
variance.model = list(model="sGARCH", garchOrder = c(1,1),
external.regressors = regressor),
mean.model = list(armaOrder = c(2, 0), include.mean = TRUE),
)
I get the following error:
Error in modelinc[15] <- dim(variance.model$external.regressors)[2] :
replacement has length zero
If I, instead specify the regressors as external.regressors = as.matrix(coredata(regressor)) The error doesn't show up and I am able to estimate the model with
ugarchfit(garch.spec, dependent)
Where dependent is a zoo variable. The results, however, don't make sense.
I believe I don't get how the datatypes work here. I believe garch should be able to work with zoo files and have read the package description but did not find anything helpful. Any suggestions, please?