huyiustc 发表于 2014-4-28 18:44 
刚好在做动态VaR的回测,也要用到滚动预测,可以把你查到的资料发我一份吗,或者给个滚动预测程序例子,不 ...
这是我的例子,希望能帮助到你
getSymbols("^GSPC", src = "yahoo",from="2000-01-01",to="2014-03-31")
p_GSPC_all=GSPC
r_GSPC_all=diff(log(p_GSPC_all$GSPC.Adjusted))
r_GSPC_all= r_GSPC_all[-1,]
ar_egarch_GSPC=ugarchspec(variance.model = list(model = "eGARCH",
garchOrder = c(1, 1)), mean.model = list(armaOrder = c(12, 0), include.mean = TRUE),
distribution.model = "sstd")
modelfit_GSPC=ugarchfit(spec=ar_egarch_GSPC,data=r_GSPC_all,out.sample=a)
forecast_GSPC_t=ugarchforecast(modelfit_GSPC, data =NULL, n.ahead = 1,
n.roll=a, out.sample =a)
VaR_GSPC_low=qsstd(0.05, mean = 0, sd = 1, nu = 5, xi = 1.5)*sigma(forecast_GSPC_t)+fitted(forecast_GSPC_t)