a rather aesthetic question
by Artur Bala
Hi,
Going through some iterative WLS I noticed the word "weights" in command
line and script editor appears *highlighted/bold* if it were a gretl
command but didn't find any reference to "weights" as a command.
Best
Artur
3 years, 11 months
appending (or joining) a plain time series into a panel
by Sven Schreiber
Hi everybody,
I know this has been discussed before, but I'm confused about the status
quo. I have a panel dataset with time dimension (years) from 1993
through 2018. Then I have a time series file (gretl format) ranging from
1991-2019, so slightly longer on both ends.
I have tried in vain using the "join" dialog to add that time series
into the panel, matching by the explicit "year" denomination, or
"$obsmajor" or whatever. (This is the release candidate.)
Now I actually know how to solve this, as described in the cheatsheet
section of the guide: Shorten the time series manually to match the
panel T length. But I'd like to know if there's anything I'm missing to
do it more elegantly (in the future).
thanks
sven
3 years, 11 months
Idempotency of residual maker matrix
by Alecos Papadopoulos
gretl 2020e Windows 64
I created a "residual maker" matrix M = I - X*inv(X'X)*X', which is
symmetric, non-invertible and idempotent. Below I have copied its
properties as printed out by gretl. It clearly states that the matrix is
"Not idempotent".
But It is, in theory and it is in practice: I performed the operation
M*M - M, and I got a matrix with zeros or numbers raised to the 10^{-16}
or even smaller.
*What does it take for gretl to characterize a matrix as idempotent?*
**************************************
Properties of matrix M
Rows 50
Columns 50
Rank 47
Square
Not idempotent
1-norm 3.0108809
Infinity-norm 3.0108809
Trace 47
Determinant 4.0749073e-047
Eigenvalues:
(1.586419e-015, 0)
(-1.300316e-015, 0)
(3.561026e-017, 0)
(1, 0)
(1, 0)
(1, 0)
(1, 0)
(1, 0)
(1, 0)
(1, 0)
(1, 0)
(1, 0)
(1, 0)
(1, 0)
(1, 0)
(1, 0)
(1, 0)
(1, 0)
(1, 0)
(1, 0)
(1, 0)
(1, 0)
(1, 0)
(1, 0)
(1, 0)
(1, 0)
(1, 0)
(1, 0)
(1, 0)
(1, 0)
(1, 0)
(1, 0)
(1, 0)
(1, 0)
(1, 0)
(1, 0)
(1, 0)
(1, 0)
(1, 0)
(1, 0)
(1, 0)
(1, 0)
(1, 0)
(1, 0)
(1, 0)
(1, 0)
(1, 0)
(1, 5.5511151e-017)
(1, -5.5511151e-017)
(1, 0)
--
Alecos Papadopoulos PhD
Athens University of Economics and Business
web: alecospapadopoulos.wordpress.com/
scholar:https://g.co/kgs/BqH2YU
3 years, 11 months
gretl release candidate: please test!
by Allin Cottrell
Hello all,
Today's (January 7) snapshot of gretl (still labeled 2020f-git) is a
release candidate, intended to become gretl 2021a. We'd be very
grateful if people could test it and report any bugs.
We are setting aside a week during which we'll make no changes to
the code other than fixing any bugs that are reported. If all goes
well 2021a will be released on Thursday of next week.
Translators: we've updated the translatable strings, so this would
be a good time to update your .po files.
Allin Cottrell
for the gretl team
3 years, 11 months
geo data
by Stefano
I have a little feature request inspired by the new geomapping function.
Assume a spatial dataset including info from a shape file. Now we can
easily produce maps, but to carry out spatial autocorrelation and
spatial regression analysis we need a spatial weight matrix. Considering
that all the coordinates info is included in the shape files, it would
be nice to be able to recover the coordinates of the centroids of the
units as an extra pair of variables. Then distance-based spatial weight
matrices can be easily constructed by the user with his preferred
formula (or using a contributed function taking the series with the
coordinates as inputs - I can volunteer for that, it'd be at most 10
lines of code :-) )
bye
Stefano
________________________________________________________________________
Stefano Fachin
Professore Ordinario di Statistica Economica
Dip. di Scienze Statistiche
"Sapienza" Università di Roma
P.le A. Moro 5 - 00185 Roma - Italia
Tel. +39-06-49910834
fax +39-06-49910072
web http://stefanofachin.site.uniroma1.it/
--
________________________________________________________
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.
--
3 years, 11 months
retrieve series name from within a function
by Artur Bala
Hi,
In the following code (as a simplified example), how do I retrieve the name
of the series Y so as the OLS output shows the actual name of the variable
instead of just "Y"? I use the "varnames()" for the X-list variables
names but couldn't come out with something feasible for Y
<\hansl
function matrix m (series Y , list X )
ols Y X
end function
<hansl>
Best,
Artur
3 years, 11 months
On leverage command
by Artur Bala
Dear all,
When I execute the "leverage --save" command on the command line, the
related series (lever, influ and dffits) are not shown in the Main windows
(but they are created) . Is this behaviour intended?
Moreover, if I save one of the 3 series with the command "series k=lever"
this makes appear on the Main window all the series produced by the
leverage command (along with the new "k" series).
Just for testing, I also tried the same commands in a script file. Nothing
strange happened and all the new generated series are shown right after the
leverage command is executed.
Best,
Artur
3 years, 11 months
State space modelling
by bjr.newmail@gmail.com
I wanted to estimate a model with a time varying parameter (on a simple linear trend) and would appreciate some guidance as I am not a programmer in Gretl's language.
1) Where in the GUI Model set of commands do you access the State Space modelling - is by writing the spec in the MLE option?
2) I loaded the example file AWM.gdt
3)Entered the commands below exactly as specified in the manual viz. Listing 34.4: Phillips curve on Euro data with time-varying slope
4) It died at the first line.
function void at_each_step(bundle *b)
b.obsymat = transp(b.mX[b.t,])
end function
open AWM.gdt --quiet
smpl 1974:1 1994:1
/* parameter initialization */
scalar b0 = mean(INFQ)
scalar s_obs = 0.1
scalar s_state = 0.1
/* bundle setup */
bundle B = ksetup(INFQ, 1, 1, 1)
matrix B.mX = {URX}
matrix B.depvar = {INFQ}
B.timevar_call = "at_each_step"
B.diffuse = 1
/* ML estimation of intercept and the two variances */
mle LL = err ? NA : B.llt
B.obsy = B.depvar - b0
B.obsvar = s_obs^2
B.statevar = s_state^2
err = kfilter(&B)
params b0 s_obs s_state
end mle
/* display the smoothed time-varying slope */
ksmooth(&B)
series tvar_b1hat = B.state[,1]
series tvar_b1se = sqrt(B.stvar[,1])
gnuplot tvar_b1hat --time-series --with-lines --output=display \
--band=tvar_b1hat,tvar_b1se,1.96 --band-style=fill
3 years, 11 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
-------------------------------------------------------
3 years, 11 months