Hi,

here is sample script that should help u further.
As a general point the $i is used for strings/stringsubstitution. In ur code u are referring to numbers.
What u need to do is first is defining a list with these numbers and then use the $i, but have a look:

<hansl>
open abdata.gdt
set echo off
set messages off

list xList = seq(3,5)
matrix alphas = zeros(nelem(xList),1)

loop foreach i xList --quiet
    smpl $i>0 --restrict
    ols $i lags(1,$i) --quiet
    alphas[i] = $coeff
endloop

eval mean(alphas)
eval sd(alphas)
# compared to the --progressive switch
loop foreach i xList --progressive
    smpl $i>0 --restrict
    ols $i lags(1,$i)
endloop
<hansl>

Cheers
Leon

18.06.2013 19:57, Luis M. Carrascal:

Dear GRTL users,

                Probably it is a stupid question, but …

how can I restrict data analyses within a loop affecting several response variables $i, when the restriction affects each variable $i?

 

the line    “smpl  $i > 0 --restrict”    does not work within this loop (from response variable 39 to response variable 145):

 

loop i=39..145 --progressive

smpl $i > 0 --restrict

quantreg {.95} $i const TMINstd TMINstd2 PRECmedINVstd PRECINVstd2 --robust

 

… more commands …

 

endloop

 

PD: I have a very large sample size (n=1690)

 

Thanks you very much in advance

 

 

Luis M. Carrascal
http://www.lmcarrascal.eu/
email: lmcarrascal@mncn.csic.es

Dept. Biogeografía y Cambio Global
MNCN-Consejo Superior de Investigaciones Científicas
C/ Pinar 25, 3ª planta. 28006 Madrid. SPAIN
Tfno: 34 91 5668963, Fax: 91 5645078

 



_______________________________________________
Gretl-users mailing list
Gretl-users@lists.wfu.edu
http://lists.wfu.edu/mailman/listinfo/gretl-users