Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to extract AIC from uGARCHfit (rugarch package)

Tags:

r

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.
like image 654
JJRB Avatar asked Mar 05 '23 18:03

JJRB


1 Answers

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>
like image 116
Julius Vainora Avatar answered Mar 15 '23 05:03

Julius Vainora