1

I want to estimate Realized GARCH (1,1) model. In my dataset I have the following time series:

ret <- replicate(1, rnorm(100))
RV <- replicate(1, rnorm(100))
date <- c(1:100)

I do the following:

install.packages("rugarch")
library(rugarch)
attspec <- ugarchspec(mean.model = list(armaOrder = c(0, 0), include.mean = FALSE), variance.model = list(model = 'realGARCH', garchOrder = c(1, 1)))
fit <- ugarchfit(spec=attspec, data=ret, solver = 'hybrid', realizedVol = RV[, 1])

After the last line I get an error: realizedVol must be an xts object

I tried to convert my RV matrix into xts object using the examples given in the description of the xts package:

require(xts)
rownames(RV) <- date
matrix_xts <- as.xts(RV,dateFormat='Date')

or

df_xts <- as.xts(as.data.frame(RV))

In both cases the error is character string is not in a standard unambiguous format

So, what should I do in order to make a suitable format of xts objest for the realizedVol specification?

glarys
  • 131
  • 1
  • 2
  • 11

1 Answers1

3

You should have both ret and RV as xts objects, they can be initialized in the following way:

times<-Sys.time()+date
ret_xts<-xts(ret,order.by = times)
RV_xts <- xts(RV,order.by = times)

and then you can successfully call:

fit <- ugarchfit(spec=attspec, data=ret_xts, solver = 'hybrid', realizedVol = RV_xts)
adaien
  • 1,932
  • 1
  • 12
  • 26
  • What do these error messages mean: Warning messages: 1: In log(realized[1:length(data)]) : NaNs produced 2: In .makefitmodel(garchmodel = "realGARCH", f = .realgarchLLH, T = T, : rugarch-->warning: failed to invert hessian – glarys Apr 07 '16 at 01:57
  • It is diagnostic related to the fit – adaien Apr 07 '16 at 07:22