Hi,
I'm trying to use the regls() function (from the regls addon) inside my
own hansl function. In my function I'm creating a list "Xw" which I then
pass as regressors to the called regls().
In this situation I'm getting an error message from regls's internal
function outer_series_id -- for convenience, here's what the function
looks like:
<hansl-regls>
function list outer_series_id (const string arg)
list L
loop i=1..$nvars
if varname(i) == arg
L = {i}
break
endif
endloop
return L
end function
</hansl-regls>
The error message says:
"'if'-Auswertungsfehler
if ak
*** error within loop in function outer_series_id
if varname(i) == arg
called by function regls
*** error in function regls, line 193
"
I think I've diagnosed the problem to be that $nvars is much much larger
than the number of elements in the list Xw (+1 for the dependent
variable), and that varname(i) at some point throws an error because of
that.
If I replace the if-line above with the following two lines, then
everything seemingly runs OK:
catch string vname = varname(i)
if !$error && vname == arg
I'm not sure if the use of $nvars in outer_series_id is a bug on the
regls side, or if there's a bug with gretl concerning which sub-parts of
the dataset (which series) are available in a nested function call here.
This is with gretl 2022a (no snapshot) on Windows.
cheers
sven