Gretl & online teaching
by Stefano Fachin

Like Sven mentioned, conference programs like Meet, Teams and Skype have
the option of sharing the "desktop", which sends to the audience the
entire screen of the lecturer as seen by him/her (at least in Window, do
not know about Mac OS)
bye
Stefano
--
________________________________________________________
Le informazioni
contenute in questo messaggio di posta elettronica sono strettamente
riservate e indirizzate esclusivamente al destinatario. Si prega di non
leggere, fare copia, inoltrare a terzi o conservare tale messaggio se non
si è il legittimo destinatario dello stesso. Qualora tale messaggio sia
stato ricevuto per errore, si prega di restituirlo al mittente e di
cancellarlo permanentemente dal proprio computer.
The information contained
in this e mail message is strictly confidential and intended for the use of
the addressee only. If you are not the intended recipient, please do not
read, copy, forward or store it on your computer. If you have received the
message in error, please forward it back to the sender and delete it
permanently from your computer system.
--
5 months

Hamilton trend-cycle decomposition
by Riccardo (Jack) Lucchetti

Hi all,
yesterday, after having taught my students the HP decomposition, I
wondered if I should also tell them that one of the greatest time-series
econometricians on Earth recently wrote a rather scathing paper entitled
"Why You Should Never Use the Hodrick-Prescott Filter", where he proposes
a simple alternative.
So this morning I rustled up a little script with Hamilton's filter. Here
it is:
<hansl>
function series hamcycle(series y, bool do_plot[1], string title[null])
h0 = 2 * $pd
h1 = h0 + 4
list PROJ = y(-h0 to -h1)
ols y 0 PROJ -q
# ht = $yhat
hc = $uhat
if do_plot
if !exists(title)
title = argname(y)
endif
print title
diff8 = y - y(-h0)
setinfo diff8 --graph-name="Random walk"
setinfo hc --graph-name="Regression"
list PLT = diff8 hc
plot PLT
options time-series with-lines
literal set linetype 1 lc rgb "#ff0000"
literal set linetype 2 lc rgb "#000000"
literal set key top right
printf "set title '%s'", title
end plot --output=display
endif
return hc
end function
# example
nulldata 300
setobs 4 1947:1
open fedstl.bin
data gdpc1 expgsc1 pcecc96
list Y = gdpc1 expgsc1 pcecc96
LY = logs(Y)
strings Titles = strsplit("GDP Exports Consumption")
k = 1
# reproduce part of figure 6
loop foreach i LY --quiet
hc = hamcycle($i*100,,Titles[k++])
endloop
</hansl>
Should we turn this into a function package?
-------------------------------------------------------
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
-------------------------------------------------------
7 months

Save a MLE model
by Filipe Costa

I was trying to estimate a state space model, using MLE and I noticed that even though these can be saved to the session some models are lost when reopening the session. In the example below I'm trying to save the MLE estimation to the session with the name "model1", which is successful but then it's lost at reopening.
Any thoughts on why this happens and on an alternative to save the session?
<hansl>
clear
nulldata 200
set seed 101010
setobs 1 1 --special-time-series
/* set the true variance parameters */
true_s1 = 0.5
true_s2 = 0.25
/* and simulate some data */
v = normal() * sqrt(true_s1)
w = normal() * sqrt(true_s2)
mu = 2 + cum(v)
y = mu + w
/* starting values for variance estimates */
s1 = 1
s2 = 1
/* state-space model set-up */
bundle kb = ksetup(y, 1, 1, s1)
kb.obsvar = s2
kb.diffuse = 1
/* ML estimation of variances */
model1 <- mle ll = ERR ? NA : kb.llt
ERR = kfilter(&kb)
params kb.statevar kb.obsvar
end mle
/* compute the smoothed state */
ksmooth(&kb)
series muhat = kb.state
</hansl>
10 months

Trying out Octave for the first time in Mac, and it is not working
by Fred Engst

Hi all,
I have downloaded both Octave 4.4.1 disk image & 5.2.0 source code. After installing 4.4.1, and linking gretl’s path to "Octave 4.4.1/Contents/MacOS/applet", I was not able to run the example from the gretl documentation in Chapter 41:
———————————————————————————
open data4-1
matrix m = { dataset }
mwrite(m, "gretl.mat", 1)
foreign language=Octave
gmat = gretl_loadmat("gretl.mat")
end foreign
—————————————————————————
Once I run this, the Octave opens up with a command window, and nothing else is going on. The spinning wheal just keeps on spinning in gretl. Only after I quit Octave will gretl come to life with a script output saying nothing interesting:
——————————————————————————
gretl version 2020d
Current session: 2020-09-29 18:20
? open data4-1
Read datafile /Applications/Gretl.app/Contents/Resources/share/gretl/data/ramanathan/data4-1.gdt
periodicity: 1, maxobs: 14
observations range: 1 to 14
Listing 5 variables:
0) const 1) price 2) sqft 3) bedrms 4) baths
? matrix m = { dataset }
Generated matrix m
? mwrite(m, "gretl.mat", 1)
? foreign language=Octave
? gmat = gretl_loadmat("gretl.mat")
? end foreign
———————————————————————————
What am I doing wrong?
Thanks in advance for your help,
Fred
10 months

