r包fgarch中的标准化残差

时间:2015-12-04 14:01:11

标签: r time-series

我在R中使用fGARCH包以使ARMA_GARCH(1,1)模型适合时间序列。我想提取标准化残差,意味着残差除以相应的每日波动率估计。我尝试了一些事情

res <- residuals(m1, standardize=FALSE)
vol <- volatility(m1)
stand.res <- res/vol

stand.res <- residuals(m1, standardize=TRUE)

如果我绘制两个结果,它们彼此不同。那是为什么?

非常感谢。

1 个答案:

答案 0 :(得分:1)

我有类似的问题;请考虑:

rm(list=ls(all=TRUE))
library(fGarch)
set.seed(4)
x <- runif(6587, -0.10, 0.10)
gfit <- garchFit(formula = ~ garch(2,2), cond.dist = "std", data = x, include.shape=TRUE, trace=FALSE)

condVar = gfit@h.t
resid <- (x / sqrt(condVar)); 
tail(resid) # Standardized Residuals
#[1] -0.4201041 -0.8342208  1.5639541  1.0237848 -0.1779349 -0.7820030

#or

tail(x/ gfit@sigma.t)
#[1] -0.4201041 -0.8342208  1.5639541  1.0237848 -0.1779349 -0.7820030

VS

tail(residuals(gfit, standardize = TRUE))
#[1] -0.4156200 -0.8297368  1.5684382  1.0282689 -0.1734509 -0.7775190
相关问题