Am 09.01.2021 um 22:14 schrieb Sven Schreiber:
Am 09.01.2021 um 16:44 schrieb Allin Cottrell:
> we could support an array of strings variant, something like:
>
> strings R = defarray("b[1,2] = 0", "b[2,1] = 0")
> restrict $system
> strings R
> end restrict
>
> with the keyword "strings" guiding gretl's interpretation.
[Not the main point of this reply, but: wouldn't it be a problem that
normally "strings" is an alias for "genr", but here it's not? Of
course
the context resolves this, but still.]
Ah, that would be nice of course. I was also thinking ...
Here's another approach to helping a little to construct restrictions in
systems. The idea is that it's fairly difficult for the user to know
what variable position indices to put into the restriction syntax,
because in the system context using the identifiers of the variables is
not supported. So my idea is that you can use the names of the LHS and
the RHS variables (plus a lag number) in a natural way, and you get back
the two position numbers you need if you want to restrict the coefficent.
The relevant helper functions are in the attached file, and below are
some tested examples. Note that the helper function amend_sysbdl needs
to be run before the actually interesting call. (But only once per system.)
cheers
sven
<hansl>
include redsys-helpers.inp
open denmark
## example with var
list endo = diff(LRM LRY IBO)
var 2 endo -q
bundle bv = $system
amend_sysbdl(&bv, endo)
# the relevant interface line:
eval eqnvarindices(bv, "d_LRY", "d_LRM", 2)
## example with system
endo = LRM IBO
lags 3 ; endo
lists RHS = defarray( deflist(const, LRM_2), deflist(const,LRM,IBO_3) )
system method=ols
equations endo RHS
end system -q
bundle bsys = $system
amend_sysbdl(&bsys, endo,RHS)
# again the relevant interface line:
eval eqnvarindices(bsys, "LRM", "LRM", 2)
# and some wrong input yielding an error:
eval eqnvarindices(bsys, "LRM", "LRM", 3)
</hansl>