I'm noticing that I cannot build from git without having a Latex
installation, when I want to also build the addons. In other words, the
regular gretl build skips Latex and pdf creation when the configure
option --enable-build-doc is _not_ given, but using
--enable-build-addons fails without Latex.
Not a big deal of course, but on a Debian test system I had to pull in
texlive-latex-extra just because of that, which is easily 1GB in size.
As far as I know, we don't have a function for sorting string arrays, so I
implemented quicksort in hansl as shown below.
As you can see, the function sorts the array and returns a vector of
integers so that you can map the old positions to the new ones if needed.
Performance is not at all bad, I'd say.
I'm thinking: would it be worthwhile to add this to the "extra" package?
Or should we have a native C implementation? Also: is this imaginable for
other array types? I can't think of an obvious way to sort bundles or
matrices, but perhaps someone has a clever idea.
set verbose off
function void swap(strings *a, matrix *ndx, scalar i, scalar j)
string s = a[j]
scalar x = ndx[j]
string a[j] = a[i]
scalar ndx[j] = ndx[i]
string a[i] = s
scalar ndx[i] = x
function scalar part(strings *a, matrix *ndx, scalar lo, scalar hi, bool reverse)
string pivot = a[hi]
scalar i = lo
loop j = lo .. (hi-1) --quiet
cmp = strncmp(a[j], pivot)
if (reverse ? cmp > 0 : cmp < 0)
swap(&a, &ndx, i++, j)
swap(&a, &ndx, i, hi)
function void real_sqsort(strings *a, matrix *ndx, scalar lo, scalar hi, bool reverse)
if lo < hi
p = part(&a, &ndx, lo, hi, reverse)
real_sqsort(&a, &ndx, lo, p-1, reverse)
real_sqsort(&a, &ndx, p+1, hi, reverse)
function matrix strings_sort(strings *A, bool reverse)
scalar n = nelem(A)
if n == 1
matrix s = seq(1, n)
real_sqsort(&A, &s, 1, n, reverse)
x = defarray("alpha", "foo", "X", "bar", "baz", "")
ord = strings_sort(&x)
print x ord
Riccardo (Jack) Lucchetti
Dipartimento di Scienze Economiche e Sociali (DiSES)
Università Politecnica delle Marche
(formerly known as Università di Ancona)
Dear Allin and Riccardo,
Remember, some time ago, I requested escaping the underscore character in
variable names for LaTeX output (otherwise, it won’t compile)?
This problem still persists in gretl 2019a. Today, I tried to render the
LaTeX output from a vector autoregression with l_price and l_quantity (the
default naming convention), and it choked on the F test part:
All lags of l_price...
Could you please check all LaTeX output generators and automatically escape
all underscores or other illegal LaTeX characters (or strip the ones that
cannot be escaped, or replace them with dots, like R does) in variable
Thank you in advance!
Bien cordialement, | Yours sincerely,
Andreï V. Kostyrka.
by coincidence I saw that gretl's 'logistic' command is placed in the
menus under Model->Limited Dependent Variable. Given that in gretl
logistic != logit (which of course is there separately), is this really
Spontaneously I'd rather put it into "Other linear models", but I guess
this is also debatable.
in the function package GUI it is possible to type a matrix literal
directly into the corresponding field.
In contrast I just found out that with lists this isn't possible, the
error from the parser is "expected ) but found SERIES" or sth. like that.
BTW, what works is to type in directly an expression with deflist(). I
think this proves that having an anonymous list is not the problem.
I think it would be useful if typing 'S1 S2 S3' could be understood as
deflist(S1,S2,S3), basically just like the plain list syntax works in
gretl in other contexts.
If all goes well, you are reading a post from the new gretl-users
and/or gretl-devel list(s).
Please make note of the new posting addresses.
Department of Economics
Wake Forest University, NC
In current git and snapshots I've introduced a small amendment to the
rules governing variable names in hansl. (Reminder: all ASCII, starts
with a letter, contains nothing but letters, numerals and underscore;
max 31 characters.) The newly acceptable exception to the prior rule
is a single "math-greek" letter (in UTF-8), of which there are 24, for
use in naming all types of variables except series.
To make it easier to enter such characters there's a new facility in
the GUI script editor and console: Alt+letter gets you a Greek letter
(or Alt-Shift-letter for upper case). The Latin-Greek mapping is shown
I'm not in favor of supporting arbitrary UTF-8 in variable names. That
would be complicated (given all the instances of fixed-format
printouts in gretl along with the fact that UTF-8 glyphs can take from
one to four bytes) and IMO would be of no real benefit. But I do like
the idea of being able to give parameters Greek-letter names (I'm
primarily thinking of scalars and matrices); and since all the Greek
letters in the math lexicon take two bytes, this is relatively easy to
Latin-Greek mapping (with Alt or Alt-Shift):
v nu (repeated)
y upsilon (repeated)
A heads-up for subscribers to the gretl mailing lists: all of our
lists will be moving to a new location next week, probably on
Monday. Wake Forest University no longer wishes to maintain such
lists, and thanks go to Jack Lucchetti and his colleague Daniele
Ripanti for arranging to host the lists at univpm.it.
If all goes according to plan you will find yourselves automatically
subscribed to the new (or reincarnated) lists. The addresses to
which you should post will change to:
gretl-users(a)gretlml.univpm.it # for the users list
gretl-devel(a)gretlml.univpm.it # for the devel list
See https://gretlml.univpm.it/postorius/lists/ for an overview.
We will send another broadcast message when we know the transition
is actually about to happen. There will probably be a period of a
few hours when posting to either of the lists is not possible.
There's a colleague in my department who uses gretl for all his
empirical work, and does a lot of logistic regressions. He's a
political economy guy and in many cases the dependent variable is
the percentage vote in some legislative body for some bill or other.
We have logistic regression in gretl but it hasn't had much
attention in a long time. At my colleague's prompting I've recently
enabled the --robust and --cluster options for "logistic". But in
addition he also wants to use logistic regression in a panel
context. We have fixed effects (binary) logit already -- any
thoughts on what it would take to extend that to cover fixed effects
In git and snapshots, the "data" argument for "plot" (a series, list
or matrix) has now been made optional. This allows use of "plot" for a
custom plot that uses formulae rather than a chunk of data.
literal set title 'CRRA utility'
literal set xlabel 'c'
literal set ylabel 'u(c)'
literal set xrange[1:3]
literal set key top left
printf "# literal lines = 1"
literal crra(x,s) = (x**(1-s) - 1)/(1-s)
printf "plot crra(x,0) t 'sigma=0', \\"
printf " log(x) t 'sigma=1', \\"
printf " crra(x,3) t 'sigma=3"
end plot --output=display
The effect of "# literal lines = 1" is that the crra() function
definition will be treated as something to be passed directly to
gnuplot, without any attempt at parsing it on gretl's part. So in the
gretl GUI we won't choke on that line, and the plot will be