ArticleslgStudy

computer science

Gretl

Gretl is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Gretl rather than just read about it. In short: gretl is computer software, an open-source statistical package, mainly for econometrics. The name is an acronym for Gnu Regression, Econometrics and Time-series Library.

Gretl — main illustration
Gretl — illustration

Key takeaways

  • Gretl belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Gretl to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Gretl from memory before moving on to harder problems.

Reference excerpt

gretl is computer software, an open-source statistical package, mainly for econometrics. The name is an acronym for Gnu Regression, Econometrics and Time-series Library. It has both a graphical user interface (GUI) and a command-line interface. It is written in C, uses GTK+ as widget toolkit for creating its GUI, and calls gnuplot for generating graphs. The native scripting language of gretl is known as hansl (see below); it can also be used together with TRAMO/SEATS, R, Stata, Python, Octave, Ox and Julia. It includes natively all the basic statistical techniques employed in contemporary Econometrics and Time-Series Analysis. Additional estimators and tests are available via user-contributed function packages, which are written in hansl. Output from gretl can be exported as LaTeX files. gretl is available in English, Albanian, Basque, Bulgarian, Catalan, Chinese, Czech, French, Galician, German, Greek, Italian, Polish, European and Brazilian Portuguese, Romanian, Russian, Spanish, Turkish and Ukrainian. Gretl has been reviewed several times in the Journal of Applied Econometrics, and later in the Australian Economic Review. A review also appeared in the Journal of Statistical Software in 2008. Since then, the journal has published several articles in which gretl is used to implement various statistical techniques.

Supported data formats gretl offers its own fully documented, XML-based data format. It can also import ASCII, CSV, databank, EViews, Excel, Gnumeric, GNU Octave, JMulTi, OpenDocument spreadsheets, PcGive, RATS 4, SAS xport, SPSS, and Stata files. Since version 2020c, the GeoJSON and Shapefile formats are also supported, for thematic map creation. It can export to Stata, GNU Octave, R, CSV, JMulTi, and PcGive file formats.

hansl Gretl has its own scripting language, called hansl (which is a recursive acronym for Hansl's A Neat Scripting Language). Hansl is a Turing-complete, interpreted programming language, featuring loops, conditionals, user-defined functions and complex data structures. It can be considered a domain-specific language for econometrics. Like other scientifically oriented programming languages, such as MATLAB and Julia, matrices are supported natively as a primitive variable type. A simple example of hansl:

matrix A = {1, 2 ; 3, 4} matrix B = inv(A) matrix C = A*B

print A B C

loop i=-3..3 printf "Phi(%d) = %7.3f\n", i, cdf(N, i) endloop Running the above code produces

A (2 x 2)

1 2 3 4

B (2 x 2)

-2 1 1.5 -0.5

C (2 x 2)

1.0000 0.0000 8.8818e-16 1.0000

Phi(-3) = 0.001 Phi(-2) = 0.023 Phi(-1) = 0.159 Phi( 0) = 0.500 Phi( 1) = 0.841 Phi( 2) = 0.977 Phi( 3) = 0.999

Random Number Generation Random Number Generation (RNG) in gretl has been examined and tested in Yalta & Schreiber (2012). The authors conclude "Our results show that the RNG related procedures in gretl are implemented soundly and perform well in the three crush test suites of the TestU01".

Gretl as a teaching tool Due to its libre nature and the breadth of econometric techniques it contains, gretl is widely used for teaching econometrics, from the undergraduate level onwards. Datasets in gretl format are available for several popular textbooks. The following is a list of textbooks that use gretl as their software of choice:

Dougherty, Christopher Introduction to Econometrics (Oxford University Press) Kufel, Tadeusz Ekonometria (Wydawnictwo Naukowe PWN); in Polish (Russian version also available) Kivedal, Bjørnar Applied Statistics and Econometrics (Springer) Bismans, Francis J. and Damette, Olivier Dynamic Econometrics. Models and Applications (Springer) In addition, a free supplement to Hill, Griffiths and Lim Principles of Econometrics (Wiley) is available.

See also

Comparison of statistical packages R (programming language)

References

External links Gretl on SourceForge GretlWeb Gretl User's Guide Archived 2013-12-13 at the Wayback Machine Lee Adkins's Using gretl for Principles of Econometrics Gretl Command Reference Archived 2018-12-15 at the Wayback Machine Gretl Conference. Berlin, 2015

Illustrations

Gretl illustration
Gretl illustration

Worked examples

Example 1 — a first encounter with Gretl

Start with the simplest possible case. Write down what Gretl claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Gretl before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Gretl ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Gretl

In research
Gretl appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Gretl in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Gretl is common in secondary-school and first-year university syllabi. It links to neighbouring topics Cross-platform free software, Cross-platform software, Econometrics software, so understanding it makes those chapters shorter.
In everyday life
Look for Gretl outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study Gretl in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Gretl means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Gretl out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Gretl in simple terms?

gretl is computer software, an open-source statistical package, mainly for econometrics. The name is an acronym for Gnu Regression, Econometrics and Time-series Library.

Why does Gretl matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Gretl?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Gretl.

Tags

  • Cross-platform free software
  • Cross-platform software
  • Econometrics software
  • Free econometrics software
  • Free multilingual software
  • Free plotting software
  • Free software programmed in C
  • Free statistical software
  • GNU Project software
  • Numerical analysis software for Linux
  • Numerical analysis software for Windows
  • Numerical analysis software for macOS

Keep exploring