I fitted an egarch model using rugarch package and would like to extract the AIC from the fitted model. How do I do that?
I tried two codes
fittedmodel@fit$infocriteria[1]
and fittedmodel@fit$criteria[1]
but neither of them work
egarchspec=ugarchspec(variance.model = list(model = "eGARCH", garchOrder = c(1,1)),distribution.model="sged")
fittedmodel<-ugarchfit(egarchspec, data=pregfc$RAU)
fittedmodel@fit$infocriteria[1]
The result is NULL.
We may use infocriteria
as in
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
If you wish to do that more manually or to see the formulas behind, see
getMethod("infocriteria", "uGARCHfit")
which leads to
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>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With