如何将我的GARCH模型拟合到R中的时间序列?

时间:2018-11-17 13:10:18

标签: r

我对R完全陌生,我正在尝试开发gjr-Garch(1,1)来预测政府债券的收益率。

所以我用以下方式指定了模型:

garch_test <- ugarchspec(variance.model = list(model = "gjrGARCH", garchOrder = c(1,1)),
                         mean.model = list(armaOrder = c(0, 0)), 
                         distribution.model = "std")

,并希望将其拟合为以下数据集:

garch_test_fit <- ugarchfit(spec = garch_test, data = Obs_per_parkinson_var)

但是我收到错误消息:

  

.extractdata(data)中的错误:(列表)对象无法强制执行   输入“ double”

我的数据包含债券的日期和方差,类别为:"tbl_df" "tbl" "data.frame"

有人可以帮我吗?

1 个答案:

答案 0 :(得分:0)

#If the ACF of your data shows that your data has general autoregressive conditional heteroskedasticity then use the code below:
install.packages("tseries")
library(tseries)
your.garch.model <- garch(data = Obs_per_parkinson_var, order=c(1,1), grad = "numerical", trace = FALSE)