The ASToolbox

 

'Wavelets, Economics and Politics'  by M. Joana Soares and L. Aguiar-Conraria

The toolbox can be freely used. We just ask that you acknowledge the use of our functions in any publications and that a copy of such publication is sent to us. It goes without saying, any corrections, comments and suggestions to improve our functions are most welcome!

At the bottom of this page, you can download the GWPackage (an R version of our toolbox).

After downloading, you will realize that the folder ASToolbox is divided into two sub-folders:

  1. Functions - containing all the matlab functions. This has two sub-folders:
  2. a. Auxiliary - containing some auxiliary functions to, e.g. generate Monte Carlo simulations for significance testing or compute Fourier spectra; it also contains a function to compute measures associated with Generalized Morse Wavelets.
    b. WaveletTransforms - containing functions to compute the (Analytic) Wavelet Transform, Cross-Wavelet Transform, Wavelet Coherency, Wavelet Phase Difference then,mn,nand Time-Lag.
  3. Examples - containing matlab scripts and the data necessary to generate the pictures associated with each of the Examples in Section 7 of the paper The Continuous Wavelet Transform: A Primer.

Some of our functions are based on (parts of) functions written by Christopher Torrence and Gilbert P. Compo (http://paos.colorado.edu/research/wavelets/) and also on some modified versions of functions written by Bernard Cazelles et al. (2007), who kindly provided us with their code.

Apart from some computational choices and the correction of some typos, there are three main differences: the capacity of using an entire family of analyzing wavelets, the Generalized Morse Wavelets (as well as the famous Morlet Wavelet), the possibility of changing the wavelet parameters, allowing for greater flexibility, and different null hypothesis for testing significance, which are more common in economics and other social sciences.

Updates

  • January 10, 2011: There was a mistake with the bootstrap procedures associated with the significance test, which was corrected on this day.
  • May 12, 2011: Major update. This toolbox is now able to perform multivariate wavelet analysis. Finally one can move beyond bivariate analysis. The concepts of partial and multiple wavelet coherency are coded now. For a mathematical explanation, see section 4 of the paper "The Continuous Wavelet Transform: A Primer", updated version, which is included in the toolbox.
  • April 23, 2013: one bug was fixed.
  • June 17, 2014: We changed the way the phase-difference is computed. We also added a new significance test for the wavelet power spectrum, using the exact theoretical distribution when the null is a AR(0) or AR(1). For replication of our previous papers, we kept the old functions in our toolbox. We added V2 to the name of the old files. For example, AWT.m and AWTV2.m correspond to the old and new versions, respectively.

Implementation details

When implementing the transforms, some choices had, naturally, to be made. Choices about normalizations, conversion from scales to frequencies, formula used for the Continuous Wavelet Transform, and related transforms, determination of the Cone of Influence, smoothing, etc. All these are described in an appendix to the paper The Continuous Wavelet Transform: A Primer. These can be modified, with very little effort, by any user.

Software requirements

Our programs were written in Matlab 2009.b. However, we were careful in writing it in such a way that it is fully compatible with version 7. Some of our programs make use of functions from the Matlab toolboxes Econometrics Toolbox, Signal Processing Toolbox and Statistics Toolbox. This is always explicitly stated in the function and may, in some cases, be very simply replaced by functions written by the user.

Significance tests

The tests of significance are always based on Monte Carlo simulations. The simulations use two different types of methods to construct surrogate series: (1) fitting an ARMA(p,q) model and building new samples by simple bootstrap or (2) fitting an ARMA(p,q) model and construct new samples by drawing errors from a Gaussian distribution. In the second option, the surrogates are constructed using the function 'garchsim' (univariate GARCH process simulation) of the Econometrics Toolbox included in MatLab 2009. To fit the ARMA(p,q) to the data, we make use of the function 'garchfit' of the same toolbox.

The user that does not have the Econometrics toolbox can still perform significance tests by choosing an ARMA(p, 0) model with bootstrap. In this case, the AR(p) model is estimated by OLS and the code is self-contained and autonomous from the Econometrics toolbox.


A brief guide for this packge is included in the downloaded material.

Maria Joana SOARES
Dep. Mathematics and Applications
University of Minho
4710-057 Braga
PORTUGAL
jsoares@math.uminho.pt


Luís AGUIAR-CONRARIA
Dep. Economics
University of Minho
4710-057 Braga
PORTUGAL
lfaguiar@eeg.uminho.pt