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?
5 years, 1 month

Feature Request: "--preserve" option
by Henrique Andrade

Dear Gretl Team,
We can use the option "--preserve" with the "open" command to preserve
matrices and scalars. I would like to ask you if it is possible to include
strings too (so the "preserve" option will preserve matrices, scalars, and
strings).
Best regards,
Henrique Andrade
6 years, 1 month

Forecasting variance of a GARCH model
by Karthik Raju

Hello,
I am writing to seek help to forecast volatility of index returns using
GRETL.
In GRETL, I want to know how to perform in the sample and out of sample
forecasting after estimating index return series by using GARCH variants
in the gig package.
Thank you.
Best,
Karthik
6 years, 4 months

gnuplot: 2nd yaxis
by Artur T.

I've got another question regarding gnuplot. At the moment gretl
automatically draws a 2nd yaxis (if it is not suppressed by the
"--single-yaxis" option) if a certain criteria is fulfilled. However, is
there a way to specify manually a separate variable (or a list of vars)
to a 2nd yaxis?
Of course one could write a function doing so; more concretely
specifying the necessary lines such as
<gnuplot>
.
.
.
set y2tics
plot \
'-' using 1:($2) axes x1y2 title "LRY (right)" w lines, \
'-' using 1:($2) axes x1y1 title "d_LRY (left)" w lines
.
.
</gnuplot>
but if it could be done within the literal-framework it much simpler...
This is not a feature request -- writing a script is quickly done as
I've got some templates for this.
Best,
Artur
6 years, 5 months

Re: [Gretl-users] Regression with ex-ante boundaries imposed on forecasted values (Sven Schreiber)
by Daniel Bencik

>Am 24.02.2015 um 13:53 schrieb Daniel Bencik:
>> Dear forum,
>>
>> this is more of a question related to econometrics. When, for
>> example, your goal is to model/forecast weekly highs/weekly lows,
>> when you run your regression on Tuesdays, you already know that the
>> model should not predict a weekly high below the Monday's high. The
>> Wednesday's prediction of the whole week's high should not be below
>> max(mondayHigh, tuesdayHigh). My questions is whether there is an
>> econometric tool/approach that is capable of estimating a model
>> bearing this in mind. That is, I want the estimated coefficients to
>> take into account, that the forecasts should not be below/above some
>> value which changes over time (i.e. it is not a constant like e.g.
>> zero or something).
>>
>
>If I understand your question correctly, there is a trivial solution,
>although you may not like it: Produce forecasts with standard tools, and
>then apply your time-varying max() operator.
>
>Or you could specify your model in terms of squared deviations (or the
>negative of that) centered on your previous high, and your restriction
>would hold. I'm not sure that makes much sense, but econometrically it's
>not a big deal unless you also want to have some other optimality
>properties.
>
>cheers,
>sven
Sven,
thank you much. I thought about the second idea. So instead of
weeklyHigh[t] = f(....) + a*monHigh[t] + eps
I should regress
weeklyHigh[t] - monHigh[t] = g(...) + eps2
where eps2 is a positive distributed error, right? I am asking beucase this still poses some issues and mostly does not guarantee that the predicted weeklyHigh[t] - monHigh[t] < 0.
Thank you,
Daniel
6 years, 5 months

unbalanced panel data problem
by Randy Kesselring

At first this seemed a simple problem to me, but I have failed to find a solution. I have a very large unbalanced panel data set that I am having difficulty declaring as such. The data set includes a numerical year variable and a numerical month variable (1-12). Then, there are a large number of observations whose numbers vary per month. Gretl had no problem reading the data set, but it was read as undated. At first I thought I simply needed a time index that included both the year and month information in a single variable. So, I created this: series tindex = year + month/100. This created the expected numerical variable. But, when I tried to use this as an index variable in the panel data structure declaration, it doesn't show up in the drop down menu. This made me hesitant to try it in a Hansl script. I'm sure that I have misunderstood something quite simple, but I would appreciate some direction.
6 years, 5 months

gnuplot: issue plotting monthly data in a panel
by Artur T.

Dear all,
I have a panel dataset and want to plot certain variables over time. I
constructed a time index applying: tindex = year*100 + month, and hence
I obtain for November 2014 something like "201411".
For plotting, the following command is used under a previously
restricted dataset (evaluate data only for a single country using):
<hansl>
smpl country==1 --restricted
gnuplot x1 x2 tindex --with-lines --single-yaxis --output="@fname" \
{ set term eps font 'Helvetica,13' lw 3 ; \
set xdata time ; \
set timefmt "%Y%m" ; set format x "%m/%Y" ; }
</hansl>
Unfortunately, the x-axis is not correctly shown. The temporary output
text-file you can find below. Does anybody have a clue what's wrong here?
Thanks,
Artur
<tmp_file>
set term post eps enhanced color solid
set output "/home/.../figs/ts_inflation_DE.eps"
set xlabel 'tindex'
set xzeroaxis
set datafile missing "?"
set key left top
set xrange [200068.225:201444.775]
# start literal lines
set term eps font 'Helvetica,13' lw 3
set ylabel 'in percent'
set key bottom horizontal outside
set yrange[-11.4089 : 15.8523]
set xdata time
set timefmt "%Y%b"
set format x "%m %Y"
# end literal lines
plot \
'-' using 1:($2) title "Overall" w lines , \
'-' using 1:($2) title "Energy" w lines
200001 ? # 2000:1
200002 ? # 2000:2
200003 ? # 2000:3
200004 ? # 2000:4
200005 ? # 2000:5
200006 ? # 2000:6
200007 ? # 2000:7
200008 ? # 2000:8
200009 ? # 2000:9
200010 ? # 2000:10
200011 ? # 2000:11
200012 ? # 2000:12
200101 1.307189542 # 2001:1
200102 1.739130435 # 2001:2
200103 1.739130435 # 2001:3
200104 2.176278564 # 2001:4
.
.
.
e
200001 ?
200002 ?
200003 ?
200004 ?
200005 ?
200006 ?
200007 ?
200008 ?
200009 ?
200010 ?
200011 ?
200012 ?
200101 9.408602151
200102 11.88251001
200103 8.842652796
.
.
.
e
</tmp_file>
6 years, 5 months

