Sven Schreiber's software page

(Diese Seite ist nur auf Englisch verfügbar. Direkt zu Sven Schreibers Hauptseite: hier. / This page is available only in English. Directly to Sven Schreiber's home page: here.)

(Latest update: October 2016)

Stuff for gretl

The gretl econometrics/statistics open-source software is lightweight yet powerful, including a data-handling and matrix programming language "hansl" (= HANdy Scripting Language). I have authored or co-authored a couple of so-called function packages for it. I am just listing them here without the actual code, because these packages are available from within the running gretl program via the menu path Tools/Function packages/On Server...


The companion package to my paper "The estimation uncertainty of permanent-transitory decompositions in cointegrated systems". (Please cite if you use it in research.) At the time of writing the package is waiting in gretl's staging area (see and should be available from within the gretl program shortly.


This package is actually a gretl "add-on" which is automatically installed, look under Model/Time Series/Structural VARs... The main author is Jack Lucchetti who was kind enough to take me on board.


Performs a frequency-wise Granger (non-) causality test as described in Breitung and Candelon (2006): "Testing for short- and long-run causality: A frequency-domain approach", Journal of Econometrics, 132, pp. 363-378. From version 2.0 on it also incorporates some extensions from the paper Breitung, Jörg, and Schreiber, Sven (2016): "Assessing Causality and Delay within a Frequency Band", IMK Working Paper 165. Please cite if you use it in research.


Calculates signal delays in frequency domain and their uncertainty. It is based on the same paper: IMK Working Paper 165. (And again, please cite if you use it in research.)


gretl has become one of the best packages for doing cointegration analysis. This package supplies Bartlett corrected trace test statistics and bootstrapped p-values. Andreas Noack Jensen did most of the work. ("coint2" is gretl's command for the Johansen test procedure, hence the name.)


One more for doing cointegration analysis: This package provides two (or three) stability tests for the cointegrated vector autoregressive model based on recursive estimation. The package also includes the function nyblom to simulate critical values of the test statistic for beta constancy. Andreas Noack Jensen did most of the work, I added the joint eigenvalue test, finished the function package build and resolved some gretl-related details.

Work in progress

A port of the Bai-Perron structural break test/estimate approach from Ox code by Jack Lucchetti and Giulio Palomba. Already running, but still needs to be put in function package form, and be tested, tested, tested...

Other bits and pieces

Then there are various tiny scripts used for teaching with gretl, check out all files with .inp-suffix in this directory (many of them might have become obsolete over time).

NumPy stuff (NumPy: numerical Python extension)

QZ decomposition

Since 2011 or 2012 and version 0.11.0, SciPy includes this decomposition for a pair of matrices (experts call it a pencil it seems...) as its native function scipy.linalg.qz, making my own workaround wrapper obsolete. I'm leaving my code linked on this page anyway, for reference. (The QZ decomposition is used for solving rational-expectations models, as in Uhlig's toolkit or similar software like Dynare.)
After discovering the great capabilities of the 'ctypes' Python module and its nice integration with numpy, I wrote a wrapper for the relevant Lapack functions, real and complex. If you download the module, you only need to do a 'from qz import qz', and then the provided qz()-function should work natively in numpy exactly as it would in Matlab (which also uses Lapack for the calculation). However, you need a precompiled shared Lapack library (.dll or .so or whatever) installed on your system; see the embedded documentation in the docstrings of the module for more information.

Co-breaking analysis

There is some NumPy/SciPy code to test for and estimate co-breaking relationships as in my paper on co-breaking (linked on the research page in the entry for this paper).

Various recommendations of free (scientific) software

All I can say is that I use the programs myself regularly, so many thanks to the respective developers for all their work!