/Syllabus

Syllabus for CompEcon Course

ScPo-CompEcon Syllabus

  • Course: Computational Economics for PhDs
  • Teacher: Florian Oswald, florian.oswald@sciencespo.fr
  • Class Times: Bi-weekly Friday 14:45-16:45 starting 29 of January, ending 8 of April.
  • Chatroom: Join the chat at https://gitter.im/ScPo-CompEcon/Syllabus
  • Class Locations:
    1. 29/01/2016: Salle 31, 27 Rue Saint-Guillaume.
    2. 12/02/2016: Salle 26, 27 Rue Saint-Guillaume.
    3. 26/02/2016: Salle 34, 27 Rue Saint-Guillaume.
    4. 11/03/2016: Salle 105, 56 Rue des Saints-Pères.
    5. 25/03/2016: Salle 31, 27 Rue Saint-Guillaume.
    6. 08/04/2016: Salle 31, 27 Rue Saint-Guillaume.

Course Description

This is a course for PhD students at the Department of Economics at Sciences Po in Computational Economics.

Course Overview

In this course you will learn about some commonly used methods in Computational Economics. These methods are being used in all fields of Economics. The course has a clear focus on applying what you learn. We will cover the theoretical concepts that underlie each topic, but you should expect a fair amount of hands on action required on your behalf. In the words of the great Che-Lin Su:

Doing Computation is the only way to learn Computation. Doing Computation is the only way to learn Computation. Doing Computation is the only way to learn Computation.

True to that motto, there will be a homework associated to each session. There will also be a term paper. It will be helpful to bring a laptop to the sessions if you have one.

Topics will be demonstrated through live-code examples/slides, available at ScPo-CompEcon.github.io/slides.

Prerequisites

  1. No previous programming experience is required.
  2. You will have to write working computer code, however, so you will have to learn how to program. [This is good news.]
  3. We will be using Julia
    1. It would be helpful if you could come with julia installed on your computer. Download here.
    2. Additional to that, please follow instructions here to install 2 packages that we will use often, PyPlot and IJulia.
    3. A very good place to start with Julia is the quant-econ.net website
    4. There are more tutorials listed below in subsection Julia tutorials
  4. There are countless good programming tutorials on the web, particularly for Python. If you have no programming experiences whatsoever, it may be useful to go through one of those. Once you know a bit of Python, Julia will be very close.
  5. Some experience with the Unix Shell and the verion control system Git would be very useful - for this course, and for the rest of your life as a scientist. I do therefore recommend that you spend some time (2h total max) with the following excellent tutorials:
    1. Software Carpentry: The Unix Shell
      • If you are on MacOS/Unix, just open the terminal application and you're good to go.
      • On Windows, you need to make up for the fact that you are not Unix. I recommend Gnu on Windows (GOW)
    2. What is Version Control? 5 minute video.
    3. Try Git on codeschool.org: This is a 15 minute intro to Git. So cool!

Homeworks

Each session is accompagnied by a homework. They will be listed within the Course Outline.

Workflow of Homeworks

The aim of the following setup is to put a system in place by which we can easily look at your solutions to a problem, you can easily look at my solutions (next to yours), and we can also look at the solutions of your peers in order to have a better learning experience. Writing code is a activity with tremendous returns from collaboration, and we will try and foster that in this course. Apart from this, a vast amount of high quality code is nowadays developed following this model, so it is a useful skill for you to know how the fork-change-pull-request model works.

If you don't know what Git is, please look at the prerequisites first.

If you're using GitHub Desktop, these instructions will help explain the Git/GitHub concepts. Here are the overall steps:

  1. Fork the repository for homework x (found under github.com/ScPo-CompEcon). You do that by clicking on fork on github.
  2. Clone the repository to your computer: use command git clone https://github.com/your-username/homework-x.git or do in your GUI.
  3. Create a new branch on your computer called my-solution.
    • you can use the command git checkout -b my-solution
  4. Modify the files to complete your solution.
  5. Make sure your code runs and produces all output.
  6. Write a test for your code if possible.
  7. Commit all of your code to your local repository.
  8. Push your branch my-solution up to your fork of my repo at GitHub.
    • you do git push origin my-solution
  9. Create a pull request for my-solution on the original repository, i.e. the owned by github.com/ScPo-CompEcon.
  10. You can continue to push fixes and improvements until the close date (24 hours before the next class).
  11. I will push my solutions to Exercise repository once you have handed in yours. You can then sync your master branch with those solutions. This way, you have both your solutions (on branch my-solution) as well as my solution (on the master branch).

