Reputation: 137
I am trying to fir different GARCH models in R and compare them through the AIC value(the minimum one being the best fit). I have used a dataset and taken out the AIC through two methods.
Method 1: I took the data set for stock prices(closing data for s&p cnx nifty from 4 Jan 2010 to 9 Nov 2016, daily),took the log and then the difference and then through auto arima(on the difference of log values, let's call the data set as A) found out that the best fit is MA1 and then gotten the residuals' square using
Res2<- (MA1$residuals)^2
In method one, I have used the syntax
garchoutput <- garch(Res2,order=c(1,1))
CIC<-AIC(garchoutput)
It gives me an AIC value of -23682.50 . Used package 'tseries' for the same.
Method 2: I used another package namely 'rugarch' and then used the below syntax
spec <- ugarchspec(variance.model = list( garchOrder = c(1, 1),
submodel = NULL,
external.regressors = NULL,
variance.targeting = FALSE),
mean.model = list(armaOrder = c(0, 1),
external.regressors = NULL,
distribution.model = "norm",
start.pars = list(),
fixed.pars = list()))
garch <- ugarchfit(spec = spec, data = A, solver.control = list(trace=0))
garch
Here the data I put it in A and the model itself fits in GARCH(1,1) with ARIMA90,0,1) i.e, MA1.
The output I receive has a lot of data but it also has the AIC value
What I want to enquire is as to why there is the difference in the two values. Also, if someone could also explain to me how the package fgarch can be used instead of rugarch and the difference between the two, it will be highly beneficial.
Please let me know incase it is difficult to do the analysis because of the data availability. Apologies if the question is not properly framed.
Upvotes: 3
Views: 7598
Reputation: 365
This is maybe a bit late but this has been asked and answered on Cross Validated a while ago in this post or this post.
To summarize the above mentioned answers:
Some packages (e. g. fgarch
, rugarch
or rmgarch
) use a scaled version of the AIC, which is is basically the "normal" AIC divided by the length of the time series (usually denoted by n or N).
For the rugarch
package you can see the specification of the AIC here on page 23.
For your specific example you can compare the two by either:
multiplying the AIC from rugarch
with the length of your time-series
or
divide the AIC from the tseries
with the length of your time-series, like:
CIC = AIC(garchoutput)/length(Res2)
One more thing. As far as I know you don't need to square the residuals from your fitted auto.arima
object before fitting your garch-model to the data. You might compare two very different sets of data if you use squared reisiduals in your tseries
model and your log-returns in the rugarch
model.
Upvotes: 1