在R中回测garch

时间:2019-10-06 04:32:32

标签: r time-series arima quantitative-finance

我正在尝试使用ugarchroll对我的arch模型进行回测,但是我收到此警告消息

“警告消息: 在.rollfdensity(spec = spec,data = data,n.ahead = n.ahead,Forecast.length = Forecast.length,:

存在未收敛的估计窗口...使用不同的求解器参数重新提交对象。”

这是我的代码

library(quantmod)
library(rugarch)

getSymbols("SPY")
rets=ROC(SPY$SPY.Close)
tgarch = ugarchspec(mean.model = list(armaOrder = c(1, 1)), 
                    variance.model = list(model = "sGARCH"),
                    distribution.model = "std")
garchroll<-ugarchroll(tgarch, data = rets,n.start =500, 
                      refit.window="window", refit.every =200)




1 个答案:

答案 0 :(得分:0)

应用ROC()时,第一个条目变为NA。因此,当您应用rets时,要从ugarchroll()中排除它。因此,

garchroll <- ugarchroll(tgarch, data=rets[-1, ], n.start=500, 
                        refit.window="window", refit.every=200)