On Thu, 12 Aug 2010, Summers, Peter wrote:
I'm estimating a series of regressions with varying break dates.
I set up a script with the break dates in a vector, then
generate a post-break dummy variable inside a loop, like so:
<script>
matrix breaks = breaks = {1985; 1985; 1986; 1986; 1982; ...}
loop ii=4..29
post = (obs>=obsnum(breaks[$ii-3]))
(run regression, do other stuff)
end loop
</script>
obsnum expects a string argument. This is related to the entry in
http://gretl.sourceforge.net/Backward.html for gretl 1.9.0.
The following will work (tested example):
<script>
open data3-6
matrix breaks = {1965, 1970, 1975}
string brkstr
loop ii=4..6
sprintf brkstr "%d", breaks[ii-3]
post = (obs >= obsnum(@brkstr))
print post -o
end loop
</script>
Allin Cottrell