Function to get the powerset
by Henrique Andrade

Dear Gretl Community,
I really stuck trying to define a function that gives a power set of a
set. Suppose I have a set S:
S = {"A", "B", "C"}
The associated power set, P(S), is:
P(S) = {{ }, {"A"}, {"B"}, {"C"}, {"A", "B"}, {"A", "C"}, {"B", "C"},
{"A", "B", "C"}}
All that I can think by now (shame on me!) is this:
strings S = defarray("A", "B", "C")
scalar P_S_len = 2^nelem(S) # the size of the power set
strings P_S = array(P_S_len) # an array with 8 spaces.
Does anyone have any ideas?
Best,
Henrique Andrade
4 years, 5 months

warning: gdt-reading bug
by Allin Cottrell

We've just noticed that a bug was introduced into our code for reading
native gretl .gdt data files in August of this year. The bug should be
triggered only rarely, but we thought it wise to issue a warning.
Description of bug: If a gdt file contains "subnormal" values (that
is, floating point values that are too close to zero to be represented
with the usual precision), then when such a file is read on Linux, the
first subnormal value to be found on a given row (observation) will be
incorrectly copied into the remaining columns (series) on that row.
Example: A gdt file containing 10 series has a subnormal for series
number 5 on row 25. Then when the file is read on Linux, that
subnormal will replace the correct values for series 6 to 10 for
observation 25.
Comment: This won't affect the reading of "primary" data (actual
micro- or macroeconomic measurements), which will never contain
subnormal values (we're talking about absolute values less than 10 to
the minus 307). And the bug is not triggered on MS Windows. However,
subnormal values may be produced by some data transformations (such as
squaring very small numbers, or computing the normal CDF of very big
negative values).
Fix: This is now fixed in the git source for gretl and also the
current snapshots. And we will put out a new release soon, gretl
2015d.
Diagnostic: If you think a dataset may suffer from this problem,
you can run the script checkdata.inp, from
http://ricardo.ecn.wfu.edu/pub/gretl/checkdata.inp
First load the dataset in question. Then open checkdata.inp and run
it. An affected dataset may produce something like this:
<script-output>
Total number of values examined: 164122
Check for subnormal floating-point values
-----------------------------------------
Total number found: 138
Longest (row) sequence: 138
(occurs at obs 210, starting series ID 461)
Number of sequences (of length >= 2): 1
</script-output>
The symptom of a problem is that we find a consecutive sequence of
subnormal values on one or more rows of the dataset. This could occur
for "natural" reasons but it may indicate corruption. Isolated
subnormals don't indicate the bug. And again, most datasets should
contain no subnormal values.
Allin Cottrell
6 years, 5 months

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?
6 years, 9 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
**
6 years, 10 months

Compaction : "This conversion is not supported"
by Marc O'Callaghan

Dear all,
I have a time series, which comprises 31 observations per year (actually the observations for March, set in a time series with periodicity 31). My wish is to compact it to the daily average, i.e. end up with 31 observations, each of which represents the average value of that date throughout the available years. I therefore sought to compact it with "dataset compact 31", to which I was told "This conversion is not supported". I then tried other conversions, but it appears no expansion or compaction is accepted at all.
I assume this is due to the unorthodox periodicity, but my question is then: how can I successfully compact my data into 31 average values ?
Best,
Marc O'Callaghan
7 years

dynamic genr (forwarded)
by Allin Cottrell

Ignacio Mauleón writes:
<quote>
Hi,
Does anyone know how to generate dynamically a variable, without
previously estimating a model?. What I am looking for is how to
replicate the dynamic genr command in TSP. And more generally, how to
define and simulate dynamic models.
Thanks.
</quote>
Answer: "genr" in gretl is automatically dynamic, when the
expression involves a lagged dependent variable. For example, the
following gives you a series that grows at 2 percent.
<hansl>
nulldata 50
setobs 1 1960
series y = 100
y = 1.02 * y(-1)
print y -o
</hansl>
You also have the filter() function for easy construction of
relatively complicated dynamics.
Allin Cottrell
7 years, 1 month

Re: [Gretl-users] Gretl-users Digest, Vol 109, Issue 23
by Habib Nawaz

