Solved – Cannot replicate the AIC in a GARCH model

aicgarchlikelihoodr

First I am confused what the ugarchfit in the rugarch package means by likelihood versus loglikelihood. In the complete ugarchfit output it says "log-likelihood". But when extracting the likelihood by the function likelihood() we get the same number. Here http://www.inside-r.org/packages/cran/rugarch/docs/getspec it is stated that this latter function should extract the likelihood, not the loglikelihood.

I tried to find out the truth by replicating the AIC – since I know that this uses the loglikelihood. AIC = 2k-2*ln(Likelihood). But I could not replicate the AIC as estimated by the ugarchfit-function at all. No matter if I interpret the result from above as a likelihood or as a log-likelihood value.

Where is the error in my thinking???

require('rugarch')
require('rmgarch')
data(dji30retw)
dat <- dji30retw$AA

spec1 <- ugarchspec(
     variance.model = list(model = "sGARCH", garchOrder = c(1,1), submodel = NULL)
     , mean.model = list( armaOrder =c(0,0) ) , distribution.model = "norm" )

garch1 <- ugarchfit(spec=spec1, data=dat ); garch1
# here it says:          "LogLikelihood : 1901.706"

l1 = likelihood(garch1); l1
# again 1901.706, but this should be the likelihood???

# extract the AIC
infocriteria(garch1)
# gives: AIC = -3.326390

# Calculate AIC manually: AIC = 2k-2*ln(Likelihood)  where k= number of parameters
# we've got 4 parameters here: alpha1, beta1, mu, omega

2*4-2*l1
# -3795.412   ...wrong result!

2*4-2*log(l1)
# -7.101013   ...wrong result!

Best Answer

The formula for the AIC can be found on page 23 in here. See below:

> (-2*l1)/length(dat)+2*(length(garch1@fit$coef))/length(dat)
[1] -3.32639
Related Question