On Wed, 19 Jan 2011, artur tarassow wrote: > I am just writing a function for estimating the test statistics for > the Johansen cointegration test recursively over time. So I have to > define a base sample which is taken for the initial estimation and a > horizon over which to add observations each round.
Sounds like you want something of ths sort: <script> function void slide_sample (series y, int max0, int incr, int n) set messages on # see what's going on more fully smpl ; max0 loop n printf "sample mean of y = %g\n", mean(y) smpl ; +incr endloop end function open denmark.gdt slide_sample(LRM, obsnum(1984:4), 4, 2) </script> In the function slide_sample(), max0 is the initial end-point of the sample range, incr is the number of observations to add at each step, and n is the number of steps to take. Allin Cottrell