Requirements for Homeworks

  • I invite you to do the homeworks in teams of 2.
  • You have two weeks for each homework, and they are due 24 hours before the next class, so that I have time to look at them and provide some feedback.
  • Please make clear who the contributors are in your comment on the pull request.
  • There is clearly a tradeoff between you learning by trying hard, learning from seeing the work of your colleagues, and not learning at all by just copy and pasting the best solution 1 minute before the deadline. I can only remind you that you harm noone but yourself by not exerting effort on the homeworks.
  • Each solution you submit must contain text file called outline.md where you describe briefly in words what you are doing in your implementation. It is good practice to write this before you even start. (you can always go back and edit this document if you find out that what you wanted to do does not work, but at least you know always what you are trying to do.)
  • Notice the file extension .md stands for markdown, probably one of the more amazing inventions of the web. You can super easily generate formated text by just using very intuitive markup symbols. This document is written in markdown.

Term paper

You are expected to produce a term paper over the course of the semester. This could be:

  • A replication of a paper that uses computational methods.
  • Computing additional things that another (maybe theoretical) paper does not compute.
  • Ideally, it would be your own research project.

Requirements for the Term paper

  • Due Date: May 9th 2016.
  • You must do this on your own.
  • The paper should be max 15 pages of double-spaced 12pt font text, excluding any graphs or tables.
  • The paper should contain
    1. A motivation/introduction and formulation of the research question.
    2. A justification for why one needs computational methods to answer this question.
    3. A model.
    4. A clear outline describing the computational approach to compute the model.
    5. A presentation of the results.
    6. A discussion of the accuracy of the obtained results.
  • Furthermore, the code you write needs to be on github, if you want in a private rather than public repository, to which you grant me access. (you get access to 5 private repos for free). There will be extra marks for code readability and code quality.

Weapon of Choice: Which Software?

My weapon of choice for this course is the Julia Computing Language. I see this as an occasion to persuade you to overcome any switching costs that may have put you off from learning Julia up until now and to give it a try. That said, for most programmers (of Python, Matlab or R) these switching costs are small. [If you are a Fortran/C++ programmer, the switching costs are negative, i.e. you will enjoy the switch.]

I appreciate that people have strong opinions on which software is best. We will briefly touch upon that question in the first session and think about the pros and cons of different languages.

I said there are no prerequisites; That does not mean you should not get a head start, if you so desired. An excellent tutorial for Julia is available at the quant-econ.net website, and I highly recommend you go and have some fun with it. Some more references are listed right here:

Julia Tutorials

Julia Environments

Textbooks

There are some excellent references for computational methods out there. This course will use material from

  • Fackler and Miranda (2002), Applied Computational Economics and Finance, MIT Press
  • Kenneth Judd (1998), Numerical Methods in Economics, MIT Press
  • Nocedal, Jorge, and Stephen J. Wright (2006): Numerical Optimization, Springer-Verlag

(recommended ones in bold face)

Course Outline

Each subsection here stands for one session of 2 hours. There are 6 subsections.

First Session: Introduction, Logistics and Numerical Integration

  1. First things first
    • Put name on sticky note on back of monitor
    • Discuss what the class is going to cover
    • Everyone introduce themselves
      • Name
      • What you "do"
      • What are your goals for the class?
      • What's something related to computation in Economics you worry that your peers understand but you don't?
  2. Setup
    • How many people are comfortable with Git/GitHub?
    • Install GitHub Desktop
      • If you are comfortable with Git already, you can skip this.
    • Sign up for GitHub
  3. GitHub workflow
  4. Explain how slides work
  5. Talk through homework requirements
  6. Talk through term paper requirements
  7. Talk through weapon of choice

Talk about Computation!

  1. Basic Computing concepts
    • The fundamental tradeoff: Speed vs Accuracy
    • Some numerical gotchas
    • Computer Basics
    • Intro to Julia

Reading