Hi Gretl-Users
Is the panel unit root test developed by Hashem Pesaran in 2012 "On the Interpretation of Panel Unit Root Tests" is available in gretl. If yes, then how can I find in gretl and how can I apply it.
Please reply to me with step by step procedure.Thanks Habib Nawaz Khan,PhD Scholar (Statistics/Econometrics),UTP, Malaysia,Cell # 0061126434405
From: "gretl-users-request(a)lists.wfu.edu" <gretl-users-request(a)lists.wfu.edu>
To: gretl-users(a)lists.wfu.edu
Sent: Wednesday, February 17, 2016 10:00 PM
Subject: Gretl-users Digest, Vol 109, Issue 23
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: PDF of a multivariate normal (Summers, Peter)
2. Re: displayed Engle-Granger model missing terms (Sven Schreiber)
3. Re: PDF of a multivariate normal (Sven Schreiber)
4. Re: PDF of a multivariate normal (Allin Cottrell)
----------------------------------------------------------------------
Message: 1
Date: Wed, 17 Feb 2016 03:05:43 +0000
From: "Summers, Peter" <psummers(a)highpoint.edu>
To: Gretl list <gretl-users(a)lists.wfu.edu>
Subject: Re: [Gretl-users] PDF of a multivariate normal
Message-ID: <E57CD365-FD65-4551-AE05-BD234E628968(a)highpoint.edu>
Content-Type: text/plain; charset="Windows-1252"
Clive,
Artur's version of gretl is newer than yours or mine (though I've since updated). The integer requirements for seq() have been removed.
PS
Sent from my iPad
On Feb 16, 2016, at 9:33 PM, Clive Nicholas <clivelists(a)googlemail.com<mailto:clivelists@googlemail.com>> wrote:
Thanks Peter, that sorted it. Do remember that this wasn't my code, so how Artur's original code worked for him I've no clue.
C
On 16 February 2016 at 18:50, Summers, Peter <psummers(a)highpoint.edu<mailto:psummers@highpoint.edu>> wrote:
Clive,
The arguments to seq() all have to be integers. Try replacing that line with ?matrix x = seq(-30,32,2)./10?
PS
From: gretl-users-bounces(a)lists.wfu.edu<mailto:gretl-users-bounces@lists.wfu.edu> [mailto:gretl-users-bounces@lists.wfu.edu<mailto:gretl-users-bounces@lists.wfu.edu>] On Behalf Of Clive Nicholas
Sent: Tuesday, February 16, 2016 1:27 PM
To: r.lucchetti(a)univpm.it<mailto:r.lucchetti@univpm.it>; Gretl list
Subject: Re: [Gretl-users] PDF of a multivariate normal
Jack,
Artur's code chokes for me when I run your function code:
gretl version 2016a-git
Current session: 2016-02-16 18:17
Invalid argument
Error executing script: halting
> matrix x = seq(-3,3.2,0.2)
I wonder why? My -gretl-'s fully up to date!
C
On 16 February 2016 at 15:26, Riccardo (Jack) Lucchetti <r.lucchetti(a)univpm.it<mailto:r.lucchetti@univpm.it>> wrote:
On Tue, 16 Feb 2016, Artur T. wrote:
Ok, I changed the definition of the constant k. However, there is still
some difference to the outcome using MATLAB...
Hehe. We're convergiung to the truth: here's the correct one --- I think!
<hansl>
function matrix mnormal_pdf(matrix x, matrix m, matrix Sigma)
# x should be n x k (n k-dimensional vectors)
# m should be a k-vector of means
# Sigma should be a kxk pd matrix
scalar k = cols(x)
scalar n = rows(x)
if k != rows(m)*cols(m)
return mshape(NA, n, 1)
endif
scalar dS = det(Sigma)
if dS <= 0
return mshape(NA, n, 1)
endif
matrix U = x .- vec(m)'
matrix U = U .* (U/Sigma)
scalar k = dS * (2*$pi)^k
return exp(-0.5*sumr(U)) / sqrt(k)
end function
</hansl>
Actually I was a little surprised about Jack's suggestion also with
respect to what it does. I thought a function is wanted that also does
the RNG inside.
No, it is really just about computing the pdf.
Generating a sample of n independent Gaussian pseurdo-rvs with mean m and covariance Sigma is rather trivial, in fact:
<hansl>
n = 20000
m = {1, 2, 3}
Sigma = {4,1,-1;1,4,1;-1,1,4}
A = mnormal(n, 3) * cholesky(Sigma)' .+ m
eval meanc(A)
eval mcov(A)
</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<mailto:r.lucchetti@univpm.it>
http://www2.econ.univpm.it/servizi/hpp/lucchetti
-------------------------------------------------------
_______________________________________________
Gretl-users mailing list
Gretl-users(a)lists.wfu.edu<mailto:Gretl-users@lists.wfu.edu>
http://lists.wfu.edu/mailman/listinfo/gretl-users
--
Clive Nicholas
"My colleagues in the social sciences talk a great deal about methodology. I prefer to call it style." -- Freeman J. Dyson
_______________________________________________
Gretl-users mailing list
Gretl-users(a)lists.wfu.edu<mailto:Gretl-users@lists.wfu.edu>
http://lists.wfu.edu/mailman/listinfo/gretl-users
--
Clive Nicholas
"My colleagues in the social sciences talk a great deal about methodology. I prefer to call it style." -- Freeman J. Dyson
_______________________________________________
Gretl-users mailing list
Gretl-users(a)lists.wfu.edu<mailto:Gretl-users@lists.wfu.edu>
http://lists.wfu.edu/mailman/listinfo/gretl-users
------------------------------
Message: 2
Date: Wed, 17 Feb 2016 10:11:56 +0100
From: Sven Schreiber <svetosch(a)gmx.net>
To: gretl-users(a)lists.wfu.edu
Subject: Re: [Gretl-users] displayed Engle-Granger model missing terms
Message-ID: <56C4395C.2040901(a)gmx.net>
Content-Type: text/plain; charset=utf-8; format=flowed
Am 17.02.2016 um 03:21 schrieb Salman Khan:
>
> Step 2 is where i have concerns since I was expecting a b0 term in
> model: (1-L)y = (a-1)*y(-1) + ... + e I explicitly chose to include a
> constant, therefore I was expecting something like: model: (1-L)y =
> b0 + (a-1)*y(-1) + ... + e
Allin is quite right, there had better not be a constant in the final
step. If you were expecting it in there, then I recommend to refresh
your Engle-Granger memory. (Hint: We're talking about estimated OLS
residuals here.)
cheers,
sven
------------------------------
Message: 3
Date: Wed, 17 Feb 2016 10:15:39 +0100
From: Sven Schreiber <svetosch(a)gmx.net>
To: gretl-users(a)lists.wfu.edu
Subject: Re: [Gretl-users] PDF of a multivariate normal
Message-ID: <56C43A3B.2020403(a)gmx.net>
Content-Type: text/plain; charset=windows-1252; format=flowed
Am 16.02.2016 um 22:18 schrieb Allin Cottrell:
> On Tue, 16 Feb 2016, Clive Nicholas wrote:
>
>> Actually, I'm on 2016a-git and I would very much appreciate it if we were
>> told via the list when a new (mini-)version of -gretl- has been rolled
>> out.
>> I never hear anything about them.
>
> That's what gretl-announce is for. See
> http://lists.wfu.edu/mailman/listinfo/gretl-announce
>
Of course you're right in principle, but I tend to agree with Clive that
a copying the announcement on gretl-users wouldn't hurt. It seems to me
that gretl-announce is for those that don't want to receive any other news.
thanks,
sven
------------------------------
Message: 4
Date: Wed, 17 Feb 2016 08:27:57 -0500 (EST)
From: Allin Cottrell <cottrell(a)wfu.edu>
To: Gretl list <gretl-users(a)lists.wfu.edu>
Subject: Re: [Gretl-users] PDF of a multivariate normal
Message-ID:
<alpine.LNX.2.20.3.1602170827010.20694(a)localhost.localdomain>
Content-Type: text/plain; charset=US-ASCII; format=flowed
On Wed, 17 Feb 2016, Sven Schreiber wrote:
> Am 16.02.2016 um 22:18 schrieb Allin Cottrell:
>> On Tue, 16 Feb 2016, Clive Nicholas wrote:
>>
>>> Actually, I'm on 2016a-git and I would very much appreciate it if we were
>>> told via the list when a new (mini-)version of -gretl- has been rolled
>>> out.
>>> I never hear anything about them.
>>
>> That's what gretl-announce is for. See
>> http://lists.wfu.edu/mailman/listinfo/gretl-announce
>>
>
> Of course you're right in principle, but I tend to agree with Clive that a
> copying the announcement on gretl-users wouldn't hurt. It seems to me that
> gretl-announce is for those that don't want to receive any other news.
Fair enough. We could send a short message with a link to the
ChangeLog to gretl-users.
Allin
------------------------------
_______________________________________________
Gretl-users mailing list
Gretl-users(a)lists.wfu.edu
http://lists.wfu.edu/mailman/listinfo/gretl-users
End of Gretl-users Digest, Vol 109, Issue 23
********************************************
7 years, 1 month

