On Sat, 10 Dec 2011, Sven Schreiber wrote:
[Re. the new mechanism for specifying multiple equations
in one go for the "system" command]
Now I have tried to test and use this, but I don't know how to
construct
the semicolon-separated list in a loop (since in general I don't know
the number of equations in advance). Here's what I tried but that didn't
work (on current cvs):
<hansl>
open denmark
list lhs = IBO IDE LRM LRY
list allrhs = null
loop foreach i lhs
list rhs_$i = LRM(-1) # trivial example
list allrhs = allrhs ; rhs_$i # does this work?
endloop
system method=SUR
equations lhs allrhs
end system
</hansl>
I get the following error:
Command has insufficient arguments
If you do "list allrhs print" you'll see that it's not well formed,
the first sub-list being empty. But this works:
<hansl>
open denmark.gdt
list lhs = IBO IDE LRM LRY
list allrhs = const LRM(-1)
loop foreach i lhs
if i > 1
list rhs_$i = LRM(-1)
list allrhs = allrhs ; const rhs_$i
endif
endloop
system method=SUR
equations lhs allrhs
end system
</hansl>
BTW, I noticed that one year ago there was already a discussion
about
how to construct (SUR) systems in a script, see
http://lists.wfu.edu/pipermail/gretl-devel/2010-December/003042.html
We somehow seem to have forgotten about it in the meantime. Would that
approach still work, I haven't tried it so far?
Yes, I think that approach should still work. I never put it into
the official docs since I was hoping I could come up with something
better, but the code is still there.
Allin