1,047
Views
3
CrossRef citations to date
0
Altmetric
Economic Instruction

A Python-based undergraduate course in computational macroeconomics

Pages 126-140 | Published online: 06 Mar 2022
 

Abstract

The author of this article describes a new undergraduate course where students use Python programming for macroeconomic data analysis and modeling. Students develop basic familiarity with dynamic optimization and simulating linear dynamic models, basic stochastic processes, real business cycle models, and New Keynesian business cycle models. Students also gain familiarity with the popular Python libraries NumPy, Matplotlib, and pandas and make extensive use of the Jupyter Notebook. For many students in the course, this is their first experience with computer programming in any language. Feedback from students suggests that, regardless of prior programming experience, they find the course to be valuable, interesting, and enjoyable.

JEL codes:

Acknowledgments

The author thanks Douglas Dalenberg, Michael Darden, John Duffy, Rey Hernández-Julián, and two anonymous referees for thoughtful comments and former students Viola Chen, Andrew Miller, Svati Proctor, and William Proctor for working through early versions of the course content.

Notes

1 Judd (1997) provides an excellent argument for the value of computational methods in economics by drawing comparisons with applications in the physical sciences. The following books are excellent references on solving, simulating, and estimating macroeconomic models: Canova (2007), Stachurski (2009), DeJong and Dave (2012), McCandless (2008), and Ljungqvist and Sargent (2018).

2 For undergraduate programs that do not have a calculus prerequisite for intermediate economics, the course content requiring calculus could be replaced with alternative topics. Possible alternatives are suggested at the end of the “Alternative Topic Ideas” section.

3 “The Macro Pedagogy Debate: Teaching DSGE to Undergraduates Symposium,” JEE, Issue 3, 2018. Articles in the symposium include: Colander (2018), Solis-Garcia (Citation2018), Setterfield (Citation2018), and Neumuller, Rothschild, and Weerapana (Citation2018).

4 See, for example, the economics-oriented Python resources and examples at QuantEcon: https://quantecon.org/.

5 Dynare is a popular and widely used software for simulating DSGE models that runs on top of Matlab or Octave. Some readers will wonder why the course wasn’t structured to use Dynare. One reason is my preference for Python over Matlab. Another reason is that Dynare uses a Dynare-specific syntax. Dynare is convenient because the user enters equilibrium conditions in a symbolic format and then Dynare parses the equations. But because the user isn’t programming in the fundamental language (e.g., Matlab), they also aren’t practicing the fundamental language. For pedagogical reasons, I would prefer to have the course based entirely on one language and so would not use Dynare in the course even if Matlab were used.

8 File name is make_blank_notebooks.py; available on the course GitHub page.

9 See the second chapter of Adda and Cooper (Citation2003) for a formal treatment of the cake-eating problem and extensions.

10 Examples include Mishkin (Citation2019), Mankiw (Citation2019), and Jones (Citation2020).

11 Mankiw’s intermediate macroeconomics textbook has a nice quantitative model that students can simulate with spreadsheet software. To make the model tractable, he assumes a static IS relationship between the real rate and output, and that agents have adaptive expectations.

12 For example, not all of the built-in Python types, including tuples, ranges, and dictionaries are covered, and only a limited introduction to lists is provided.

14 Chapter 3 of DeJong and Dave (Citation2012) discusses how to construct a log-linearization of a DSGE model, and Chapter 4 discusses solution techniques including Klein’s.

15 See note 7.

17 See note 5.

Log in via your institution

Log in to Taylor & Francis Online

PDF download + Online access

  • 48 hours access to article PDF & online version
  • Article PDF can be downloaded
  • Article PDF can be printed
USD 53.00 Add to cart

Issue Purchase

  • 30 days online access to complete issue
  • Article PDFs can be downloaded
  • Article PDFs can be printed
USD 130.00 Add to cart

* Local tax will be added as applicable

Related Research

People also read lists articles that other readers of this article have read.

Recommended articles lists articles that we recommend and is powered by our AI driven recommendation engine.

Cited by lists all citing articles based on Crossref citations.
Articles with the Crossref icon will open in a new tab.