Computational Aspects in Econometrics - Python II module

Author

Pieter Kleer

1 About

1.1 Welcome

Welcome to the online “book” for the Python II module of Computational Aspects in Econometrics (35V3A1). We will follow the content in this book during the lectures and it is the basis of the material that will appear on the exam, so you should read through this book carefully. Because this book is new, it is likely that we will make some edits throughout the course.

Please not that this is a more advanced Python module. We assume familiarity with the basics of programming in Python. For students enrolled in the bachelor Econometrics and Operations Research, the topics of the course Computer Programming (346022) is a good example of what you should be familiar with. An online book covering most of these topis can be found here. This book also contains some topics not covered in the course Computer Programming.

1.2 Goal

The goal of this module is to teach you the basics of scientific computing with Python. Here you should think mostly of implementing algorithmic tasks that you encounter during your Econometrics and Operations Research courses, such as, linear algebra, optimization, statistics and machine learning. We hope that the skills you are taught here can be useful for, e.g., numerical work in your Bachelor’s or (perhaps later) Master’s thesis. Furthermore, many companies nowadays program in Python, so the topics of this module can also be useful in your professional career later in life.

Next to teaching you how to implement certain mathematical tasks in a correct manner in Python, we also put emphasis on good coding practices. Especially if you start to write scripts with hundres of lines of code, it is important that you learn how to do this in a structured fashion using efficient Python functionality. Good coding practices are the topic of the next chapter. The idea is that you use these practices when doing the exercises corresponding to every lecture, as well as the group assignment.

1.3 Use of Spyder

This course document is based on the use of Spyder as integrated development environment (IDE) for creating Python code, i.e., the program that the code is written in. You can also use VS code or any other IDE to do the exercises and/or assignment in. Whenever this book contains screenshots to illustrate something, they will have been taken in Spyder.

To install the Anaconda distribution containing Spyder, follow the steps here. This is the installation that was also recommended in the Python I module.