看来这个问题还没有解决,不是吗?
可重复的代码:
install.packages('quantmod')
install.packages('rugarch')
require(quantmod)
getSymbols('GLD', from = '1950-01-01')
dx <- na.omit(ClCl(to.weekly(GLD)))
require(rugarch)
spec <- ugarchspec(variance.model = list(model = 'sGARCH', garchOrder = c(1,1)),
mean.model = list(armaOrder = c(1,0), include.mean = TRUE),
distribution.model = 'norm')
Residuals <- residuals(ugarchfit(spec = spec, data = dx))
tail(cbind(Residuals, dx))
上一个命令返回以下内容:
2013-04-11 -0.06094691 NA
2013-04-11 NA -0.05798050
2013-04-18 -0.06408317 NA
2013-04-18 NA -0.05890934
2013-04-22 0.00519109 NA
2013-04-22 NA 0.01040821
我的sessionInfo()
:
> sessionInfo()
R version 3.0.0 (2013-04-03)
Platform: x86_64-w64-mingw32/x64 (64-bit)
locale:
[1] LC_COLLATE=Italian_Italy.1252 LC_CTYPE=Italian_Italy.1252 LC_MONETARY=Italian_Italy.1252
[4] LC_NUMERIC=C LC_TIME=Italian_Italy.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] quantmod_0.4-0 TTR_0.22-0 xts_0.9-3 zoo_1.7-9
[5] Defaults_1.1-1 rugarch_1.2-2 RcppArmadillo_0.3.810.0 Rcpp_0.10.3
loaded via a namespace (and not attached):
[1] grid_3.0.0 KernSmooth_2.23-10 ks_1.8.12 lattice_0.20-15 nloptr_0.8.9
[6] numDeriv_2012.9-1 parallel_3.0.0 Rsolnp_1.14 spd_1.9 tools_3.0.0
[11] truncnorm_1.0-6