On Thu, 19 Jul 2007, Johannes Fichtinger wrote:
first of all, thank you a lot for that great piece of software!
Glad you like it!
Now, I have some questions regarding the use of loops in gretl.
I have some many datasets in one gretl file like x1 y1 x2 y2 x3
y3 ... x80 y80, where x-y stands for a pair of variables such
that e.g. x1 is the independent, explanatory variable of y1, x2
explains y2 and so on.
1. First, I would like to run in a script a simple regression like:
loop i=1..80
ols $i+1 const $i
endloop
"$i+1" is not going to work here. If you need to refer to the
variables by number -- and they go, "x1" = 1, "y1" = 2, and so on
-- you can do this:
# run 8 regressions, yi on xi
loop for (i = 1; i <= 8; i += 2)
sprintf yvar "%d", i+1
ols @yvar 0 $i
end loop
The gretl 1.6.5 release doesn't support the "sprintf" command in
loops, but the current snapshot does:
http://ricardo.ecn.wfu.edu/pub/gretl/gretl_install.exe
the command gnuplot is not available in loop mode. This brings
me to my last question: Why are some commands not available in
loop mode? This behaviour was somehow surprising for me.
Some commands raise special complications in a loop context.
However, gnuplot is probably not one of these, so I'll probably
enable it, after some testing.
Allin Cottrell