From cottrell@wfu.edu Mon Feb 15 16:40:48 2010 From: Allin Cottrell To: gretl-devel@gretlml.univpm.it Subject: Re: [Gretl-devel] ema, obs and optional parameter Date: Mon, 15 Feb 2010 16:40:45 -0500 Message-ID: In-Reply-To: 1266255508.2263.17.camel@U001082.ehu.es MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============5780134775273150347==" --===============5780134775273150347== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit On Mon, 15 Feb 2010, Ignacio Diaz-Emparanza wrote: > El lun, 15-02-2010 a las 10:57 +0100, Ignacio Diaz-Emparanza escribió: > > El vie, 12-02-2010 a las 13:44 -0500, Allin Cottrell escribió: > > > On Fri, 12 Feb 2010, Ignacio Diaz-Emparanza wrote: > > > > > > > With periodicity ($pd)> 1 (quarterly or monthly data,..) > > > > y[1] is refering to the first observation of the series, > > > > but with annual data it is refering to the observation of year '1'. > > > > > > Duh, sorry, I wasn't paying enough attention. I'll think about it, > > > but here's a quick work-around: > > > > > > > > > > Oh, yes it works ! I did not try with 't' because I thought it was an > > alias of 'obs', given the explanation in the function reference: > > Sorry I am seeing I was absolutely confused about that. I didn't notice > that you were using a loop in 't'. In general in genr commands really > 't' is an alias of 'obs'. So the problem persists also with 't'. OK, I think I have a solution. As you suggested originally, we'll make "obs" consistent, such that it always gives a series containing the 1-based index of the observations, regardless of the periodicity of the data. This means that, e.g., "(obs==1970)" will not work to pick out the observation for 1970 in an annual time series. But if you want to do that you can use the function obsnum(), as in series d70 = (obs==obsnum(1970))? 1 : 0 (I had forgotten about obsnum, but it's clearly the tool for the job here.) Allin. --===============5780134775273150347==--