Principles of Programming in Econometrics
Principles of Programming in Econometrics is a bootcamp course intended for beginning QRM and TI/BDS PhD students, aspiring to flavour their research with their own coding. The course is build around material collected over the years, around either the Ox, Matlab, and nowadays Python languages.
Topics
Topics covered within the course are- Structure of coding (where do I start)
- Structure of a program (how do I build in robustness)
- Concepts of variables/functions (what do I program)
- What is a number, should I care for rounding errors (what could go wrong)
- Optimisation and solving (non-)linear equations (how do I find the answer)
- and further matters...
Setup 2025
For 2025, the course will again be given as a follow theory from home, practice in class course. Below, a series of videos will take you through the material, study this in advance.
Indeed, many of the videos still date back from the Covid period; parts where more of the structure has changes are/will be renewed.
As the setup has served many students well, we'll continue in 2025 with a setup where the bulk of the information of the course is served in a series of video lectures. Students are advised to follow these lectures in advance, at their own rhythm. Then, in a tutorial, to be held from Tuesday August 26-Friday August 29 13-16.30h, we'll convene with TAs and myself at the Tinbergen Institute Amsterdam to work through the exercises together and practice/hone your capabilities further. Desktops are NOT available in the room, so bring your own laptop.
These afternoons, both the teacher and several teaching assistants will help you move through the material. However, the material needs time for practice, hence you will not escape starting on time, several weeks earlier, such that you can use the supervision more intensely.
The table below lists the topics, explanatory video's, and practice material. Try to work through the material as far as you can, e.g. at least until the optimisation topics.
To participate in the course, you will be signed up automatically if you join the TI/BDS mphil programs, or the QRM master; students I get listed from these programs I will add to a Teams surrounding which we can use for communication. If somehow you do not get the invitation on time, please get in touch by email, and I'll add you manually (registration of new students is starting a new program is a slow and tedious process, my lists may well not be fully up-to-date).
Optionally, if you finish the material, feel free to try out one of the exercises from the download material. If you try them, make a good effort of getting clean, robust code following the rules of the course... And then send me your result by email at c.s.bos@vu.nl, in a zip-file containing code + data + short explanation in .txt or .pdf. Then I will try to eventually take a look at it.
Download material
- Course slides
- Exercise slides
- Full zip of course material
- fill.zip for one of the exercises
- e0_elim.zip with backsubstitution
- sa0.zip with pandas example
- Optional Exercise GARCH-ML
- Optional Exercise Binary Tree
Questions & answers
At Q&A I'll post a page with questions and answers, as they come up.
Updates
2025/6/11: Updated videos, reset all links
2025/7/2: Added random numbers video
2025/7/7: Added time and location of the course
2025/8/27: Updated install section in course slides, to include Pulsar
| Topic | Pages | Video | Exercise |
|---|---|---|---|
| Day 0: Introduction | 1-1 | Vid (12:47) | |
| Exercise E0 | (read/answer these questions now) | code | |
| Installation | 55-59 | Vid (8:43) | (to renew) |
| Getting started | - | Vid (17:16) | |
| Target | 1-5 | Vid (18:19) | |
| Example 2^8, syntax | 12-23 | Vid 1 (33:50), Vid 2 (16:22) | pynb d0p1 |
| (Hungarian) Notation, variable names | 24-32 | Vid (23:08) | pynb d0p3_secret |
| Recap, review syntax | 33-54 | Vid (47:52) | pynb d0p2_backsubstitution |
| Day 1: Intro | 63-64 | Vid (9:59) | |
| Theory: Planning programs | 65-77 | Vid (32:03) | pynb d1p2_fill |
| Concepts: Data, variables, functions, actions | 78-94 | Vid (39:47) | pynb d1p1_olsgen |
| View versus copy, scope | 95-104 | Vid (33:43) | |
| Day 2: Preview | 105-106 | Vid (4:06) | |
| Steps | 107-113 | Vid (12:06) | |
| Flow: Coherent structure for the program | 114-117 | Vid (13:38) | |
| Precision: Floating point numbers and rounding errors | 118-126 | Vid (25:13) | |
| Random: How to get random numbers | 127-134 | Vid (25:44) | |
| Do's and dont's: Practical advice | 135-136 | Vid (13:12) | pynb d2p2_olsgen2 |
| Import: Importing packages and routines | 137-139 | Vid (12:05) | |
| Graphs: Plotting in python | 140-147 | Vid (14:19) | pynb d2p4_graphs |
| Pandas: Data analytics/handling | 148-162 | Vid (41:57) | pynb d2p3_pandas |
| Day 3: Preview | 163-164 | ||
| Newton-Raphson Optimisation | 165-177 | Vid (32:20) | |
| Minimize: Likelihood, precision, convergence and scores | 178-201 | Vid 1 (30:39), Vid 2 (20:12) | pynb d3p1_ll, d3p2_grad |
| Solving: Solving non-linear equations | 202-209 | Vid (15:06) | |
| StDev: standard deviation | 210-216 | Vid (17:34) | pynb d3p3_sd |
| Restrictions: SLSQP vs BFGS | 217-233 | Vid (27:17) | |
| Extra: Speed | 234-245 | Vid (29:46) | |
| Closing thoughts | See class, with estbern.py |