在 R 中构建 GARCH 模型
Kris Boudt
Professor of finance and econometrics
那么,常数均值、标准 GARCH(1,1)、Student-t 分布是合适的设定:
garchspec <- ugarchspec(mean.model = list(armaOrder = c(0, 0)),
variance.model = list(model = "sGARCH"),
distribution.model = "std")
setfixed()setbounds()设定与估计
garchspec <- ugarchspec(mean.model = list(armaOrder = c(0, 0)),
variance.model = list(model = "sGARCH"),
distribution.model = "std")
garchfit <- ugarchfit(data = EURUSDret, spec = garchspec)
估计结果
coef(garchfit)
mu omega alpha1 beta1 shape
-3.562136e-05 8.005123e-08 3.097322e-02 9.674496e-01 8.821902e+00
alpha1 = 0.05 和 shape = 6:在估计中固定它们。ugarchspec 对象使用 setfixed() 方法setfixed(garchspec) <- list(alpha1 = 0.05, shape = 6)
结果
garchfit <- ugarchfit(data = EURUSDret, spec = garchspec)
coef(garchfit)
mu omega alpha1 beta1 shape
-4.142922e-05 2.061772e-07 5.000000e-02 9.489622e-01 6.000000e+00
setbounds() 方法对参数施加此类界约束。setbounds(garchspec) <- list(alpha1 = c(0.05, 0.2), beta1 = c(0.8, 0.95))
利用已有信息:
让 GARCH 动态更贴近现实:
sd(EURUSDret) # returns a value of 0.006194049

ugarchspec() 的 variance.model 中将参数 variance.targeting = TRUE:garchspec <- ugarchspec(mean.model = list(armaOrder = c(0,0)),
variance.model = list(model = "sGARCH",
variance.targeting = TRUE),
distribution.model = "std")
garchfit <- ugarchfit(data = EURUSDret, spec = garchspec)
all.equal(uncvariance(garchfit), sd(EURUSDret) ^ 2, tol = 1e-4)
TRUE
在 R 中构建 GARCH 模型