Store simple data from a model
by Filipe Costa

Dear Gretl users,
I was trying to retrieve some data from an estimated model but I'm not sure that's possible.
An example:
<hansl>
open australia.gdt
# simple ols model
ols E 0 PAU PUS
# scalars for the coefficients
coef1 = $coeff[1]
coef2 = $coeff[2]
# scalars for the standard errors
stderr1 = $stderr[1]
stderr2 = $stderr[2]
</hansl>
Is it possible to retrieve data for the test statistic and p-value for the independent variables like I do for the coefficient and standard error estimations?
Thanks,
Filipe
10 months

specific bandwidth for kernel/HAC estimation
by Sven Schreiber

Hi,
there is some old code by Jack that implements a specific data-based
bandwidth choice for the typical estimation of the long-run
(co)variance. It is primarily meant for a quadratic kernel. I'm
including the hansl function at the end.
My question is: Is that choice somehow already implemented in gretl
through some "set" option? I know I can choose the quadratic kernel via
"set hac_kernel qs", and its bandwidth via "set qs_bandwidth
<something>". But is there something built-in that sets the bandwidth to
what the function below returns?
If not, would it make sense to add that option?
thanks
sven
--------
function matrix c_bandw (const matrix vhat)
# procedure that computes the automatic bandwidth based on AR(1)
# approximation for each vector of the matrix vhat. Each are given
# equal weigths of 1.
nt = rows(vhat)
matrix vt = vhat[2:nt, ]
matrix vlag = vhat[1:nt-1, ]
matrix b = sumc(vt .* vlag) ./ sumc(vlag.^2)
matrix tmp = (1 - b) .^ 4
matrix res = vt - vlag .* b
matrix sig = sdc(res) .^ 2
matrix a2n = sumr( (2 .* b .* sig) .^2 ./ tmp )
matrix a2d = sumr( sig .* sig ./ tmp )
matrix a2 = sumr(a2n) / sumr(a2d)
return 1.3221 * (a2 * nt) .^ 0.2
end function
10 months, 1 week

yahoo_get.gfn - (1) RHT ticker and (2) non-existent ticker will give NAs
by Ioannis A. Venetis

Hello all, especially Jack who wrote the package!!!.
I run gretl2020d on Windows (I think last version of them).
Also I installed yahoo_get 3.0
When running yahoo_get.gfn sample script I get two "errors"
(1) It does not find the redhat ticker
? series redhat = yahoo_price("RHT") # get Red Hat, adjusted price only
Ticker RHT not found
Generated series redhat (ID 1)
(2) it does not fill non-existent ticker with NAs (if that's the
expected function here). I get the following
? series foo = yahoo_price("ZZZ") # a non-existent ticker will give
NAs
An error occurred when 'outfile' was active
jsonget: failed to match JsonPath
*** error in function json2csv, line 1
> dates = strsplit(jsonget(jsonbuf, "$.chart.result[0].timestamp[*]"), "\n")
called by function write_tempfile
called by function yahoo_price
Error executing script: halting
> series foo = yahoo_price("ZZZ") # a non-existent ticker will give NAs
10 months, 2 weeks

Repeated crashes while copying and pasting graphs from gretl to powerpoint
by Fred Engst

Hi Allin,
Today gretl crashed quite a few times, each time while I was trying to copy a graph that I've saved to icon view and past it onto powerpoint slide.
Not all copy and past crashes, just after I do some editing and then trying to copy and past. So far I have not been able to isolate under what condition it will cause a crash.
Here are the first few lines of the crash report:
Process: gretl [84502]
Path: /Applications/Gretl.app/Contents/MacOS/gretl
Identifier: net.sourceforge.gretl
Version: 2020c-git
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: gretl [84502]
User ID: 502
Date/Time: 2020-09-13 10:27:19.343 +0800
OS Version: Mac OS X 10.14.6 (18G6020)
Report Version: 12
Bridge OS Version: 4.6 (17P6065)
Anonymous UUID: D0C17D83-C8DE-88A8-08E7-19E42233A73F
Sleep/Wake UUID: 81648553-B133-4CC9-B07F-49D8C2578A6A
Time Awake Since Boot: 280000 seconds
Time Since Wake: 57000 seconds
System Integrity Protection: enabled
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000070
Exception Note: EXC_CORPSE_NOTIFY
Termination Signal: Segmentation fault: 11
Termination Reason: Namespace SIGNAL, Code 0xb
Terminating Process: exc handler [84502]
attached is the full report.
If I can figure out what exactly causes the crash, I will update you.
Best,
Fred
10 months, 3 weeks

series indexing
by Riccardo (Jack) Lucchetti

A user wrote me in private, asking me about some oddities on series
indexing via strings. I put together a little example:
<hansl>
nulldata 4
xs = normal(2,1)
setobs 1 2000 --time-series
# 1: this works
xs["2000"] = 3
# 2: this works too
a = sprintf("\"2000\"")
xs[@a] = 33
# 3: this doesn't
a = "2000"
xs[a] = 33
</hansl>
if assignments 1 and 2 work, one sees no reason why 3 shouldn't work too.
Or ami I missing something obvious?
-------------------------------------------------------
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
-------------------------------------------------------
10 months, 3 weeks