Hi,
while I still have to deliver on my semi-commitment to come up with some
documentation for system estimation (someday...), here's a suggestion to
append the existing explanation in the reference for the 'system' command:
<to append to the 'system' doc>
Gretl/hansl also allows to define the system in a programmatic way. This
is useful if the precise specification of the system depends on some
input parameters that are not known in advance, but are given when the
script is actually run. (This feature was added in version 1.9.7)
The relevant syntax is given by the 'equations' keyword (note the
plural), which replaces the block of 'equation' lines in the standard
form. An 'equations' line requires two list arguments: The first list
must contain all series on the left-hand side of the system. Thus the
number of elements in this first list determines the number of equations
in the system. The second list is a "list of lists", which is a special
variant of a list in gretl/hansl. That is, for each equation of the
system you must provide a list of right-hand side variables, and the
lists for all equations must then be joined by assigning them to another
list object; in that assignment, they must be separated by a semicolon.
Here is an example for a two-equation system:
list syslistoflists = equ1reglist ; equ2reglist
Therefore, specifying a system generically in this way just involves
building the necessary list arguments.
Example:
open denmark
list alllhs = LRM LRY
list joinedrhs = const LRM(-1) IBO(-1) IDE(-1) ; const LRY(-1) IBO(-1)
system method=ols
equations alllhs joinedrhs
end system
Another issue when programming a multiple-equation system in a flexible
way is how to save and reuse a system specification inside a function.
(You cannot use the "<-" name assignment syntax there, because that
would alter the session icon view, and that is not allowed from inside
functions.) Instead you simply have to omit the "method=estimator"
specifier from the 'system' line. Then the 'system ... end system' block
creates an anonymous system which you can afterwards address with the
'estimate' and 'restrict' commands by using the '$system'
accessor.
Only the system which was specified last can be accessed in this way.
Example:
function void anonsys(series x, series y)
system
equation x const
equation y const
end system
estimate $system method=ols
estimate $system method=sur
restrict $system
b[1,1]=1
end restrict
estimate $system method=ols
end function
open denmark
anonsys(LRY,LRM)
</to append to the 'system' doc>
cheers,
sven