Fwd: Re: gnuplot: issue plotting monthly data in a panel
by Artur T.

Hi Sven,
you're right I should be more precisely. You can find the resulting
graph attached -- it is simply empty. Using gretl's internal
"--time-series" option works but for some reason the time-dates
disappear for a restricted panel and the x-axis is just a sequence from
1 to T.
Artur
On 27.02.2015 09:00, Sven Schreiber wrote:
> Am 27.02.2015 um 08:24 schrieb Artur T.:
>
>> <hansl>
>> smpl country==1 --restricted
>> gnuplot x1 x2 tindex --with-lines --single-yaxis --output="@fname" \
>> { set term eps font 'Helvetica,13' lw 3 ; \
>> set xdata time ; \
>> set timefmt "%Y%m" ; set format x "%m/%Y" ; }
>> </hansl>
>>
>> Unfortunately, the x-axis is not correctly shown. The temporary output
>> text-file you can find below. Does anybody have a clue what's wrong here?
>>
> Well, what do you mean by "not correctly shown", what is happening?
>
> -sven
6 years, 5 months

VARs: Historical FEVD and restrictions
by Gabriela Nodari

Dear Gretl users,
I have two questions concerning VARs:
1. Is there any built in function in gretl for historical forecast error
variance decompositions?
2. Is it possible to estimate a recursive linear VAR imposing zero
restrictions on some coefficients? That is, is it possible to estimate a
VAR with a block exogenous set of variables?
Thank you,
Gabriela
6 years, 5 months

Re: [Gretl-users] Please Professor Lucchetti: question concerning ARMA model with Garch errors in Gretl
by Riccardo (Jack) Lucchetti

On Wed, 25 Feb 2015, kaffel bilel wrote:
> Dear Professor Lucchetti,Hello,I hope that I am notdisturbing you
> I am Bilel Kaffel.
[...]
> My problem is: I want to know how can I estimate the parameters of an
> ARMA model with Garch errors in Gretl?. For exemple : ARMA(1,2) model
> with Garch(1,1) errors. The parameters will need to be estimate
> simultaneously. Please Professor: can you help me?
Two things:
(1) I strongly advise you to subscribe to the gretl user list and ask
these questions there: not only you have a much better chance of receiving
an answer in a short time, you will also benefit the gretl community
because your question (and the subsequent answers) will be archived and
made public (and, most importantly, googleable). For this reason, I'm
replying to you with the user mailing list in cc. You can browse the
archives here:
http://lists.wfu.edu/pipermail/gretl-users/
(2) Here is a sample script that estimates an arma(1,1) + garch(1,1). I'm
sure that by studying this example together with the gretl manuals you'll
find it quite easy to generalise it to the case of your interest:
<hansl>
set echo off
set messages off
function series arma_garch_flt(series y, matrix param, scalar p, scalar q)
scalar m = param[1]
matrix arpar = param[2:p+1]
matrix mapar = param[p+2:p+q+1]
scalar c = param[p+q+2]
scalar a = param[p+q+3]
scalar b = param[p+q+4]
series ret = NA
# --- checks
# stationarity
matrix roots = polroots(1 | -arpar)
check = minc(abs(sumr(roots.^2))) > 1
# invertibility
matrix roots = polroots(1 | mapar)
check = check && minc(abs(sumr(roots.^2))) > 1
# garch param
check = check && (c>0) && (a > 0) && (b>=0) && (a+b<1)
if check
scalar hlag = c/(1-a-b)
series ret = -0.5*ln(2*$pi) # the loglikelihood
series e = filter(y - m, 1 | -arpar, -mapar, m)
series e2 = e^2
scalar h_unc = c/(1-a-b)
series e2lag = ok(e(-1)) ? e(-1)^2 : h_unc
series h = filter(c + a*e2lag, 1, b)
series ret = -0.5*(2*$pi) - 0.5*ln(h) - 0.5*e2/h
endif
return ret
end function
# ------------------------------------------------------------------------
open djclose.gdt --quiet
series r = 100 * ldiff(djclose)
arima 1 1 ; r
armapar = $coeff
garch 1 1 ; r
garchpar = $coeff[2:]
param = armapar | garchpar
mle ll = arma_garch_flt(r, param, 1, 1)
params param
end mle -v
</hansl>
-------------------------------------------------------
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
-------------------------------------------------------
6 years, 5 months