fGarch: how to use garchFit() in loop?
Yohan Chalabi
chalabi at phys.ethz.ch
Mon Aug 16 13:09:35 CEST 2010
On Aug 16, 2010, at 11:21 AM, Marius Hofert wrote:
> Hallo fGarch expeRts,
>
> Ich wuerde gerne Garch Modelle verschiedener Ordnung in einer Schleife fitten. Was ist bei folgendem Code falsch?
>
> library(fGarch)
> spec <- garchSpec(model = list(alpha = 0.1, beta = c(0.4, 0.4)))
> Xt <- garchSim(spec, n = 100)
> x <- list()
> for(q in 1:3){
> print(q)
> x[q] <- list(garchFit(~garch(1,q), data = Xt, trace = FALSE))
> }
library(fGarch)
spec <- garchSpec(model = list(alpha = 0.1, beta = c(0.4, 0.4)))
Xt <- garchSim(spec, n = 100)
x <- list()
for(q in 1:3){
print(q)
x[q] <- list(garchFit(substitute(~garch(1,beta), list(beta =q)) , data = Xt, trace = FALSE))
}
should do the trick
HTH,
Yohan
>
> Herzliche Gruesse
>
> Marius Hofert
>
> Ps: s. auch http://r.789695.n4.nabble.com/fGarch-how-to-use-garchFit-in-loop-td2326209.html
>
>
>
> ETH Zurich
> Dr. Marius Hofert
> Department of Mathematics
> HG G 37.2
> Rämistrasse 101
> 8092 Zurich
> Switzerland
>
> marius.hofert at math.ethz.ch
> +41 44 632 24 23 phone
> http://www.math.ethz.ch/~hofertj/
>
> _______________________________________________
> Rmetrics-core mailing list
> Rmetrics-core at r-project.org
> https://stat.ethz.ch/mailman/listinfo/rmetrics-core
>
--
PhD candidate
Swiss Federal Institute of Technology
Zurich
www.ethz.ch
More information about the Rmetrics-core
mailing list