displayed Engle-Granger model missing terms
by Salman Khan

Hello,
I have a toy time series dataset consisting of two variables. Running Engle-Granger tests, I noticed that the displayed "model" in step 2 looks misspecifed. It could just be an optical issue since the calculated values seem fine (haven't double check against another package). Regardless of the option chosen in the dialog box (constant, constant with trend, constant and quadratic), the resulting model in step 2 is listed as:
model: (1-L)y = (a-1)*y(-1) + ... + e
However, Step 1 seems to be fine wherein the regression table shows whether the constant, trend and quadratic terms are selected or omitted.
Maybe I'm making an obvious error somewhere. Still trying to find my way around Gretl.
Thanks.
Linux Mint 17.3 64bit
gretl 1.9.14
/* test without constant */
Step 2: testing for a unit root in uhat
Augmented Dickey-Fuller test for uhat
including 5 lags of (1-L)uhat
(max was 8, criterion modified AIC)
sample size 498
unit-root null hypothesis: a = 1
// this seems fine model: (1-L)y = (a-1)*y(-1) + ... + e
1st-order autocorrelation coeff. for e: 0.001
lagged differences: F(5, 492) = 10.556 [0.0000]
estimated value of (a - 1): -0.0935336
test statistic: tau_nc(2) = -3.6509
asymptotic p-value 0.003718
/* test with constant */
Step 2: testing for a unit root in uhat
Augmented Dickey-Fuller test for uhat
including 5 lags of (1-L)uhat
(max was 8, criterion modified AIC)
sample size 498
unit-root null hypothesis: a = 1
// b0 term here missing?
model: (1-L)y = (a-1)*y(-1) + ... + e
1st-order autocorrelation coeff. for e: 0.001
lagged differences: F(5, 492) = 10.569 [0.0000]
estimated value of (a - 1): -0.0937828
test statistic: tau_c(2) = -3.64666
asymptotic p-value 0.02145
/* test with constant and trend */
Step 2: testing for a unit root in uhat
Augmented Dickey-Fuller test for uhat
including 5 lags of (1-L)uhat
(max was 8, criterion modified AIC)
sample size 498
unit-root null hypothesis: a = 1
// b0 and trend term here missing?
model: (1-L)y = (a-1)*y(-1) + ... + e
1st-order autocorrelation coeff. for e: 0.001
lagged differences: F(5, 492) = 10.013 [0.0000]
estimated value of (a - 1): -0.114083
test statistic: tau_ct(2) = -4.02716
asymptotic p-value 0.02529
/* test with constant and quadratic trend */
Step 2: testing for a unit root in uhat
Augmented Dickey-Fuller test for uhat
including 5 lags of (1-L)uhat
(max was 8, criterion modified AIC)
sample size 498
unit-root null hypothesis: a = 1
// terms missing here?
model: (1-L)y = (a-1)*y(-1) + ... + e
1st-order autocorrelation coeff. for e: 0.002
lagged differences: F(5, 492) = 8.788 [0.0000]
estimated value of (a - 1): -0.136323
test statistic: tau_ctt(2) = -4.47415
asymptotic p-value 0.02002
7 years, 1 month