First option has a small bug. It does not "#do stuff" to the forth sample
period. Here is a revision
smpl 1855 1894
loop i = 1..4
j = (i=1) ? 0 : 1
smpl +(5*j) +(5*j)
#do stuff
endloop
-----Original Message-----
From: gretl-users-bounces(a)lists.wfu.edu [mailto:gretl-users-
bounces(a)lists.wfu.edu] On Behalf Of Logan Kelly
Sent: Friday, May 16, 2014 9:57 PM
To: Gretl list
Subject: Re: [Gretl-users] sorry, learning hansl question
You can do this in two ways.
First:
smpl 1855 1894
loop i = 1..3
#do stuff
smpl +5 +5
endloop
Second:
string st_yr = "1855 1860 1865 1870"
string ed_yr = "1894 1899 1904 1909"
string st ed
loop i = 1..4
st = strsplit(st_yr,i)
ed = strsplit(ed_yr,i)
smpl @st @ed
#do stuff
endloop
The second option should only be used if your periods do not change in a regular
way as it is slower.
Logan
> -----Original Message-----
> From: gretl-users-bounces(a)lists.wfu.edu [mailto:gr etl-users-
> bounces(a)lists.wfu.edu] On Behalf Of Tim Nall
> Sent: Friday, May 16, 2014 9:10 PM
> To: Gretl list
> Subject: [Gretl-users] sorry, learning hansl question
>
> If you can figure out the iffy psuedo-psuedocode below, I'm trying to
> run 1 ols regression over 4 different date ranges (so total 4
> regressions) with 1 dependnet variable and 1 independant variable..
> but I want to run a kpss test on both the depvar and indvar before
> doing the regression for each date range, then utilize either the
> variable or its fiorst- differenced version depending on the results of the kpss
(at 5%, hopefully).
>
> Can this be done in hansl?
>
>
> start_yr = 1855 1860 1865 1870
> end_yr = 1894 1899 1904 1909
>
> ## get MyDepVar and myIndVar from file, then
>
> for i in start_yr, end_yr
>
> smpl start_yr end_yr
>
> kpss 3 myDepVar ## and capture results
> if stationary = True:
> tempDepVar = MyDepVar
> else:
> tempDepVar = d_MyDepvar
>
> kpss 3 myIndVar ## and capture results
>
> if stationary = True:
> tempIndVar = myIndVar
> else:
> tempIndVar = d_myIndVar
>
> ols tempDepVar tempIndVar
>
>
>
>
> --
> Best regards,
> Timothy M. Nall
> Assistant Professor
> National Quemoy University
> Kinmen, Taiwan
> _______________________________________________
> 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