I am attempting to specify the following GARCH(1,1) model's in R (regressing realized volatility on trading volume).
RV = realized volatility V = trading volume
**RV = a + b*V + error
**error ~ N(0,h(t))
h(t) = c + d(error(t-1))^2 + dh(t-1) + e*V**
and
**RV = a + error
**error ~ N(0,h(t))
h(t) = b + c(error(t-1))^2 + dh(t-1) + e*V**
I am attempting this using the ugarchspec function in Rstudio using the following code, where volume has been specified as the external regressor in each case
spec <- ugarchspec(
variance.model = list(garchOrder = c(1,1)),
mean.model = list(armaOrder = c(0,0), include.mean = TRUE, external.regressors =
data.matrix(data[,2])),
distribution.model = "std"
)
GARCH <- garchFit(spec = spec, data = data[,3])
spec2 <- ugarchspec(
variance.model = list(garchOrder = c(1,1), external.regressors = data.matrix(data[,2])),
mean.model = list(armaOrder = c(0,0), include.mean = TRUE, external.regressors = NULL),
distribution.model = "std"
)
GARCH2 <- garchFit(spec = spec2, data = data[,3])
However, when I run the code, it returns no coefficient for the external regressor (volume). The other coefficients remain the same regardless of whether or not any external regressor is included.
Has anyone any idea of what's going wrong? Or of a better way to specify the two models so as to return a coefficient for volume?
Thanks :)