Macro with Python

Macro with Python is a set of introductory examples that apply Python to typical topics covered in an Intermediate (or advanced) macroeconomics course. The discussion assumes an intro/basic knowledge of Python and same familiarity with intermediate macroeconomic models.

The discussions in this project does not provide a full explanation of macroeconomic models nor intends to show coding best practices. The intention of the macro examples is to get us started with how to use Python in macroeconomics. QuantEcon offers more advanced an detailed documentation.

The macro examples below are written in JupyterLab notebook and rendered with Jupyter’s nbviewer. Juyter notebooks are divided in cells, where each cell can be text, or code. Since the purpose of this examples is pedagogical, each cell is written as a stand-alone piece of code (no need to execute the codes in previous cells).

The GitHub repository of this project is located here.

Macro with Python is an ongoing projects. More examples will be added as they become available

Macro with Python: Notebooks

All notebooks make use of NumPy and Matplotlib.

For an example on symbolic mathematics and LaTeX format, see The Solow Model (section 1).

For examples of how to find the roots ( SciPy) of a system of equations, see The Labor Market (section 3) and The AD-AS Model (sections 5 and 6).

For a shooting algorithm, see A Simple Ramsey Model (section 5).

List of Models and Applications

  1. The Labor Market
  2. The IS-LM Model
  3. The AD-AS Model
  4. The Solow Model
  5. The R&D Growth Model
  6. A Simple Ramsey Model

Where to get Python?

Probably the most user-friendly way to get Python is through Anaconda, an environement that allows to easily download and update Python packages and extensions.

Anaconda also comes with JupyterLab and other applications.

In addition to its applicatoins, Anaconda also includes instructional videos and documents.

Where to write Python code?

You can use a JupyterLab notebook. But, it is useful to have an “IDE.” Anaconda also comes with Spyder for Python as well as Visual Studio Code. If you are familiar with R, Anaconda also comes with RStudio.