PyMacLab

The Python Macroeconomics Library
Download

PyMacLab Ranking & Summary

Advertisement

  • Rating:
  • License:
  • The Apache License 2.0
  • Price:
  • FREE
  • Publisher Name:
  • Eric M. Scheffel
  • Publisher web site:
  • http://github.com/escheffel/

PyMacLab Tags


PyMacLab Description

PyMacLab is an advanced Python library suitable for the solution and analysis of DSGE models as well as for carrying out additional macroeconometric investigations.PyMacLab stands for Python Macroeconomics Library which currently primarily serves the purposes of providing a convenience framework written in Python to solve non-linear DSGE models. At the time of writing this the library supports solving DSGE models using 1st and 2nd order perturbation methods which are computed around the steady state. In particular, the library provides wrapper function for Paul Klein's 1st-order accurate method based on the Schur Decomposition as well a more recently published method by the same author (co-authored with Paul Gomme, see here) which provides 2nd-order accurate solutions without using Tensor Algebra (using the Magnus and Neudecker 1999 definition of the Hessian matrix).The library is extremely user-friendly in the sense of employing a model text file parser similar to that present in Dynare which requires users to only write down the original set of non-linear first-order conditions of optimality. In addition, users are offered a menu of options of how to provide information required for calculating the steady state of the model. Once the model is parsed and read in, several options of solving it exist and users are provided with further convenience methods suitable for simulating solved models and investigating dynamic statistical properties.It should also be mentioned that because PyMacLab is a convenience library of highly modular nature (using a object-oriented programming approach) it is very easy to loop over one model several thousand times each time changing the original set of primitive parameters, such as depreciation rates, impatience factors, etc. in order to compute solutions of the same model over a large set of conceivable parameterisations. Also, whenever solution methods require the calculation of the Jacobian or Hessian, this is always done analytically (symbolically) using the Python symbolic computation library SympyCore and not numerically as in other software packages. Sympycore is not supplanted by Sympy, but it works well at the moment so we will alter PyMacLab at a later stage to reflect this.PyMacLab was authored by Eric M. Scheffel who is currently working as Assistant Professor in Economics at Nottingham University China and is distributed under the GNU General Public License v3.0. When using this Python library please make sure to cite the the project (using Latex) as:@Misc{, author = {Eric M. Scheffel}, title = {{PyMacLab}: Open source {Python} Macroeconomics Laboratory}, year = {2007--}, url = "http://github.com/escheffel/pymaclab/"}Dependenciesnumpyscipysympysympy-coreipython (optional)pp (optional)mlabwrap (optional)scikits.timeseriesWhile numpy, scipy, sympycore and scikits.timeseries are absolutely necessary to run PyMacLab, Parallel Python (PP) can autodetect multi-core processors and can potentially speed up the computation of elements such as the analytical Hessian of a non-linear DSGE model, while sympy and mlabwrap have been marked as deprecated and are in the process of being pruned from the code. To explore the use of PyMacLab interactively a special IPython environment can be launched with pre-loaded convenience functions.Installationpython setup.py buildsudo python setup.py installUsageThe below code snippet is indicative of how PyMacLab can be used in an environment such as IPython. Since the library is still undergoing change, it is always advisable to enter the subdirectory containing the test.py test-script and inspect/run this to better understand PyMacLab's syntax.import pymaclab as pm# Model Instantiation with datarbc1 = pm.newMOD('modfiles/rbc1.txt',db1)# Model instantiation without datarbc2 = pm.newMOD('modfiles/rbc2.txt')# Solve the models using different methodsrbc1.modsolvers.forkleind.solve()rbc2.modsolvers.pyklein2d.solve()# Simulate the models after they have been solvedrbc1.modsolvers.forkleind.sim(400)rbc2.modsolvers.pyklein2d.sim(1000)Product's homepage


PyMacLab Related Software