Skip to content

Welcome to the UChicago Code Camp

The goal of this camp is to provide a solid foundation in coding and computing that will hopefully save you time throughout the next 5–6 years of your PhD. One important disclaimer: thanks to LLMs, the set of tools available is evolving extremely quickly. Some things we cover may become obsolete before the week is even over.

The camp will cover three main dimensions:

  1. Tools (terminal, editor, environments, version control, …)
  2. Programming paradigms (scopes, logging, assertions, memory allocation, HPC, …)
  3. Scientific programming (automatic differentiation, integration, optimization, …)

In my view, it’s easier to learn tools when you actually need them. We’ll emulate this by working through problem-set style exercises.

During the camp, we will use code and projects set up in the following repository: Code Camp.


Syllabus 2025

Sessions 1–2: Development Environment Setup

We will follow the instructions from branch badge.

  • software stack: VS Code, terminal, Docker, dev containers, Python environments
  • project structure: notebooks, Python modules, auto-reload
  • defensive programming: assert, debugging
  • version control: Git, GitHub, Markdown primer
  • Python type hints, testing
  • introduction to GitHub Actions
  • access to Acropolis HPC, running scripts

Session 3: Moment-Based Estimation

Using Blundell, Pistaferri & Preston, we’ll work with the code available at branch badge.

  • simulation code for panel earnings data
  • code to construct variance–covariance matrices of earnings growth
  • introduction to PyTorch and automatic differentiation, with a quick preview of object-oriented programming in Python
  • use auto-diff and PyTorch to build an estimator for model parameters using moment matching (see permanent–transitory code)
  • extend the torch.nn.Module class
  • apply gradient descent optimization

Session 4: Monte Carlo, Bootstrap, and Parallelization

  • deploy project to Acropolis
  • parameterize scripts with input data structures using argparse and Pydantic
  • use scriptflow to build a parallel workflow for the estimator from the previous session (sflow.py)
  • bootstrap the estimator on PSID data with scriptflow to obtain confidence intervals for the MA parameter
  • run workflows on HPC using out-of-core parallelization

Session 5: Dynamic Discrete Choice in Julia

Based on Rust’s 1981 bus engine paper, with project materials available at branch badge.

  • from Python to Julia (types, piping, dot operations, environments, Revise.jl, …)
  • Bellman equation for the bus engine problem with extreme value shocks
  • value function iteration to solve the Bellman equation
  • construction of the likelihood
  • maximize likelihood using the nested fixed-point method
  • maximize likelihood using MPEC