I again insist on the exponential moving average calculation. The
calculation done by Gretl for the exponential moving average should be
slightly changed at the beginning of the series calculation according to me:
We have a = 0.1 and
Y(1) = 362 (first observation)
Y(2) = 381 (second observation)
The starting value in our case is 351 = EMA(0) = mean of the whole time
EMA(1) = aY(1) + (1-a)EMA(0) = 0.1*362 + 0.9*351 = 352.10.
--> EMA(1) is the one-step forecast done in period 1 for period 2 = Y^(1)
EMA(2) = aY(2) + (1-a)EMA(1) = 0.1*381 + 0.9*352.10 = 354.99
--> EMA(2) is the one-step forecast done in period 2 for period 3= Y^(2)
Gretl calculation is:
EMA(1) = 351
EMA(2) = aY(2) + (1-a)EMA(1) = 0.1*381 + 0.9*351 = 354
By doing so the observed value in period 1, Y(1) = 362 is not used at all.
This information is simply ignored!
By using the Gretl values I obtain a lower SSE as using my calculations
(done in Excel). I don't know whether it is always like this or it is due
to a particular example.
I want to choose the optimal parameter a that minimizes the SSE. Would it
be possible to include these feature within the menu without having to run a
script? I think about users like me who are not familiar with defining
functions and using BFGSmax.
Thank you in advance
[mailto:firstname.lastname@example.org] Im Auftrag von
Gesendet: Donnerstag, 24. September 2015 18:00
Betreff: Gretl-users Digest, Vol 104, Issue 35
Send Gretl-users mailing list submissions to
To subscribe or unsubscribe via the World Wide Web, visit
or, via email, send a message with subject or body 'help' to
You can reach the person managing the list at
When replying, please edit your Subject line so it is more specific than
"Re: Contents of Gretl-users digest..."
1. Re: exponential moving average (Allin Cottrell)
Date: Thu, 24 Sep 2015 10:11:42 -0400 (EDT)
From: Allin Cottrell <cottrell(a)wfu.edu>
To: Gretl list <gretl-users(a)lists.wfu.edu>
Subject: Re: [Gretl-users] exponential moving average
Content-Type: text/plain; charset=US-ASCII; format=flowed
On Thu, 24 Sep 2015, Raul Gimeno wrote:
Thank you for your answer.
Could you please remove the restriction for the exponential moving
average filter to allow up to T/2 observations for the mean
As Jack said, that's now done in CVS. It will be in the snapshots shortly.
It would be helpful if all the fillters you find under
like the exponential moving average have their own short explanation
in the Gretl's guide.
The more elaborate filters (e.g. Butterworth, Polynomial trend) have a Help
button in the set-up dialog box which gives some details. I think the best
thing here might be to add some help text for the EMA also.
I am using the Roberts formula but I get a different result from
with alpha = 0.1
Value one-step forecast
Y(T) Y^ (T-1)
T = 0 351.2917
T = 1 362 352.363 = 0.1(362) + 0.9(351.2917) --> Gretl:
T = 2 381
There seems to be a difference over dating assumptions here. What gretl does
is to put the initializer for the EMA into the first observation of the
output series (which gretl calls t = 1, there's no t = 0). Then the first
actual computed value is EMA(2) = a*Y(2) + (1-a)*EMA(1). It seems you are
placing the EMA initializer before the data start, and then doing the first
EMA calculation using Y(1).
So far as I can tell, the procedure gretl uses is that given by NIST
) but I'm
not sure if there's a truly canonical approach here. (It's the sort of thing
that won't make any difference asymptotically.)
Would it be possible to include a solver function like in Excel in
order to do minimizing calculations to find the optimal alpha?
The BFGSmax function can do this sort of thing. See the chapter on Numerical
methods in the User's Guide.
Gretl-users mailing list
End of Gretl-users Digest, Vol 104, Issue 35