removing nan and inf from a matrix
by Logan Kelly
Hello,
I need to take the log difference of a matrix, i.e. log(M[2 rows(M):,]/M[1:rows(M)-1,]). Unfortunately, M has elements equal to zero. I need to replace the nan's and inf's with 0's. This almost works
M = isnan(M) ? 0 : M
but does not remove inf's. Any sugestions?
8 years, 3 months
Holt-Winters package
by Raul Gimeno
Hello
I've been using the Holt-Winters package but I cannot replicate my
Excel-calculation results with this package.
The starting value from the package for the trend is 245 mine is 166.396. By
running a regression on the full sample I get completely different results
for these starting values, although the same methodology as described in the
help description has been used.
For replication purposes I send my excel spreadsheet and I would be glad to
understand how these starting values have been effectively calculated.
Thank you for your help
Raul Gimeno
**
8 years, 4 months
X-12-ARIMA 64bits
by Carlos Andrade
Hello Gretl users,
I installed the 1.9.92 version of Gretl Linux x86_64 in Debian 8 AMD64.
Where do I find the x86_64 version of X-12-ARIMA for Gretl 1.9.92?
Thanks.
--
Atenciosamente,
Prof. Carlos A. S. de Andrade
LAPEA - Laboratório de Pesquisa em Economia Aplicada e Engenharia de
Produção
Universidade Federal de Campina Grande.
Centro de Humanidades
Unidade Acadêmica de Economia
8 years, 11 months
Holt-Winters package
by Raul Gimeno
Thank you Ignacio for your answer.
Would it be possible to modify your program such that the initial values
correspond either to a fixed value given manually or correspond to the OLS
estimation of the parameters for the whole times series or for half of it as
it is usually the case.
Would it be possible to include both the additive and multiplicative models?
Would you agree to integrate your program within the Gretl menu under
"Variables/Filters". I don't see the point of having a separate program for
it.
Would it be possible to expand your help explanations to allow a "simple
user" to understand better how it works, especially what to do if you do not
want a seasonality parameter.
Is there a possibility to write the variables in your help with subscripts
instead of underscores to increase the readability of the equations?
Thank you for your help
Raul Gimeno
-----Ursprüngliche Nachricht-----
Von: gretl-users-bounces(a)lists.wfu.edu
[mailto:gretl-users-bounces@lists.wfu.edu] Im Auftrag von
gretl-users-request(a)lists.wfu.edu
Gesendet: Dienstag, 29. September 2015 18:00
An: gretl-users(a)lists.wfu.edu
Betreff: Gretl-users Digest, Vol 104, Issue 43
Send Gretl-users mailing list submissions to
gretl-users(a)lists.wfu.edu
To subscribe or unsubscribe via the World Wide Web, visit
http://lists.wfu.edu/mailman/listinfo/gretl-users
or, via email, send a message with subject or body 'help' to
gretl-users-request(a)lists.wfu.edu
You can reach the person managing the list at
gretl-users-owner(a)lists.wfu.edu
When replying, please edit your Subject line so it is more specific than
"Re: Contents of Gretl-users digest..."
Today's Topics:
1. Re: Data Import - non-numeric values (Schaff, Frederik)
2. Re: Data Import - non-numeric values (Riccardo (Jack) Lucchetti)
3. Re: Data Import - non-numeric values (Allin Cottrell)
4. Re: Holt-Winters package (Pedro Ba??o)
5. Re: Holt-Winters package (Ignacio Diaz-Emparanza)
----------------------------------------------------------------------
Message: 1
Date: Mon, 28 Sep 2015 17:32:46 +0000
From: "Schaff, Frederik" <Frederik.Schaff(a)fernuni-hagen.de>
To: Gretl list <gretl-users(a)lists.wfu.edu>
Subject: Re: [Gretl-users] Data Import - non-numeric values
Message-ID:
<94DD4923F1D1534189901CE4E97BB72E34966071(a)Ymir.buerokommunikation.fernuni-ha
gen.de>
Content-Type: text/plain; charset="iso-8859-1"
Hi there,
thanks very much Allen! I'll take the advice to heart. Fortunately in the
case where these garbage values are "created" a part of the analysis
(corresponding to these values) has not been conducted and that is flagged
(in another "non-garbage" variable), so I can post-process these values.
What are the "maximal" values gretl takes as import? +-1e100 and +-1e-100?
Regards
Frederik
-----Urspr?ngliche Nachricht-----
Von: gretl-users-bounces(a)lists.wfu.edu
[mailto:gretl-users-bounces@lists.wfu.edu] Im Auftrag von Allin Cottrell
Gesendet: Sonntag, 27. September 2015 21:02
An: Gretl list
Betreff: Re: [Gretl-users] Data Import - non-numeric values
On Sun, 27 Sep 2015, Allin Cottrell wrote:
> Note that whether [uninitialized] values are taken as "numeric" or not
> will in general depend on the C library in use. But either way they're
> wrong and have to be changed. _If_ you can get such values into gretl
> as numeric, you could fix them via something like:
>
> foo = (abs(foo) > 0 && abs(foo) < 1.0e-100)? NA : foo
>
> where "foo" is the name of the series to be fixed and we're assuming
> that non-zero observations with absolute value less than 10^{-100} are
> garbage. This is not very reliable, however, as it's _possible_ that
> some uninitialized doubles happen to fall in the "normal" range and so
> escape correction.
After a little testing, let me rephrase that: it's more than "possible",
it's highly probable.
I wrote a little test C program which created an array of 2048 "doubles",
uninitialized. For each such value I printed it into a string variable using
sprintf() with the "%g" conversion then tried reading it back into a double
using strtod(). I counted the cases where strtod() raised the ERANGE error:
271 out of 2048. So in this case, at least, the great majority of garbage
values appeared to be
"fine": properly numeric and not subnormal.
So here's a big WARNING: on no account should one let uninitialized values
get printed into a file for use in econometric analysis.
There's no half-way reliable method for clearing them out.
[Just as a footnote: a "subnormal" number (also known as
"denormalized") is one that's too close to zero to be represented as a C
"double" to anything like the usual precision. And there's absolutely no
guarantee that the random bits in an uninitialized double will correspond to
a subnormal number.]
Allin Cottrell
_______________________________________________
Gretl-users mailing list
Gretl-users(a)lists.wfu.edu
http://lists.wfu.edu/mailman/listinfo/gretl-users
------------------------------
Message: 2
Date: Mon, 28 Sep 2015 22:08:18 +0200 (CEST)
From: "Riccardo (Jack) Lucchetti" <r.lucchetti(a)univpm.it>
To: Gretl list <gretl-users(a)lists.wfu.edu>
Subject: Re: [Gretl-users] Data Import - non-numeric values
Message-ID: <alpine.DEB.2.20.1509282206190.15621(a)ec-4.econ.univpm.it>
Content-Type: text/plain; charset="iso-8859-1"; Format="flowed"
On Mon, 28 Sep 2015, Schaff, Frederik wrote:
> Hi there,
>
> thanks very much Allen! I'll take the advice to heart. Fortunately in
> the case where these garbage values are "created" a part of the
> analysis (corresponding to these values) has not been conducted and
> that is flagged (in another "non-garbage" variable), so I can
> post-process these values. What are the "maximal" values gretl takes
> as import? +-1e100 and
> +-1e-100?
If I were you, I'd use a conventional vaule for "missing" (say,
-99999.99999), which would be subsequently easy to convert to a "proper"
missing entry via the gretl "setmiss" command.
-------------------------------------------------------
Riccardo (Jack) Lucchetti
Dipartimento di Scienze Economiche e Sociali (DiSES)
Universit? Politecnica delle Marche
(formerly known as Universit? di Ancona)
r.lucchetti(a)univpm.it
http://www2.econ.univpm.it/servizi/hpp/lucchetti
-------------------------------------------------------
------------------------------
Message: 3
Date: Mon, 28 Sep 2015 16:37:32 -0400 (EDT)
From: Allin Cottrell <cottrell(a)wfu.edu>
To: Gretl list <gretl-users(a)lists.wfu.edu>
Subject: Re: [Gretl-users] Data Import - non-numeric values
Message-ID: <alpine.LFD.2.20.1509281631060.2830(a)myrtle.attlocal.net>
Content-Type: text/plain; charset=US-ASCII; format=flowed
On Mon, 28 Sep 2015, Schaff, Frederik wrote:
> thanks very much Allen! I'll take the advice to heart. Fortunately in
> the case where these garbage values are "created" a part of the
> analysis (corresponding to these values) has not been conducted and
> that is flagged (in another "non-garbage" variable), so I can
> post-process these values. What are the "maximal" values gretl takes
> as import? +-1e100 and +-1e-100?
Gretl accepts the judgment of the C library on numerical underflow or
overflow. On the big side we can be fairly definite: anything less than
1.79769e308 should be fine. On the close-to-zero side numbers greater in
absolute value than 1e-308 should be OK for most C libraries.
Allin
------------------------------
Message: 4
Date: Mon, 28 Sep 2015 21:40:33 +0100
From: Pedro Ba??o <pmab(a)fe.uc.pt>
To: Gretl list <gretl-users(a)lists.wfu.edu>
Subject: Re: [Gretl-users] Holt-Winters package
Message-ID:
<CAMwCGMcA=LiciPpePaCom1TsTVszRDQBcN+=V1NyrheSnquA=A(a)mail.gmail.com>
Content-Type: text/plain; charset=UTF-8
Some time ago I came across a similar problem when using this function for a
class. At the time I made a note to myself saying that the problem was in
the definition of lobs, which I changed to:
scalar lobs=lastobs(y)
I hope this helps
On 28 September 2015 at 15:56, Ignacio Diaz-Emparanza
<ignacio.diaz-emparanza(a)ehu.eus> wrote:
> I have not much time for testing today, but it seems that a correction
> I included to avoid initial conditions very different from the first
> observations of the series is not working well for your data. If you
> change in the HoltWinters package the line
>
> series yh1= (0.85*y<= $yhat && $yhat <=1.15*y) ? $yhat : y
>
> simply to:
>
> series yh1= $yhat
>
> you will have results more similar (but not exactly) to yours (I think
> we are using different initial conditions).
>
>
>
> El 28/09/15 a las 14:23, Raul Gimeno escribi?:
>>
>> Hello
>>
>> I've been using the Holt-Winters package but I cannot replicate my
>> Excel-calculation results with this package.
>> The starting value from the package for the trend is 245 mine is 166.396.
>> By
>> running a regression on the full sample I get completely different
>> results for these starting values, although the same methodology as
>> described in the help description has been used.
>> For replication purposes I send my excel spreadsheet and I would be
>> glad to understand how these starting values have been effectively
>> calculated.
>> Thank you for your help
>> Raul Gimeno
>>
>> **
>>
>>
>> _______________________________________________
>> Gretl-users mailing list
>> Gretl-users(a)lists.wfu.edu
>> http://lists.wfu.edu/mailman/listinfo/gretl-users
>
>
>
> --
> Ignacio D?az-Emparanza
> Departamento de Econom?a Aplicada III (Econometr?a y Estad?stica)
> Universidad del Pa?s Vasco - Euskalherriko Unibertsitatea, UPV/EHU
> Tfno: (+34) 94 601 3732
> http://www.ehu.eus/ea3
>
> _______________________________________________
> Gretl-users mailing list
> Gretl-users(a)lists.wfu.edu
> http://lists.wfu.edu/mailman/listinfo/gretl-users
>
>
>
>
------------------------------
Message: 5
Date: Tue, 29 Sep 2015 12:33:37 +0200
From: Ignacio Diaz-Emparanza <ignacio.diaz-emparanza(a)ehu.eus>
To: gretl-users(a)lists.wfu.edu
Subject: Re: [Gretl-users] Holt-Winters package
Message-ID: <560A6901.80301(a)ehu.eus>
Content-Type: text/plain; charset=utf-8; format=flowed
El 28/09/15 a las 22:40, Pedro Ba??o escribi?:
> Some time ago I came across a similar problem when using this function
> for a class. At the time I made a note to myself saying that the
> problem was in the definition of lobs, which I changed to:
> scalar lobs=lastobs(y)
> I hope this helps
>
Yes, I detected this problem some months ago and included some changes for
treating with missing observations as well.
With respect to Raul problem, apart from the change in line
series yh1= (0.85*y<= $yhat && $yhat <=1.15*y) ? $yhat : y
to:
series yh1= $yhat
which I commented yesterday, I see that the differences in calculations
between Raul's excel functions and this package was because of the different
initial observations. As recently reported for the 'movavg'
command (exponential moving average) I was also ignoring the first
observation of the series. I have corrected this and committed the change
(It is in the staging area until Allin aproval:
http://ricardo.ecn.wfu.edu/gretl/staging_fnfiles/).Now the results are the
same.
I also think we need more flexibility for the initial conditions, I will
work on this.
--
Ignacio D?az-Emparanza
Departamento de Econom?a Aplicada III (Econometr?a y Estad?stica)
Universidad del Pa?s Vasco - Euskalherriko Unibertsitatea, UPV/EHU
Tfno: (+34) 94 601 3732
http://www.ehu.eus/ea3
------------------------------
_______________________________________________
Gretl-users mailing list
Gretl-users(a)lists.wfu.edu
http://lists.wfu.edu/mailman/listinfo/gretl-users
End of Gretl-users Digest, Vol 104, Issue 43
********************************************
9 years
Data Import - non-numeric values
by Schaff, Frederik
Hello everybody,
I have a data-set with some non-numeric values according to gretl (but not to CSVed).
[1]: Problematic values (examples): 4.13108e-312 5.27295e-270 4.3172e-227 1.51922e-184 3.97655e-142 1.42149e-144 1.94409e-143 2.79222e-144
(These values stem from uninitialised double variables in my c++ model, I guess).
Is there an option unbeknown to me to simply substitute such non-numerics by Gretl "NA" directly with the import? I.e. make the error messages quiet and gretl process nonetheless?
I cannot find one and an old request (http://sourceforge.net/p/gretl/feature-requests/47/) is long closed...
----
Background:
I have a relative large data-set (57,970 rows x ~1,000 columns) from a simulation experiment (panel data), distributed over several paths and files. I have written a python script that produces a nice enough import script for gretl (listing all the paths, the first one via open the next ones via append) which works fine... except when some not-a-number values are present, like "1.#QNAN" or [1], which occurs sometimes. I would prefer not to change the data (or a copy of the data) because a) this probably takes a lot of time (the total size is about 800MB and more to come) and b) Gretl does a good job in not mixing things up...
----
Thanks for your time!
Frederik
------------
Frederik Schaff, Dipl.-Volkswirt
University of Hagen
Department of Business and Economics
Chair of Economic Theory (Prof. A. Endres)
Universitätsstraße 11 (TGZ)
58097 Hagen
Phone: +49 (0) 2331 987-4454
E-Mail: Frederik.Schaff(a)FernUni-Hagen.de
http://www.fernuni-hagen.de/wirtschaftstheorie/en/team/frederik.schaff.shtml
9 years
exponential moving average
by Raul Gimeno
Dear Allin
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
series.
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
Raul Gimeno
-----Ursprüngliche Nachricht-----
Von: gretl-users-bounces(a)lists.wfu.edu
[mailto:gretl-users-bounces@lists.wfu.edu] Im Auftrag von
gretl-users-request(a)lists.wfu.edu
Gesendet: Donnerstag, 24. September 2015 18:00
An: gretl-users(a)lists.wfu.edu
Betreff: Gretl-users Digest, Vol 104, Issue 35
Send Gretl-users mailing list submissions to
gretl-users(a)lists.wfu.edu
To subscribe or unsubscribe via the World Wide Web, visit
http://lists.wfu.edu/mailman/listinfo/gretl-users
or, via email, send a message with subject or body 'help' to
gretl-users-request(a)lists.wfu.edu
You can reach the person managing the list at
gretl-users-owner(a)lists.wfu.edu
When replying, please edit your Subject line so it is more specific than
"Re: Contents of Gretl-users digest..."
Today's Topics:
1. Re: exponential moving average (Allin Cottrell)
----------------------------------------------------------------------
Message: 1
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
Message-ID:
<alpine.LNX.2.20.3.1509240907410.1399(a)localhost.localdomain>
Content-Type: text/plain; charset=US-ASCII; format=flowed
On Thu, 24 Sep 2015, Raul Gimeno wrote:
> Dear Allin
>
> 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
> calculation?
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 "variable"
> 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 Gretl
>
>
>
> 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:
> 354.2625
>
> 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
(http://www.itl.nist.gov/div898/handbook/pmc/section3/pmc324.htm ) 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.
Allin Cottrell
------------------------------
_______________________________________________
Gretl-users mailing list
Gretl-users(a)lists.wfu.edu
http://lists.wfu.edu/mailman/listinfo/gretl-users
End of Gretl-users Digest, Vol 104, Issue 35
********************************************
9 years
Re: [Gretl-users] Gretl-users Digest, Vol 104, Issue 34
by Raul Gimeno
I think it is worth stressing that you would make the package more
user-friendly if a cross-linking information strategy would be implemented
connecting the underlying functions like movavg() with the corresponding
menu items, in this case exponential moving average menu.
Raul Gimeno
-----Ursprüngliche Nachricht-----
Von: gretl-users-bounces(a)lists.wfu.edu
[mailto:gretl-users-bounces@lists.wfu.edu] Im Auftrag von
gretl-users-request(a)lists.wfu.edu
Gesendet: Donnerstag, 24. September 2015 12:53
An: gretl-users(a)lists.wfu.edu
Betreff: Gretl-users Digest, Vol 104, Issue 34
Send Gretl-users mailing list submissions to
gretl-users(a)lists.wfu.edu
To subscribe or unsubscribe via the World Wide Web, visit
http://lists.wfu.edu/mailman/listinfo/gretl-users
or, via email, send a message with subject or body 'help' to
gretl-users-request(a)lists.wfu.edu
You can reach the person managing the list at
gretl-users-owner(a)lists.wfu.edu
When replying, please edit your Subject line so it is more specific than
"Re: Contents of Gretl-users digest..."
Today's Topics:
1. exponential moving average (Raul Gimeno)
2. Re: exponential moving average (Riccardo (Jack) Lucchetti)
3. Re: exponential moving average (Sven Schreiber)
----------------------------------------------------------------------
Message: 1
Date: Thu, 24 Sep 2015 09:49:41 +0200
From: "Raul Gimeno" <mrexito(a)vtxmail.ch>
To: <gretl-users(a)lists.wfu.edu>
Subject: [Gretl-users] exponential moving average
Message-ID: <008801d0f69d$9207d6b0$b6178410$(a)vtxmail.ch>
Content-Type: text/plain; charset="iso-8859-1"
Dear Allin
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 calculation?
It would be helpful if all the fillters you find under "variable" like the
exponential moving average have their own short explanation in the Gretl's
guide.
I am using the Roberts formula but I get a different result from Gretl
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:
354.2625
T = 2 381
Would it be possible to include a solver function like in Excel in order to
do minimizing calculations to find the optimal alpha?
Thank you in advance
Raul Gimeno
______________________________________
-----Urspr?ngliche Nachricht-----
Von: gretl-users-bounces(a)lists.wfu.edu
[mailto:gretl-users-bounces@lists.wfu.edu] Im Auftrag von
gretl-users-request(a)lists.wfu.edu
Gesendet: Mittwoch, 23. September 2015 18:00
An: gretl-users(a)lists.wfu.edu
Betreff: Gretl-users Digest, Vol 104, Issue 32
Send Gretl-users mailing list submissions to
<mailto:gretl-users@lists.wfu.edu>
gretl-users(a)lists.wfu.edu
To subscribe or unsubscribe via the World Wide Web, visit
<http://lists.wfu.edu/mailman/listinfo/gretl-users>
http://lists.wfu.edu/mailman/listinfo/gretl-users
or, via email, send a message with subject or body 'help' to
<mailto:gretl-users-request@lists.wfu.edu>
gretl-users-request(a)lists.wfu.edu
You can reach the person managing the list at
<mailto:gretl-users-owner@lists.wfu.edu>
gretl-users-owner(a)lists.wfu.edu
When replying, please edit your Subject line so it is more specific than
"Re: Contents of Gretl-users digest..."
Today's Topics:
1. Re: Help please cannot get latex to work (Allin Cottrell)
2. Re: exponential moving average (Allin Cottrell)
----------------------------------------------------------------------
Message: 1
Date: Wed, 23 Sep 2015 08:58:25 -0400 (EDT)
From: Allin Cottrell < <mailto:cottrell@wfu.edu> cottrell(a)wfu.edu>
To: Gretl list < <mailto:gretl-users@lists.wfu.edu>
gretl-users(a)lists.wfu.edu>
Subject: Re: [Gretl-users] Help please cannot get latex to work
Message-ID:
<
<mailto:alpine.LNX.2.20.3.1509230853170.30212@localhost.localdomain>
alpine.LNX.2.20.3.1509230853170.30212(a)localhost.localdomain>
Content-Type: text/plain; charset=US-ASCII; format=flowed
On Tue, 22 Sep 2015, Cameron Heimerdinger wrote:
> I have been trying to get the drop down to work for almost an hour now
> and no luck I am attaching a picture what I am looking at. Any help to
> get this to work is much appreciated!
I've looked into this, and I'm afraid LaTeXit.app is not going to work for
this purpose. The author of the program says, "LaTeXiT is 'simply'
a graphical interface above a LaTeX engine" (See
<http://www.chachatelier.fr/latexit/> http://www.chachatelier.fr/latexit/ ).
What gretl needs is the path to the "LaTeX engine" itself, which should
probably be a binary named "pdflatex". Where exactly that is on your system,
I don't know, but you should be able to find out by doing
locate pdflatex
in a Terminal window.
Allin Cottrell
------------------------------
Message: 2
Date: Wed, 23 Sep 2015 11:19:12 -0400 (EDT)
From: Allin Cottrell < <mailto:cottrell@wfu.edu> cottrell(a)wfu.edu>
To: Gretl list < <mailto:gretl-users@lists.wfu.edu>
gretl-users(a)lists.wfu.edu>
Subject: Re: [Gretl-users] exponential moving average
Message-ID:
<
<mailto:alpine.LNX.2.20.3.1509231040540.32043@localhost.localdomain>
alpine.LNX.2.20.3.1509231040540.32043(a)localhost.localdomain>
Content-Type: text/plain; charset=US-ASCII; format=flowed
On Wed, 23 Sep 2015, Raul Gimeno wrote:
> By using the filter exponential moving average, you can choose the
> first EMA value based on the mean of the first n observations. The
> number is limited to 6. Why this limitation ? Sometimes I see people
> taking the first value being the mean of half of the time series.
The general limitation is not 6 but T/4. I suppose we could increase it to
T/2 if that's commonly used.
> Where do I see any information about the way it is calculated in the
> Gretl documentation ?
In the Help for the movavg() function. Also see
<https://en.wikipedia.org/wiki/Moving_average>
https://en.wikipedia.org/wiki/Moving_average ; we compute the Roberts
version.
> I have a time series with mean = 351.2917 and the first observation is
> y1 = 362
>
> Gretl gives me correctly the first forecast being S0 = 351.2917 for
> y1 which equals the mean of the whole time series.
>
> The second forecast is given by Gretl as being 354.2625 with alpha =
> 0.1.
>
> According to me you should get: S1 = 0.1(351.2917) + 0.9(362) =
> 352.3625
S_t = a*y_t + (1-a)*S_{t-1}
Using Roberts the second value of S should be 0.1 times the second y
observation + 0.9 times the initial value of S.
> How to find the optimal alpha minimizing the MSE ?
You could use a line search in a loop, or one of gretl's numerical tools
such as BFGSmax.
Allin Cottrell
------------------------------
_______________________________________________
Gretl-users mailing list
<mailto:Gretl-users@lists.wfu.edu> Gretl-users(a)lists.wfu.edu
<http://lists.wfu.edu/mailman/listinfo/gretl-users>
http://lists.wfu.edu/mailman/listinfo/gretl-users
End of Gretl-users Digest, Vol 104, Issue 32
********************************************
9 years
Re: [Gretl-users] Gretl-users Digest, Vol 104, Issue 36
by Raul Gimeno
Thank you Sven for your answer.
It is common practice to minimize the SSE in order to obtain the alpha
parameter in conjunction with exponential smoothing methods.
The goal is not to get a perfect smoothing but to adapt the smoothing method
to the data in order to do a better forecasting. Of course you have other
methods to do the forecasting....
By adding this feature you give an added value to "simple" users who are not
acquainted with functions and scripts and you make in this sense a more
user-friendly package...
Raul Gimeno
-----Ursprüngliche Nachricht-----
Von: gretl-users-bounces(a)lists.wfu.edu
[mailto:gretl-users-bounces@lists.wfu.edu] Im Auftrag von
gretl-users-request(a)lists.wfu.edu
Gesendet: Freitag, 25. September 2015 17:42
An: gretl-users(a)lists.wfu.edu
Betreff: Gretl-users Digest, Vol 104, Issue 36
Send Gretl-users mailing list submissions to
gretl-users(a)lists.wfu.edu
To subscribe or unsubscribe via the World Wide Web, visit
http://lists.wfu.edu/mailman/listinfo/gretl-users
or, via email, send a message with subject or body 'help' to
gretl-users-request(a)lists.wfu.edu
You can reach the person managing the list at
gretl-users-owner(a)lists.wfu.edu
When replying, please edit your Subject line so it is more specific than
"Re: Contents of Gretl-users digest..."
Today's Topics:
1. Re: exponential moving average (Allin Cottrell)
2. exponential moving average (Raul Gimeno)
3. Re: exponential moving average (Sven Schreiber)
4. Re: exponential moving average (Allin Cottrell)
5. Re: exponential moving average (Allin Cottrell)
6. Testing for homogeneity (Cameron Heimerdinger)
7. Re: exponential moving average (Allin Cottrell)
----------------------------------------------------------------------
Message: 1
Date: Thu, 24 Sep 2015 13:00:02 -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
Message-ID:
<alpine.LNX.2.20.3.1509241247300.1399(a)localhost.localdomain>
Content-Type: text/plain; charset=US-ASCII; format=flowed
On Thu, 24 Sep 2015, Allin Cottrell wrote:
> On Thu, 24 Sep 2015, Raul Gimeno wrote:
>>
>> 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.
In fact the "nls" command should do the job more simply, as in:
<hansl>
series S = S0
nls y = S
S = S0
S = alpha * y(-1) + (1-alpha) * S(-1)
params alpha
end nls -v
</hansl>
where y is a data series, S is the series to hold the EMA, and S0 and alpha
are suitably initialized scalars. (This is the Hunter variant of EMA, where
S(t) is based on y(t-1) rather than y(t).)
Allin Cottrell
------------------------------
Message: 2
Date: Fri, 25 Sep 2015 11:05:33 +0200
From: "Raul Gimeno" <mrexito(a)vtxmail.ch>
To: <gretl-users(a)lists.wfu.edu>
Subject: [Gretl-users] exponential moving average
Message-ID: <007e01d0f771$55c01080$01403180$(a)vtxmail.ch>
Content-Type: text/plain; charset="iso-8859-1"
Dear Allin
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
series.
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
Raul Gimeno
-----Urspr?ngliche Nachricht-----
Von: gretl-users-bounces(a)lists.wfu.edu
[mailto:gretl-users-bounces@lists.wfu.edu] Im Auftrag von
gretl-users-request(a)lists.wfu.edu
Gesendet: Donnerstag, 24. September 2015 18:00
An: gretl-users(a)lists.wfu.edu
Betreff: Gretl-users Digest, Vol 104, Issue 35
Send Gretl-users mailing list submissions to
gretl-users(a)lists.wfu.edu
To subscribe or unsubscribe via the World Wide Web, visit
http://lists.wfu.edu/mailman/listinfo/gretl-users
or, via email, send a message with subject or body 'help' to
gretl-users-request(a)lists.wfu.edu
You can reach the person managing the list at
gretl-users-owner(a)lists.wfu.edu
When replying, please edit your Subject line so it is more specific than
"Re: Contents of Gretl-users digest..."
Today's Topics:
1. Re: exponential moving average (Allin Cottrell)
----------------------------------------------------------------------
Message: 1
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
Message-ID:
<alpine.LNX.2.20.3.1509240907410.1399(a)localhost.localdomain>
Content-Type: text/plain; charset=US-ASCII; format=flowed
On Thu, 24 Sep 2015, Raul Gimeno wrote:
> Dear Allin
>
> 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
> calculation?
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 "variable"
> 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 Gretl
>
>
>
> 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:
> 354.2625
>
> 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
(http://www.itl.nist.gov/div898/handbook/pmc/section3/pmc324.htm ) 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.
Allin Cottrell
------------------------------
_______________________________________________
Gretl-users mailing list
Gretl-users(a)lists.wfu.edu
http://lists.wfu.edu/mailman/listinfo/gretl-users
End of Gretl-users Digest, Vol 104, Issue 35
********************************************
------------------------------
Message: 3
Date: Fri, 25 Sep 2015 11:53:24 +0200
From: Sven Schreiber <svetosch(a)gmx.net>
To: gretl-users(a)lists.wfu.edu
Subject: Re: [Gretl-users] exponential moving average
Message-ID: <56051994.9020104(a)gmx.net>
Content-Type: text/plain; charset=windows-1252; format=flowed
Am 25.09.2015 um 11:05 schrieb Raul Gimeno:
>
> 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 am not convinced that minimizing the SSE is the universally appropriate
goal here. The trivial solution to obtaining a perfect fit is not to smooth
in the first place, so somehow this problem strikes me as ill-defined.
I am open for discussion, but as of now I would be opposed to this
"feature".
sorry,
sven
------------------------------
Message: 4
Date: Fri, 25 Sep 2015 07:38:12 -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
Message-ID:
<alpine.LNX.2.20.3.1509250730310.5509(a)localhost.localdomain>
Content-Type: text/plain; charset=US-ASCII; format=flowed
On Fri, 25 Sep 2015, Raul Gimeno wrote:
> 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 [...]
OK, I've taken another look at the literature and I accept your point:
it seems to be more common, when using the Roberts EMA formulation, to take
the initializer as a "pre-sample" value and therefore to start calculating
the filter at observation 1. The gretl code is now modified accordingly in
CVS and snapshots.
A couple of other modifications:
(1) I see that it's quite common for the EMA initializer to be an "a priori"
value. That's now supported in the EMA dialog, and also in the
movavg() function which now has an optional 4th argument for supplying an
initial value.
(2) The EMA dialog now has a Help button which gives some details and refers
to the movavg() function.
Allin Cottrell
------------------------------
Message: 5
Date: Fri, 25 Sep 2015 07:53:46 -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
Message-ID:
<alpine.LNX.2.20.3.1509250738210.5509(a)localhost.localdomain>
Content-Type: text/plain; charset=US-ASCII; format=flowed
On Fri, 25 Sep 2015, Sven Schreiber wrote:
> Am 25.09.2015 um 11:05 schrieb Raul Gimeno:
>
>> 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 am not convinced that minimizing the SSE is the universally
> appropriate goal here. The trivial solution to obtaining a perfect fit
> is not to smooth in the first place, so somehow this problem strikes me as
ill-defined.
>
> I am open for discussion, but as of now I would be opposed to this
> "feature".
I share Sven's skepticism on this point. And as I've mentioned, it's easy to
do this using the "nls" command if you really want to.
IMO, calculating the min-SSE parameter makes sense only if one uses the
Hunter version of the EMA, s(t) = a*y(t-1) + (1-a)*s(t-1), in which case you
can't get a trivial perfect fit. But I notice that in this case there's no
guarantee that the "optimal" a satisfies 0 < a < 1.
Interestingly enough, the example given on the NIST website
http://www.itl.nist.gov/div898/handbook/pmc/section4/pmc431.htm has a local
SSE minimum at about a = -0.12 and a global minimum at about 1.68, with
nothing resembling a minimum in the "legitimate" range.
(Although they talk about applying the Marquardt procedure they don't
mention the result!)
Allin
------------------------------
Message: 6
Date: Fri, 25 Sep 2015 09:10:47 -0600
From: Cameron Heimerdinger <crh2010(a)rams.colostate.edu>
To: Gretl list <gretl-users(a)lists.wfu.edu>
Subject: [Gretl-users] Testing for homogeneity
Message-ID:
<CAJ_MJ7f7Y8aH5CxG+THTmURTM1c7bgFZjZqB2iFfVbX0Oh6Wmw(a)mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
Is there an easy way in gretl to test whether or not a demand model
supports homogeneity?
Sincerely,
Cameron Heimerdinger
Masters Student, Agricultural, Environment and Resource Economics Admin
Assistant, Colorado State Forest Service
(970) 817-3943
crh2010(a)rams.colostate.edu
9 years
Testing for homogeneity
by Cameron Heimerdinger
Is there an easy way in gretl to test whether or not a demand model
supports homogeneity?
Sincerely,
Cameron Heimerdinger
Masters Student, Agricultural, Environment and Resource Economics
Admin Assistant, Colorado State Forest Service
(970) 817-3943
crh2010(a)rams.colostate.edu
9 years