## Gretl and Hansl — econometrics made easy

27 October, 2015 at 15:29 | Posted in Statistics & Econometrics | 6 Comments

Thanks to Allin Cottrell and Riccardo Lucchetti we today have access to a high quality tool for doing and teaching econometrics — Gretl.

And, best of all, it is totally free!

Gretl is up to the tasks you may have, so why spend money on expensive commercial programs?

The latest snapshot version of Gretl – 2015d – can be downloaded here.

With this new version also comes a handy primer on Hansl — the scripting language of Gretl.

So just go ahead. With Gretl and Hansl, econometrics has never been easier to master!

1. I used Gretl as the required tool for the second of two undergraduate economics modules I took with the Open University in the UK. The first module, taken two years earlier, used SPSS. I found Gretl intuitive and straight forward.

My introduction to econometrics was interesting and instructive. It has informed my reading and understanding of other peoples work since. Give it a try!

Paul

2. Hansl language is a real bomb. It took me less than 3 weeks between
writing the first lines and having the first official Gretl package approved!
Another pleasant thing: I got to know Lars from Real-World Economics Review
and I share Lars’ point of view. Now I know he likes Gretl too!
Oleh

3. Econometrics as debunking (© Steve Keen) tool
A couple of examples
Neglected theorems on random walk
1) if a random walk exists infinitely long it’s distribution is not a distribution of a proper random variable: it’s +-Infty with p=1/2
Consequence for “efficient” market hypothesis
In the long run stock indexes go to zero or explode → even efficient markest should be regulated

2) Mean time of intersecting a given horizontal line is infinite → stock indexes can go off any fundamentals for infinitely long and can differ by infinitely large

Neglected consequence of Hall(1978): under rational expectations income and consumption are not cointegrated! What can be more absurd!

Beveridge-Nelson decomposition and RBC
so, under “efficient” markets we have and independent source for random walk
under rational expectations we have a second independent random walk for consumption
The third source is “native”: technical progress is integrated

So, if a macroeconomy should be described as VECM with k variables, the maximal cointegration rank is k-3. But it follows from multivariate Beverage-Nelson decomposition that for RBC model to be described as VECM it should have k-1 cointegration rank with the only independent random walk for technical progress. That is why there are no financial sector in RBC models.

Another interesting neglected theorem on random walk: in R^d, d>2, random walk is not recurrent at all!
We have just seen we have at minimum 3 independent random walks in a macroeconomic system even under fantastic neoclassical information assumptions!

P.S. I work as an econometric instructor, but I have PhD in probability, so as a “child” I was taught
a different set of theorems in a stochastic processes course.

They like to blame heterodox economists in neglecting math, but what kind of mathematicians are they themselves?

4. Stay beautiful, Oleh. Stay beautiful.

5. Gretl is clearly underestimated.
Now I’ll make a modest attempt to correct it.
1) Use by serious organizations: Gretl is known
to be used by Bank of Brazil and saves them a lot
of money.
2) A myth in that Gretl is buggy. Really, one
can not very rare bump into small bug
in saving plots in exotic formats etc., or
easy to find a way around bugs while Hansl
scripting. And Allin & Riccardo are
fantastically quick in correcting. AND THERE
ARE NO IMPORTANT BUGS IN ESTIMATION
AND TESTING!!!
3) Gretl has the simplest and the most intuitive
GUI ever seen! Unfortunately, enormous
percentage of Universities have only one
semester of econometrics. Gretl is
absolutely the best to teach some greens
something useful for such inadequate time
4) Hansl!!! For example, how to clone
mathlab’s feval:

function scalar feval (string fun, scalar x)
return @ fun
end function
usage: feval(“sin(x)”,\$pi/4)

THAT’S ALL!
(stiff data types, copy-past and
create for vectors in 2 seconds)

5) New models: Gretl have
mle, gmm, and simulated annealing,
also very easy syntax to bootstrap your
models
6) GUI creation
You write a function, go to the package GUI
editor and in a couple of dozens of seconds
you’ll have the same nice looking menu item
for you function as a native command has!

7) Speed. S language (R is “GNU S”) is very nice,
but if you can’t do C, C++, or ancient Fortrant
your cool code will be a snail. If you use
hansl, you needn’t learn Rcpp package.
Many people (I also) use hansl for
Monte-Carlo studies.

8) R integration. For, example, Rob Hyndman
wrote the best thing for univariate time series
models, {forecast} {R}. I simply wrote Gretl
interface to it. Since Gretl is GNU, as Rob wrote
everything I should do is to give a proper refence
to him.
9) Do not contrast R and Gretl. Your marginal
expenses are Zero. INTEGRATE THEM!
10) Happy New Year!
11) Happy Gretl!

6. Use R!