Dear Riccardo, Kehl and Guilherme, I was looking for something simple. The option "loop for (n=6; n<=24; n*=2)" worked just fine. But in my humble opinion the option "loop for (n=6; n=12; n=24)" should work too, but this is not a big deal ;-)
Thank you so much! Um abraço, Henrique Em 25 de maio de 2010 17:45, Hélio Guilherme <helioxentric(a)gmail.com>escreveu: > Hi Henrique, > > I believe that this does what you want: > loop for (n=6; n<=24; n*=2) --quiet > > No other simple options. > > > On Tue, May 25, 2010 at 8:53 PM, Henrique Andrade < > henrique.coelho(a)gmail.com> wrote: > >> Dear Riccardo, Kehl and Artur, >> >> Thanks a lot for your help! I'd tried all the options you gave me and >> my final script looks like this: >> >> <script> >> scalar n=0 >> loop for (n=6;n<=24;n=n*2) --quiet >> scalar m = $T - n + 1 >> loop j=2..nelemY --quiet >> matrix R$n_$j = zeros(m,1) >> loop i=1..m --quiet >> loop c=1..n --quiet >> row = i + n - c >> R$n_$j[i] += r$j[row, c] >> endloop >> endloop >> endloop >> matrix mci$n = R$n_2 + R$n_3 >> endloop >> </script> >> >> Now, because I just need the values for 6, 12 and 24, I'm trying to >> substitute the second line "loop for (n=6;n<=24;n=n*2)" for this: >> >> loop for (n=6;n=12;n=24) >> >> But the script isn't working. Any hints? >> >> Best regards, >> Henrique >> >> >> 2010/5/25 artur bala <artur.bala(a)laposte.net> >> >> Or, if your index is something like of a geometric series as it seems to >>> be (let's say 6, 12, 24, 48, and so on) and too long to do manually >>> you can try this one: >>> <script> >>> scalar count=0 >>> loop for (count=6;count<=24;count=count*2) --quiet >>> <instructions> >>> endloop >>> <\script> >>> >>> cheers, >>> artur >>> >>> Riccardo (Jack) Lucchetti a écrit : >>> > On Tue, 25 May 2010, Henrique Andrade wrote: >>> > >>> >> Dear Gretl Community, >>> >> >>> >> I'm trying to use a loop index inside a script but I don't know how. >>> >> According >>> >> to "Gretl User’s Guide" the syntax looks like this: >>> >> >>> >> loop i=1..24 >>> >> >>> >> But I just need the points where "i" is equal to 6, 12 and 24. >>> >> Something like this: >>> >> >>> >> loop i=6;12;24 >>> >> >>> >> How can I do that? >>> > >>> > For example, this way: >>> > <script> >>> > matrix foo = { 6, 12, 24 } >>> > n = cols(foo) >>> > loop for i=1..n >>> > bar = foo[i] >>> > print bar >>> > end loop >>> > </script> >>> > >>> > >>> > Riccardo (Jack) Lucchetti >>> > Dipartimento di Economia >>> > Università Politecnica delle Marche >>> > >>> > r.lucchetti(a)univpm.it >>> > http://www.econ.univpm.it/lucchetti >>> > >>> ------------------------------------------------------------------------ >>> > >>> > _______________________________________________ >>> > Gretl-users mailing list >>> > Gretl-users(a)lists.wfu.edu >>> > http://lists.wfu.edu/mailman/listinfo/gretl-users >>> >>> >>> _______________________________________________ >>> Gretl-users mailing list >>> Gretl-users(a)lists.wfu.edu >>> http://lists.wfu.edu/mailman/listinfo/gretl-users >>> >> >> >> >> -- >> Henrique C. de Andrade >> Doutorando em Economia Aplicada >> Universidade Federal do Rio Grande do Sul >> www.ufrgs.br/ppge >> >> _______________________________________________ >> Gretl-users mailing list >> Gretl-users(a)lists.wfu.edu >> http://lists.wfu.edu/mailman/listinfo/gretl-users >> > > > _______________________________________________ > Gretl-users mailing list > Gretl-users(a)lists.wfu.edu > http://lists.wfu.edu/mailman/listinfo/gretl-users > -- Henrique C. de Andrade Doutorando em Economia Aplicada Universidade Federal do Rio Grande do Sul www.ufrgs.br/ppgeDear Riccardo, Kehl and Guilherme,
I was looking for something simple. The option "loop for (n=6; n<=24; n*=2)" worked just fine. But in my humble opinion the option "loop for (n=6; n=12; n=24)" should work too, but this is not a big deal ;-)
Thank you so much!
Um abraço,
Henrique
Em 25 de maio de 2010 17:45, Hélio Guilherme <helioxent...@gmail.com> escreveu:
Hi Henrique,
I believe that this does what you want:
loop for (n=6; n<=24; n*=2) --quiet
No other simple options.On Tue, May 25, 2010 at 8:53 PM, Henrique Andrade <henrique.coe...@gmail.com> wrote:
Dear Riccardo, Kehl and Artur,
Thanks a lot for your help! I'd tried all the options you gave me and
my final script looks like this:
<script>
scalar n=0
loop for (n=6;n<=24;n=n*2) --quiet
scalar m = $T - n + 1
loop j=2..nelemY --quiet
matrix R$n_$j = zeros(m,1)
loop i=1..m --quiet
loop c=1..n --quiet
row = i + n - c
R$n_$j[i] += r$j[row, c]
endloop
endloop
endloop
matrix mci$n = R$n_2 + R$n_3
endloop
</script>
Now, because I just need the values for 6, 12 and 24, I'm trying to
substitute the second line "loop for (n=6;n<=24;n=n*2)" for this:
loop for (n=6;n=12;n=24)
But the script isn't working. Any hints?
Best regards,
Henrique2010/5/25 artur bala <artur.b...@laposte.net>
Or, if your index is something like of a geometric series as it seems to
be (let's say 6, 12, 24, 48, and so on) and too long to do manually
you can try this one:
<script>
scalar count=0
loop for (count=6;count<=24;count=count*2) --quiet
<instructions>
endloop
<\script>
cheers,
artur
Riccardo (Jack) Lucchetti a écrit :
> ------------------------------------------------------------------------> On Tue, 25 May 2010, Henrique Andrade wrote:
>
>> Dear Gretl Community,
>>
>> I'm trying to use a loop index inside a script but I don't know how.
>> According
>> to "Gretl Users Guide" the syntax looks like this:
>>
>> loop i=1..24
>>
>> But I just need the points where "i" is equal to 6, 12 and 24.
>> Something like this:
>>
>> loop i=6;12;24
>>
>> How can I do that?
>
> For example, this way:
> <script>
> matrix foo = { 6, 12, 24 }
> n = cols(foo)
> loop for i=1..n
> bar = foo[i]
> print bar
> end loop
> </script>
>
>
> Riccardo (Jack) Lucchetti
> Dipartimento di Economia
> Università Politecnica delle Marche
>
> r.lucche...@univpm.it
> http://www.econ.univpm.it/lucchetti
>
> _______________________________________________
> Gretl-users mailing list
> gretl-us...@lists.wfu.edu
> http://lists.wfu.edu/mailman/listinfo/gretl-users
_______________________________________________
Gretl-users mailing list
gretl-us...@lists.wfu.edu
http://lists.wfu.edu/mailman/listinfo/gretl-users
--Henrique C. de Andrade
Doutorando em Economia Aplicada
Universidade Federal do Rio Grande do Sul
www.ufrgs.br/ppge
_______________________________________________
Gretl-users mailing list
gretl-us...@lists.wfu.edu
http://lists.wfu.edu/mailman/listinfo/gretl-users
_______________________________________________
Gretl-users mailing list
gretl-us...@lists.wfu.edu
http://lists.wfu.edu/mailman/listinfo/gretl-users
--
Henrique C. de Andrade
Doutorando em Economia Aplicada
Universidade Federal do Rio Grande do Sul
www.ufrgs.br/ppge