[R-SIG-Finance] Estimating ARMA-GRACH model through a loop

Martin Becker martin.becker at mx.uni-saarland.de
Wed Apr 8 09:30:38 CEST 2009


Try this:

fit <- garchFit(substitute(~arma(p,q)+garch(1,1),list(p=p,q=q)), data)

  Martin


Mohammad Sabr wrote:
> Good day everyone,
>  
> I am trying to estimate an ARMA-GARCH model through a loop. The main function in the loop is garchFit from the fGrach package. I wrote the following loop
>  
> for (i in 1:5) {
> for (j in 1:5) {
> p=i-1
> q=j-1
> p=1
> q=1
> fit = garchFit(~arma(p,q)+garch(1,1), data))
> }
> }
>  
> The objective of this loop is to enable me to extract some values from the fitted model without have to run it every time manually. The problem with this loop is that the garchFit function does not recognize the values of "p" and "q" in the ARMA specification. When I try to run the loop I get the following error message:
>  
> [1] "data" "p"    "q"   
> [1] "data"
> Error in .garchArgsParser(formula = formula, data = data, trace = FALSE) : 
> Formula and data units do not match.
>
>  
> However, when I substitute p and q with 1 for example, the model is executed without any problem.
>  
> Did any one encounter such a problem or knows the solution to this problem. 
>  
> Thanks in advance,
> 	[[alternative HTML version deleted]]
>
>   
> ------------------------------------------------------------------------
>
> _______________________________________________
> R-SIG-Finance at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only.
> -- If you want to post, subscribe first.

-- 
Dr. Martin Becker
Statistics and Econometrics
Saarland University
Campus C3 1, Room 206
66123 Saarbruecken
Germany



More information about the R-SIG-Finance mailing list