Homework

  1. make sure you signed up on github (and put a picture there!)
  2. Join the chat room. You can ask any question you want there - will see them even if offline.
  3. [10 min read] Do this short online tutorial on an example github workflow
  4. [4 min read] Do this short online tutorial on forking on github
  5. download GitHub Desktop. [Someone said they are running MacOS < 10.9, and the latest release was 16 years ago. I can't believe that is the case, but please contact me if you cannot install this program.]
    • Please go through the initial tutorial. It is helpful.
  6. do the fork-and-pull-request exercise on the students repository
  7. Please note: I added a comment (about a comment) to my JSON example file. Make sure your file has exactly that format, and is exactly saved in that location. (you have to look at my repo, not your fork)

Session: Integration and Function Approximation

  1. Numerical Integration and Derivation
    • Monte-Carlo integration
    • Gaussian Quadrature
    • Multidimensional Quadrature
      • Quadrature with correlated shocks
    • Numerical Differentiation
  2. Function Approximation
    • Polynomial Interpolation
      • Basis functions and Coefficients
    • Regression as Approximation
    • Colocation Methods
    • Multidimensional Approximation
      • The Smolyak Grid

Homework

  • Fork the homework at github.com/ScPo-CompEcon/HW-integration
    • Follow steps detailed there.
  • Create a new repository on github for your term paper.
    • Choose a name, whether public of private and select the option to create a README.md file. clone.
    • In the README.md file detail your project idea in a few words (more than 100 but less than 500). If you need math, include an IJulia notebook.
    • If you decide to make this a private repository, you need to add me as a collaborator.
    • push to github.
    • email me the URL of the repo by the homework deadline (24h prior to next class.)

Session: Optimisation

  1. Unconstrained Optimisation
    • Comparison Methods
    • Newton's Method
    • Line Search, Trust Region, and other Methods
    • Application: Maximum Likelihood
    • Introduce http://www.juliaopt.org
  2. Constrained Optimization
    • Theory
    • Some Numerical Methods for Constrained Optimization

Homework


Session: Constrained Optimisation Applications

  1. MPEC on John Rust's Bus Engine Replacement
  2. The Berry-Levinsohn-Pakes (BLP) paper as constrainted optimization problems

Homework


Session: Numerical Dynamic Programming

  • Review of DP theory
  • Different Solution methods for different cases

Homework


Session: Sky's the Limit - Parallel Computing in the Cloud

Homework


Pairing Tips

  • Three people is possible, but two works best
  • Agree on an editor and environment that you're both comfortable with
  • The person who's less experienced/comfortable should have more keyboard time
  • Switch who's "driving" regularly
  • Make sure to save the code and send it to both people

Resources

Beginner Materials

Recommended Reading

Tools

GitHub

Grading

50% homeworks, 50% paper

Statements on Plagiarism

We will try to honour Science Po's anti-plagiarism policy:

Plagiarism occurs when a student submits work that does not allow one to distinguish the student's own thoughts from those of other authors: it can be characterised by the absence of citation of a group of consecutive words (five or more), by reformulation or translation, or by copying directly." (article on intellectual honesty)

Related to Plagiarism

Reuse and building upon ideas or code are major parts of modern software development. As an economist writing code, you will (hopefully) never write anything from scratch. This class is structured such that all solutions are public. You are encouraged to learn from the work of your peers. As I said above, I won't hunt down people who are simply copying-and-pasting solutions, because without challenging themselves, they are simply wasting their time and money taking this class.

Please respect the terms of use and/or license of any code you find, and if you reimplement or duplicate an algorithm or code from elsewhere, credit the original source with an inline comment.

License

In setting up this course I was heavily influenced - and shamelessly copied entire parts of - https://github.com/advanced-js taught by Aidan Feldman and team at NYU, and I would like to thankfully acknowledge making the materials useable to other teachers. The same license applies (below). The license allows you to copy and use everything here, under the condition that you attribute the work (details in the license). The copyright notice to be included in any such copies and other derivative work is:

Copyright 2015 Florian Oswald, Sciences Po Paris, florian.oswald@gmail.com

Thank you.

Creative Commons License
This work and all other materials under https://github.com/ScPo-CompEcon are licensed under a Creative Commons Attribution 4.0 International License.