On 02/05/2024 11:00, Rigoberto Perez Suarez wrote:
Hello,
I have been a Gretl user for many years, and I would like to thank you
for the important development you have promoted during this time.
We have observed a typo since 2023b version when calculating rates using
a list.
More specifically, for the individual series we compute without problem:
T=round(10000*(x/x(-1)-1))/100
However, when we use a list:
list l=y1 y2 y3
list l_t=null
loop foreach x l
genr t$x=round(10000*(l.$x/l.$x(-1)-1))/100
list l_t+= t$x
endloop
This code does not work properly. It is necessary to include a new
parenthesis in the quotient (l.$x/l.$x(-1)) (which would not be
necessary) to perform the operation correctly.
Uhm, the syntax above works fine here, with respect to the number of
parentheses. However, it seems that we do have another problem: the
script below produces bogus results, which are evident if you run it
(the series "foo" and "ty1" should be identical).
<hansl>
nulldata 20
setobs 1 1 --special
y1 = uniform()
list l = y1
genr foo = round(10000*(y1/y1(-1)-1))/100
list l_t=null
loop foreach x l
genr t$x=round(10000*(l.$x/l.$x(-1)-1))/100
list l_t += t$x
endloop
print y1 foo ty1 --byobs
</hansl>
This is due to the fact that the "listname.$x" idiom is _not_ valid
outside functions: it's a special provision to ensure that series names
coming from the outside level of execution don't clash with
locally-defined series.
I think this should be intercepted somehow, and possibly an error should
be flagged.
-------------------------------------------------------
Riccardo (Jack) Lucchetti
Dipartimento di Scienze Economiche e Sociali (DiSES)
UniversitĂ Politecnica delle Marche
(formerly known as UniversitĂ di Ancona)
r.lucchetti(a)univpm.it
http://www2.econ.univpm.it/servizi/hpp/lucchetti
-------------------------------------------------------