[R-SIG-Finance] Problems using garchFit() in package fseries

Stefan Westermair swestermair at gmx.net
Tue Aug 22 19:10:07 CEST 2006


Dear list members, 

how can i make the garchFit() function accept variables in the formula.mean or formula.var expressions?
I was trying to run something like the following (shorter but produceses the same error message) example:

> my_Garch <- function(data,p,q) {
+ fit <- garchFit(series=data, formula.var= ~garch(p,q))
+ return(fit)
+ }

##simulate testdata  and run the function

> testdata <- garchSim(n=1000)@.Data
> testfit <- my_Garch(testdata,1,2)

##produced the following error message

Fehler in if (p + q == 0) stop("Misspecified GARCH Model: Both Orders are zero!") : 
        Fehlender Wert, wo TRUE/FALSE nötig ist
Zusätzlich: Warning message:
NAs durch Umwandlung erzeugt 

It seems that .garchInitSeries reads the parameter from the formula.var expression and the then checks for positivity. In my case not "1" and "2" but "p" and "q" were read (?).

Did anybody ever try to use variables in the garchFit() function?  I am intending to fit GARCH models for several parameter constellations and then select the best fit according to some information criterion.

Thanks a lot in advance,

Stefan

-- 
Stefan Westermair
Schülinstraße 13/1
89073 Ulm
swestermair at gmx.net



More information about the R-SIG-Finance mailing list