Practical Empirical Research Using gretl and hansl
| Author | Artur Tarassow |
| DOI | http://doi.org/10.1111/1467-8462.12324 |
| Published date | 01 June 2019 |
| Date | 01 June 2019 |
The Australian Economic Review, vol. 52, no. 2, pp. 255–271 DOI: 10.1111/1467-8462.12324
Abstract
This article provides an introduction to the free
open-source statistics and econometrics soft-
ware gretl. The software is an attempt to bridge
the different demands for teaching at different
levels. Furthermore, it also provides function-
alities required for professional work. We also
introduce gretl’s powerful and intuitive script-
ing language ‘hansl’. This article can be seen
as an illustrated step-by-step guide that uses a
real-life data analysis example. Finally, I
estimate a vector autoregressive time-series
model using gretl for structural analyses as
well as for forecasting purposes.
1. Introduction
Data analysis is a vital part of the economic
training and daily life of a professional
economist. Economists are trained to be
sophisticated users of data, and econometrics
—the interplay of economic theory, statistics
and mathematics—is a subject which econom-
ics students usually have to study. Under-
graduates studying economics are typically
exposed to courses in statistics and economet-
rics, covering the practice and interpretation of
least-squares regression, data management and
data visualisation. Graduate students learn
advanced treatments of the subject, likely
involving Maximum Likelihood estimation,
simulation and so on. Professional economists
—whether in public or private institutions—
are likely to find themselves using, or possibly
developing, econometric methods.
Gretl is an open-source and freely available
statistics and econometrics software that
attempts to bridge the various demands for
teaching at different levels as well as for
professional work. It comprises a full-featured
graphical interface but also a powerful script-
ing language called ‘hansl’. This scripting
language can be seen as a domain-specific
language for statistics and econometrics. Gretl
handles datasets—a matrix but with a richer
structure including some meta-information—
similar to Eviews but can also deal with pure
matrices and arrays such as Matlab, Gauss and
Julia for advanced programming purposes.
In the following, I will introduce gretl—and
to some extend hansl—alongside a practical
empirical example using time-series data. The
article is structured as follows. The next section
discusses the econometrics software market
and presents gretl and hansl. Section 3
introduces gretl’s graphical user interface and
* Tarassow: Department of Socioeconomics, Welckerstr.
8, University of Hamburg, 20354 Hamburg, Germany,
email <atecon@cryptolab.net>. I am grateful to Allin
Cottrell, Riccardo (Jack) Lucchetti, Sven Schreiber and
Jenny Lye for helpful comments. Any remaining errors or
omissions are strictly my own. I gratefully acknowledge
financial support from the Graduate School at the
University of Hamburg and the hospitality of the
University of Melbourne during a visit in March 2017.
°
C2019 The University of Melbourne, Melbourne Institute: Applied Economic & Social Research,
Faculty of Business and Economics
Published by John Wiley & Sons Australia, Ltd
For the Student
Practical Empirical Research Using gretl and hansl
Artur Tarassow
256 The Australian Economic Review June 2019
explains how to conduct basic data manage-
ment as well as some initial analyses by
providing an overview about essential com-
mands. In Section 4 a vector autoregressive
time-series model is estimated and I will show
how the model’s dynamics can be analysed for
structural or forecasting purposes. Section 5
briefly introduces the work with matrices
before Section 6 summarises the article.
2. Econometric Software and gretl
2.1 The Econometrics Software ‘Market’
The demands placed on an econometric
software are a delicate issue. For teaching
purposes it makes sense to have undergraduate
students work with reasonably user-friendly
software—in the easiest case controlling the
software by a graphical user interface through
point-and-click using the mouse. However, it
makes little sense to introduce a software to
undergraduates that does not support more
advanced methods and does not offer a fully-
fledged scripting and programming environ-
ment—aspects that are required for an
advanced treatment in graduate classes and
for professionals. And of course there is a
premium on teaching ‘marketable skills’rather
than dead-end expertise.
Gretl is a program that attempts to bridge
these different demands. It comprises a full-
featured graphical user interface (GUI): its
underlying functionality can be driven either
by gretl’s scripting language or by the
apparatus of menus, dialogue boxes and so
on. The lead developers—Allin Cottrell from
Wake Forest University and Riccardo (Jack)
Lucchetti from Universit
a Politecnica delle
Marche—attempt to ensure that almost every-
thing that can be done via scripting can also be
done via the GUI, and vice versa, with only a
few exceptions (Cottrell 2017).
Gretl’s main competitors are the major
proprietary econometrics packages, Stata and
Eviews, and also the major open-source
statistical software project, R. As in gretl,
datasets and series are also basic in Stata and
Eviews, and econometric functionality is
supported by a wide range of built-in
commands. Even though both Stata and
Eviews support scripting, their respective
languages are quite odd from the point of
view of a programmer used to general-purpose
scripting languages or Matlab-like interfaces
for matrix manipulation. Gretl offers the
common apparatus of fully-fledged program-
ming languages (function-calling, function-
definition, declaration of and assignment to
named variables of various types) similar to
what is available in Matlab, R and Python.
2.2 gretl and hansl
Gretl is an acronym for Gnu Regression,
Econometrics and Time-series Library. The
software is available for Windows, Mac OS X
as well as Linux through the official gretl
homepage.
1
It is free, open-source software
that may be redistributed and/or modified
under the terms of the GNU General Public
License as published by the Free Software
Foundation.
Gretl comprises a common command line
(CLI) program and a GUI client, and makes use
of reliable free and open-source software
packages in the ‘background’for computa-
tions, for example, (multi-threaded) LAPACK/
BLAS, fftw, GTK, gnuplot, etc. The first gretl
version was released in January 2000 and has
been under active development since then. Its
user interface is available in 17 languages
thanks to an active community. Gretl is shipped
with a User Guide of 380þpages, a Command
Reference of 210þpages and a ‘A hansl
Primer’tutorial to gretl’s scripting language.
The latest stable release is version 2019a which
was published on 24 January 2019.
Gretl’s unique selling point is that it offers a
high-level matrix-oriented language with a
syntax similar to Matlab or Gauss, and an
intuitive high-level scripting language called
hansl that is attuned to econometrics. This
makes gretl especially interesting for lecturing
statistics and econometrics but also for serious
research.
Hansl—Hansl’sANeatScripting Language
—was developed over time and is now a very
advanced high-level scripting language with
more than 140 commands specifically tailored
°
C2019 The University of Melbourne, Melbourne Institute: Applied Economic & Social Research, Faculty of Business and
Economics
Get this document and AI-powered insights with a free trial of vLex and Vincent AI
Get Started for FreeUnlock full access with a free 7-day trial
Transform your legal research with vLex
-
Complete access to the largest collection of common law case law on one platform
-
Generate AI case summaries that instantly highlight key legal issues
-
Advanced search capabilities with precise filtering and sorting options
-
Comprehensive legal content with documents across 100+ jurisdictions
-
Trusted by 2 million professionals including top global firms
-
Access AI-Powered Research with Vincent AI: Natural language queries with verified citations
Unlock full access with a free 7-day trial
Transform your legal research with vLex
-
Complete access to the largest collection of common law case law on one platform
-
Generate AI case summaries that instantly highlight key legal issues
-
Advanced search capabilities with precise filtering and sorting options
-
Comprehensive legal content with documents across 100+ jurisdictions
-
Trusted by 2 million professionals including top global firms
-
Access AI-Powered Research with Vincent AI: Natural language queries with verified citations
Unlock full access with a free 7-day trial
Transform your legal research with vLex
-
Complete access to the largest collection of common law case law on one platform
-
Generate AI case summaries that instantly highlight key legal issues
-
Advanced search capabilities with precise filtering and sorting options
-
Comprehensive legal content with documents across 100+ jurisdictions
-
Trusted by 2 million professionals including top global firms
-
Access AI-Powered Research with Vincent AI: Natural language queries with verified citations
Unlock full access with a free 7-day trial
Transform your legal research with vLex
-
Complete access to the largest collection of common law case law on one platform
-
Generate AI case summaries that instantly highlight key legal issues
-
Advanced search capabilities with precise filtering and sorting options
-
Comprehensive legal content with documents across 100+ jurisdictions
-
Trusted by 2 million professionals including top global firms
-
Access AI-Powered Research with Vincent AI: Natural language queries with verified citations
Unlock full access with a free 7-day trial
Transform your legal research with vLex
-
Complete access to the largest collection of common law case law on one platform
-
Generate AI case summaries that instantly highlight key legal issues
-
Advanced search capabilities with precise filtering and sorting options
-
Comprehensive legal content with documents across 100+ jurisdictions
-
Trusted by 2 million professionals including top global firms
-
Access AI-Powered Research with Vincent AI: Natural language queries with verified citations