Am 28.12.2014 um 20:37 schrieb Allin Cottrell:
> Arrays of strings are not the right tool for the job here; you
should use
> lists. Suppose your "explainedVars" are all put in a list named Y and your
> "explanatoryVars" in a list named X. Then this would do the analysis:
>
> <hansl>
> loop foreach i Y -q
> loop foreach j X -q
> list reglist = Y[i] 0 X[j]
> ols reglist
> endloop
> endloop
> </hansl>
(Minor point: I have to say, putting both the LHS _and_ the RHS into one
single list for the ols command feels a little like an abuse of the
syntax and I'm surprised gretl's not complaining about wrong number of
arguments or something similar.)
The use of the variable "reglist" in the inner loop above ought to
be unnecessary, but up till now it has been required due to a little
bug in the interpreter. That's now fixed in CVS and snapshots, so
one can simply do
ols Y[i] 0 X[j]
This is interesting, I didn't know that indexing into a list like this
is possible. It doesn't seem to be documented, or is it?
According to what I've learned about the 'loop foreach' construction, I
would have done the following instead, which feels more natural to me:
ols $i 0 $j
cheers,
sven