我使用rugarch软件包拟合了egarch模型,并希望从拟合模型中提取AIC。我该怎么办?
我尝试了两个代码
fittedmodel@fit$infocriteria[1]
和fittedmodel@fit$criteria[1]
但他们都不起作用
egarchspec=ugarchspec(variance.model = list(model = "eGARCH", garchOrder = c(1,1)),distribution.model="sged")
fittedmodel<-ugarchfit(egarchspec, data=pregfc$RAU)
fittedmodel@fit$infocriteria[1]
结果为NULL。
答案 0 :(得分:0)
我们可以像这样使用infocriteria
data(dmbp)
spec <- ugarchspec()
fit <- ugarchfit(data = dmbp[,1], spec = spec)
infocriteria(fit)
#
# Akaike 1.124508
# Bayes 1.141493
# Shibata 1.124490
# Hannan-Quinn 1.130749
infocriteria(fit)[1]
# [1] 1.124508
如果您希望手动进行更多操作或查看背后的公式,请参见
getMethod("infocriteria", "uGARCHfit")
这导致
rugarch:::.information.test
# function (LLH, nObs, nPars)
# {
# AIC = (-2 * LLH)/nObs + 2 * nPars/nObs
# BIC = (-2 * LLH)/nObs + nPars * log(nObs)/nObs
# SIC = (-2 * LLH)/nObs + log((nObs + 2 * nPars)/nObs)
# HQIC = (-2 * LLH)/nObs + (2 * nPars * log(log(nObs)))/nObs
# informationTests = list(AIC = AIC, BIC = BIC, SIC = SIC,
# HQIC = HQIC)
# return(informationTests)
# }
# <bytecode: 0x10e316fc0>
# <environment: namespace:rugarch>