How to learn coding for economists

As an empirical economist you will have to implement statistical techniques. There are many different programmes that can support you in this. Some of these (like STATA) are very specialised to economics. Two very popular programming languages that are used in this field are R and Python.

Learning any programming language can only be done by doing. Here we are not exposing you to a bottom-up introduction of R, but we are immediately exposing you to the exciting possibilities of R and the beauty and excitement of working with real-life data. As we do so we expose you to the basic tools of working with data in R and help you to learn these.

However, you have to accept from the outset that this is going to be a bumby raod! The most crucial skill you will have to embrace and develop is that of finding solutions to problems. You will, as any programmer, yes, even the most experienced ones, search the internet for solutions to your problem. Don’t think that you can remember all the important commands from the top of your mind.

Basic techniques

In the following a few basic data techniques are introduced. Where you need to download csv files you will be guided to a github page from where you can download the respective csv file.

Topic Workthrough in R Workthrough in Python
Installing Video Workthrough in Py
First Steps Workthrough in R, Video Workthrough in Py
Using Packages/Libraries Workthrough in R Workthrough in Py
Loading Data Workthrough in R Workthrough in Py
Basic Data Analysis Base R, Tidyverse Workthrough in Py
Basic Data Visualisation (ggplot) Workthrough in R Workthrough in Py
General coding techniques Loops in R Workthrough in Py

Large Data / Data Science techniques

Topic Workthrough in R Workthrough in Python
Regression Model Selection Workthrough in R
Ridge and LASSO Regression Workthrough in R
Post Double Selection LASSO Workthrough in R
Cross-Validation Workthrough in R
Principal Components Workthrough in R

Dealing with Time-Series variables

Topic Workthrough in R Workthrough in Python
Simulating AR Models Workthrough in R
Unit Root Testing Workthrough in R
Basic TS modeling Workthrough in R
GARCH modeling Workthrough in R

Miscallaneous

These workthroughs demonstrate coding techniques that are useful in a range of different contexts.

Topic Workthrough in R Workthrough in Python
Creating Maps Workthrough in R
Law of Large Numbers and Central Limit Theorem Workthrough in R
Monte-Carlo Simulations Workthrough in R

Examples

In the Examples section of this page we collate empirical examples which can be used to help students understand a range of statistical and econometric techniques. This page benefits from a range of empirical examples which have been implemented in a range of books.

The examples from these books and others have been amended or re-written such that students can either use them directly or to facilitate adoption by lecturers.

You can find further resources here.