From cottrell@wfu.edu Fri Feb 12 12:47:29 2010 From: Allin Cottrell To: gretl-devel@gretlml.univpm.it Subject: Re: [Gretl-devel] ema, obs and optional parameter Date: Fri, 12 Feb 2010 12:47:27 -0500 Message-ID: In-Reply-To: 1265985986.2304.35.camel@U001082.ehu.es MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============5259541671449333624==" --===============5259541671449333624== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit On Fri, 12 Feb 2010, Ignacio Diaz-Emparanza wrote: > I am teaching on these days a very basic course on forecasting. > A part of the course is about smoothing models so I was looking at > exponential smoothing and today I was also preparing a script about the > Brown models for linear and quadratic local trends. > > I would like to report some small problems I found: > > 1- The exponential moving average exist only at the GUI but there is not > an equivalent command script for that. I had to prepare a user function. Yes, we should probably add a built-in function for that -- or maybe extend the current movavg function to accept a fractional second argument to produce an EMA? > 2- When I finished to prepare a first version of this function I noticed > that it only worked for quarterly data ( I suppose monthly as well ) but > not for annual data. The problem was about the different behaviour of > the 'obs' function with annual data (I saw this in the manual for > 'genr'). If you use, for example, > > series s1 = (obs=1) ? y[1] : delta*y+ (1-delta)*s1(-1) > > this will work for quarterly or monthly data, but not in the same way > for annual data. Finally I found a solution, but it implied that my > script grew up in 10 lines! > > Don't you think that 'obs' should work in the same way, idependently of > the value of $pd? Hmm, what does the dataset look like? The following works correctly here: > 3- Finally I saved my Brown function as a function package ( I > uploaded it to the server as well), but I see another small > problem: my main function returns a list and if one wants the > package to work ok this list is mandatory, but the dialog box > says "Assign return value (optional)". ¿is there any way to > change this to 'required'? What happens if the user doesn't assign the return value? I suppose there may be many functions that don't do anything useful (or even visible) if the return value is not assigned, while others might print something of interest. Perhaps we should add a field in the function package definition that indicates whether or not there's any point in running the function without assignment. Allin. --===============5259541671449333624==--