在 R 中构建 GARCH 模型
Kris Boudt
Professor of finance and econometrics
基于已估计的 GARCH 模型,我们有:

实现
e <- residuals(tgarchfit)
mean(e ^ 2)
GARCH 模型得到:

实现
e <- residuals(tgarchfit)
d <- e ^ 2 - sigma(tgarchfit) ^ 2
mean(d ^ 2)
tgarchspec <- ugarchspec(mean.model = list(armaOrder = c(0, 0)),
variance.model = list(model = "sGARCH", variance.targeting = TRUE),
distribution.model = "std")
tgarchfit <- ugarchfit(data = EURUSDret, spec = tgarchspec)
# 计算均值的均方预测误差
e <- residuals(tgarchfit) ^ 2
mean(e ^ 2) # 3.836205e-05
# 计算方差的均方预测误差
d <- e ^ 2 - sigma(tgarchfit) ^ 2
mean(d ^ 2) # 5.662366e-09
likelihood(tgarchfit) # returns 18528.58
与其他模型比较分析:
# 复杂模型,参数更多
flexgarchspec <- ugarchspec(mean.model = list(armaOrder = c(1, 0)),
variance.model = list(model = "gjrGARCH"),
distribution.model = "sstd")
flexgarchfit <- ugarchfit(data = EURUSDret, spec = flexgarchspec)
likelihood(flexgarchfit) # returns 18530.49
注意:我们使用样本内评估,估计样本与评估样本相同。
过拟合风险:
过拟合是指选择过于复杂的模型,它在用于估计的样本上拟合良好,但对样本外的未来收益表现不佳。
信息准则 = - 似然 + 惩罚(参数个数)
经验法则:
选择信息准则最低的模型。
方法 infocriteria() 输出不同惩罚下的信息准则。
infocriteria(tgarchfit)
out
Akaike -7.468081
Bayes -7.462833
Shibata -7.468083
Hannan-Quinn -7.466241
`
解读需与其他模型的信息准则比较。
tgarchspec <- ugarchspec(mean.model = list(armaOrder = c(0, 0)),
variance.model = list(model = "sGARCH", variance.targeting = TRUE),
distribution.model = "std")
tgarchfit <- ugarchfit(data = EURUSDret, spec = tgarchspec)
length(coef(tgarchfit)) # only 5 parameters
likelihood(tgarchfit) # equals 18528.58
flexgarchspec <- ugarchspec(mean.model = list(armaOrder = c(1, 0)),
variance.model = list(model = "gjrGARCH"), distribution.model = "sstd")
flexgarchfit <- ugarchfit(data = EURUSDret, spec = flexgarchspec)
length(coef(flexgarchfit)) # we now have 8 parameters
likelihood(flexgarchfit) # 18530.49: likelihood increased
似然越高越好。信息准则越低越好。
infocriteria(tgarchfit) # 简单模型
Akaike -7.468435
Bayes -7.464499
infocriteria(flexgarchfit) # 复杂模型
Akaike -7.467239
Bayes -7.456742
此处信息准则最低的是简单模型,应优先选用。
tgarchfit <- ugarchfit(data = msftret, spec = tgarchspec)
flexgarchfit <- ugarchfit(data = msftret, spec = flexgarchspec)
infocriteria(tgarchfit)
Akaike -5.481895
Bayes -5.477833
infocriteria(flexgarchfit)
Akaike -5.489087
Bayes -5.478255
此处信息准则最低的是复杂模型,应优先选用。
在 R 中构建 GARCH 模型