我想估计 Realized GARCH (1,1) 模型。在我的数据集中,我有以下时间序列:
ret <- replicate(1, rnorm(100))
RV <- replicate(1, rnorm(100))
date <- c(1:100)
我执行以下操作:
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])
在最后一行之后出现错误:
我尝试使用 xts 包描述中给出的示例将我的 RV 矩阵转换为 xts 对象:
require(xts)
rownames(RV) <- date
matrix_xts <- as.xts(RV,dateFormat='Date')
或者
df_xts <- as.xts(as.data.frame(RV))
在这两种情况下,错误都是字符串不是标准的明确格式
那么,我应该怎么做才能为 realizedVol 规范制作合适的 xts 对象格式?