Econometrics in Python: Cross-Sectional Analysis with OLS

Augusto Gonzalez-Bonorino
18 min readFeb 23, 2023

Join me in learning how economists uncover relationships by exploring the basics of econometrics, the original machine learning.

source: DALL-E 2 — Image by Author

If you would like to follow along. All of the code, plus additional methods, can be found in my github repository.

Introduction

Econometrics develops tools and special methods to analyze observational data from uncontrolled environments with the objective of judging economic theories empirically. Ordinary Least Squares (OLS) is a simple and widely used econometric tool for estimating the parameters of linear models. By understanding how to use OLS, you will have a powerful tool at your disposal for analyzing economic data and extracting causal effects from your cross-sectional data.

This article provides a detailed guide on using Ordinary Least Squares (OLS) to predict economic growth across high and upper-middle income countries, using Python. We will begin by introducing the OLS estimation process, comparing it briefly to Machine Learning (ML) models’ objectives, and highlighting its relevance across various disciplines. Next, we will gather and prepare the data, implement OLS in Python, evaluate the model, and interpret the results. Throughout the article, we…

--

--

Augusto Gonzalez-Bonorino
Augusto Gonzalez-Bonorino

Written by Augusto Gonzalez-Bonorino

Msc Economics at Claremont Grad Univ. From Argentina. I created the Entangled Mind blog. Check it out ;) Lead Researcher @ https://www.econllm-lab.com/