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]]

