[R] Extract AIC, BIC
Spencer Graves
spencer.graves at pdf.com
Sun Apr 23 16:20:06 CEST 2006
Which Garch function are you using? help.search("garch") identified
garch functions in fOptions, fSeries, and tseries. If you try
RSiteSearch("garch", "functions"), you might find others.
I just tried 'library(tseries)' and tried an example in
help("garch"). I modified this slightly to produce the following:
n <- 1100
a <- c(0.1, 0.5, 0.2) # ARCH(2) coefficients
e <- rnorm(n)
x <- double(n)
x[1:2] <- rnorm(2, sd = sqrt(a[1]/(1.0-a[2]-a[3])))
for(i in 3:n) # Generate ARCH(2) process
{
x[i] <- e[i]*sqrt(a[1]+a[2]*x[i-1]^2+a[3]*x[i-2]^2)
}
x <- ts(x[101:1100])
x.arch <- garch(x, order = c(0,2)) # Fit ARCH(2)
summary(x.arch) # Diagnostic tests
logLik(x.arch)
AIC(x.arch)
Getting the BIC would be slightly more difficult, but the following
would lead you to code that you should be able to modify to get what you
want:
> class(x.arch)
[1] "garch"
> methods(class="garch")
[1] coef.garch* fitted.garch* logLik.garch* plot.garch*
[5] predict.garch* print.garch* residuals.garch* summary.garch*
Non-visible functions are asterisked
> methods("AIC")
[1] AIC.default* AIC.logLik*
Non-visible functions are asterisked
> getAnywhere("AIC.default")
> getAnywhere("AIC.logLik")
hope this helps,
spencer graves
Sumanta Basak wrote:
> Hi All,
>
> How can extract AIC,BIC from a fitted Garch model?
>
> --
> SUMANTA BASAK.
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
More information about the R-help
mailing list