Dear all,
I think it is a very good proposal.
Also, I find new functions
square() and seasonals() very useful
It would be nice to have a function creating
list of dummies for a discrete variable
Oleh
22 вересня 2015, 10:51:24, від "Sven Schreiber" <svetosch(a)gmx.net>:
Hi,
I propose to overload the lags() function to accept not only a scalar
lag value, but alternatively a vector/matrix where the elements specify
which lags we want in the returned list.
Here's a hansl function that does what I have in mind:
function list getCertainLags( matrix idx, const list inp, bool bylag[0])
# returns a list with those lags of 'inp' specified by 'idx' elements
idx = vec(idx) # ensure col vector
list out = null
loop i=1..rows(idx)
lag = idx[i]
list temp = lags(lag, inp, bylag)
# watch out for the special case of lag 1
list templess1 = lag==1 ? null : lags( lag - 1, inp, bylag)
list out = out || (temp - templess1)
endloop
return out
end function
And then I also have an unrelated and more fundamental feature
suggestion: How about extending the foreach loop to also cover matrices
and perhaps even arrays? So instead of the common thing:
loop i=1..rows(inputvector)
v = inputvector[i]
...
one would do:
loop foreach v inputvector
...
and similarly for arrays.
This is of course pure syntactic sugar -- and I also admit that this
feels very pythonic, but I think it's not only present in Python.
Don't know how difficult it would be to implement. After all, currently
foreach is only for internal gretl strings.
thanks,
sven
_______________________________________________
Gretl-devel mailing list
Gretl-devel(a)lists.wfu.edu
http://lists.wfu.edu/mailman/listinfo/gretl-devel