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

Setup 2022

In 2022, the course will be limited to four afternoons, from Tuesday August 23-Friday August 26 (13-16.30/17.00h) at the Moscow room at the Tinbergen Institute Amsterdam. The room does not contain desktops, hence 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.

At this Google Doc, please annotate the exercises you have performed, leaving a mark as to whether you found them easy (=1), or hard (=5), or got stuck (=x).

Download material

Questions & answers

At Q&A I'll post a page with questions and answers, as they come up. Later, the questions and answers will move to Canvas.

Updates

2022/7/30: Opened up the videos further; should now be visible without a VUNet login

2022/8/15: Added answers to E0 exercise

2022/8/16: Added location: Tinbergen Institute Amsterdam. Please bring your own laptop!

2022/8/24: Added exercises (at bottom of current page)

TopicPagesVideoExercise
Day 0: Introduction 1-1 Vid
Exercise E0 PDF (read/answer these questions now, answers here) code
Installation 55-59 Vid
Getting started - Vid
Target 1-5Vid (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 60-61 Vid (9:59)
Theory: Planning programs 62-74 Vid (32:03) pynb d1p2_fill
Concepts: Data, variables, functions, actions 75-91 Vid (39:47) pynb d1p1_olsgen
View versus copy, scope 92-101 Vid (33:43)
Day 2: Preview 102-103 To add?
Steps 104-110 Vid (12:06)
Flow: Coherent structure for the program 111-114 Vid (13:59)
Precision: Floating point numbers and rounding errors 115-123 Vid (25:13)
Do's and dont's: Practical advice 124-125 Vid (13:12) pynb d2p2_olsgen2
Import: Importing packages and routines 126-128 Vid (12:05)
Graphs: Plotting in python 129-136 Vid (14:19) pynb d2p4_graphs
Pandas: Data analytics/handling 137-151 Vid (41:57) pynb d2p3_pandas
Day 3: Newton-Raphson Optimisation 152-166 Vid (32:20)
Minimize: Likelihood, precision, convergence and scores 167-190 Vid 1 (30:39), Vid 2 (20:12) pynb d3p1_ll, d3p2_grad
Solving: Solving non-linear equations 191-198 Vid (15:06)
StDev: standard deviation 199-205 Vid (17:34) pynb d3p3_sd
Restrictions: SLSQP vs BFGS 206-222 Vid (27:17)
Extra: Speed 223-234 Vid (29:46)
Closing thoughts See class, with estbern.py

Final exercises

The groups of TI and BDS are obliged to hand in a final exercise before Friday September 30, 23:59h, through Canvas (link to be provided). This exercise can be chosen from the set
  1. GARCH-X: Estimate inflation data, with initially OLS, then including GARCH
  2. Binary Tree: Calculate the price of an option through a binary tree
The first exercise follows the exercises throughout the course closely, the second exercise is for those students who would like to try something new. Rules for passing the course are simple: Show your effort during the course, and afterwards let me see what you have learned. Hand in original code, and you should pass easily.