Data and modeling

Machine learning for econometrics

Econometricians use machine learning in two main ways: forecasting economic series from many predictors, and estimating policy effects with methods such as double machine learning, which use flexible models for nuisance terms. Lasso, random forests and gradient boosting are the common workhorses.

How machine learning is used in econometrics

Prediction problems in economics

Some policy questions are prediction questions, such as which applicants are likely to default or which areas will need support. Machine learning models are used for these, with care not to read their coefficients as causal effects.

Real exampleMachine Learning: An Applied Econometric Approach (Mullainathan and Spiess, 2017)Published in the Journal of Economic Perspectives, the article explains how machine learning prediction works and where it fits in an economist's toolkit.

Selecting controls in high-dimensional data

When there are many possible controls or instruments, lasso-based methods choose them in a way that still allows valid inference on the effect of interest. This replaces ad hoc specification searches.

Real exampleHigh-Dimensional Methods and Inference on Structural and Treatment Effects (Belloni, Chernozhukov and Hansen, 2014)The article reviews methods for estimating structural and treatment effects with high-dimensional data, where the number of variables is large relative to the sample size.

Using text as economic data

Central bank statements, news, filings and job adverts are turned into numerical measures with text models, then used as variables in economic analysis. This opens questions that structured data cannot answer.

Real exampleText as Data (Gentzkow, Kelly and Taddy, 2019)The Journal of Economic Literature article introduces the use of text as an input to economic research and the statistical methods involved.

Heterogeneous policy effects

Economists use causal forests and related methods to estimate how a policy's effect varies across people or regions. The results inform who a programme should target.

Real exampleMachine Learning Methods That Economists Should Know About (Athey and Imbens, 2019)The authors survey machine learning methods relevant to economists, including methods for estimating causal effects and heterogeneous treatment effects.

Can economists learn machine learning?

Yes. Economists already know regression, inference and identification, which covers much of the theory. The main additions are Python, cross-validation, regularisation and tree ensembles, and the methods that combine them with causal inference.

  1. Python for economistsMove data work from Stata or R to Python with pandas, keeping the same panel and time series operations.Learn it in Python
  2. Out-of-sample evaluationLearn train and test splits, cross-validation and time-aware validation, which replace in-sample fit as the measure of a predictive model.Learn it in Machine Learning
  3. Regularisation and tree ensemblesFit lasso, ridge, random forests and gradient boosting, and understand the bias and variance trade-off each one makes.Learn it in Machine Learning
  4. Causal machine learningApply double machine learning and causal forests with EconML, and compare the results with your usual specifications.

Moving between econometrics and machine learning

If you already work in the field

Economists bring strong inference, identification and data skills. Add Python and a few machine learning models, then redo one empirical project with a held-out forecast comparison or a double machine learning estimate alongside your original specification.

If you come from data science or ML

If you come from machine learning, learn identification: instrumental variables, difference in differences and regression discontinuity, and why standard errors matter as much as accuracy. An introductory econometrics text and replicating one applied paper are a good start.

Roles that do this workEconomistEconometricianEconomist (tech)Quantitative researcherPolicy data scientist

Tools you will use

ToolWhat you use it for
statsmodelsFit OLS, ARIMA and other classical econometric models with full diagnostics.
linearmodelsEstimate panel, instrumental-variable and system regressions in Python.
EconMLApply double machine learning to estimate policy and treatment effects.
scikit-learnFit lasso, random forests and gradient boosting for forecasting and nuisance models.

Public data to practise on

Your first project

Download the Penn World Table, predict each country's next-year GDP-per-capita growth with lasso on lagged indicators, and compare it with a country-average growth baseline using RMSE on the most recent years held out.

Common questions

What is the difference between econometrics and machine learning?

Econometrics usually aims to estimate parameters with a causal or structural meaning and valid uncertainty. Machine learning usually aims to predict well on new data. Modern work combines them, using ML for prediction steps inside an econometric design.

Is lasso used in econometrics?

Yes. Lasso is used for forecasting with many predictors and, through post-double-selection and related methods, for choosing controls while keeping valid inference on a treatment effect.

Do economists use Python or R?

Both, along with Stata. Python is common where work involves machine learning or large data, and R is widely used in academic econometrics. The methods transfer between them.

Courses for these skills

New to programming or maths? Start with Python, or follow the machine learning path in order. Published lessons are free to read; compare Free and Pro.