From ignacio.diaz-emparanza@ehu.es Fri Feb 12 13:18:37 2010 From: Ignacio Diaz-Emparanza To: gretl-devel@gretlml.univpm.it Subject: Re: [Gretl-devel] ema, obs and optional parameter Date: Fri, 12 Feb 2010 19:18:30 +0100 Message-ID: <1265998710.2304.41.camel@U001082.ehu.es> In-Reply-To: Pine.A41.4.58.1002121237370.3104998@f1n11.sp2net.wfu.edu MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============6823506372889247206==" --===============6823506372889247206== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit El vie, 12-02-2010 a las 12:47 -0500, Allin Cottrell escribió: > 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? Yes, I expected this second alternative. > > > 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: > > Oh! you got it by accident. Try this other initial value for s1: > > > 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 internally gretl makes the calculus, but the user obtains nothing. > > 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. Yes, this is a possibility. -- Ignacio Diaz-Emparanza DEPARTAMENTO DE ECONOMÍA APLICADA III (ECONOMETRÍA Y ESTADÍSTICA) UPV/EHU Avda. Lehendakari Aguirre, 83 | 48015 BILBAO T.: +34 946013732 | F.: +34 946013754 www.ea3.ehu.es --===============6823506372889247206==--