Lesson 22

Omitted Variables, Measurement Error, Simultaneity, and Endogeneity

Big question

Why can a beautifully estimated regression still answer the wrong question?

Lesson progress

Complete checkpoints as you learn

0% complete0 checkpoint streak
Progress tracking available after sign-in. Sign in to save your work.
Big question
Concept
Activity
Quiz

Learning objectives

  • Explain and apply omitted-variable bias.
  • Explain and apply bad controls.
  • Explain and apply measurement error.
  • Explain and apply reverse causality.
  • Explain and apply simultaneity.
  • Explain and apply selection.
  • Explain and apply endogeneity.
  • Explain and apply why adding more controls is not a universal cure.

Simple explanation

This chapter begins from the economic question rather than from software syntax. The goal is to understand what information the data can legitimately provide about omitted variables, measurement error, simultaneity, and endogeneity. Python is used as a transparent laboratory: we state the question, define the target, inspect the data, estimate the model, and then challenge the result. A recurring distinction in econometrics is the difference between describing a pattern, predicting an outcome, and estimating a causal effect. These goals can use similar equations but require different assumptions. A model may forecast well while offering little causal interpretation, and a credible causal design may deliberately use a simple estimator because identification comes from the research design rather than algorithmic complexity. Throughout the chapter, pay attention to units, timing, sample construction, and the information set available to the analyst. Economic data are produced by institutions, markets, households, and firms. They are not abstract arrays. A good empirical workflow therefore combines statistical discipline with substantive economic reasoning.

Key terms

omitted-variable bias
A core idea in Chapter 22 that students apply carefully in economic analysis.
bad controls
A core idea in Chapter 22 that students apply carefully in economic analysis.
measurement error
A core idea in Chapter 22 that students apply carefully in economic analysis.
reverse causality
A core idea in Chapter 22 that students apply carefully in economic analysis.
simultaneity
A core idea in Chapter 22 that students apply carefully in economic analysis.
selection
A core idea in Chapter 22 that students apply carefully in economic analysis.

Chapter 22 model

E[YX]=m(X),orinalinearapproximation,Yi=β0+β1Xi+ui.E[Y | X] = m(X), or in a linear approximation, Y_i = β₀ + β₁X_i + u_i.

Interpret the expression in words and units before using it in a claim.

Example

Start with a tiny hypothetical sample that can be checked by hand. Write the unit of observation, outcome, explanatory variable or treatment, and the comparison being made. Before estimating anything, ask what would make the comparison informative and what could make it misleading. The difference in group averages is easy to compute, but whether it is a causal effect depends on how exposure was assigned and whether the groups are otherwise comparable. This distinction is the heartbeat of modern applied econometrics.

Prerequisites

  • Complete the preceding course chapters or review their summaries as needed.

Full theory and examples

22.2

Economic intuition

This chapter begins from the economic question rather than from software syntax. The goal is to understand what information the data can legitimately provide about omitted variables, measurement error, simultaneity, and endogeneity. Python is used as a transparent laboratory: we state the question, define the target, inspect the data, estimate the model, and then challenge the result.

A recurring distinction in econometrics is the difference between describing a pattern, predicting an outcome, and estimating a causal effect. These goals can use similar equations but require different assumptions. A model may forecast well while offering little causal interpretation, and a credible causal design may deliberately use a simple estimator because identification comes from the research design rather than algorithmic complexity.

Throughout the chapter, pay attention to units, timing, sample construction, and the information set available to the analyst. Economic data are produced by institutions, markets, households, and firms. They are not abstract arrays. A good empirical workflow therefore combines statistical discipline with substantive economic reasoning.

22.3

A small numerical example

Start with a tiny hypothetical sample that can be checked by hand. Write the unit of observation, outcome, explanatory variable or treatment, and the comparison being made. Before estimating anything, ask what would make the comparison informative and what could make it misleading.

The difference in group averages is easy to compute, but whether it is a causal effect depends on how exposure was assigned and whether the groups are otherwise comparable. This distinction is the heartbeat of modern applied econometrics.

Chapter 22 source table
ObservationX / TreatmentOutcome YInterpretive note
1010baseline
2012comparison
3115exposed
4117exposed

22.4

Formal framework

Write the empirical model in a form that makes the target explicit. A generic conditional-mean representation is

E[Y | X] = m(X), or in a linear approximation, Y_i = β₀ + β₁X_i + u_i.

Here Y is the outcome, X denotes observed information, β parameters summarize the chosen model, and u collects other determinants of the outcome. The crucial question is not only whether β can be estimated, but what β means under the design and assumptions.

22.5

Python demonstration

import numpy as np, statsmodels.api as sm

rng=np.random.default_rng(22)

z=rng.normal(size=400); v=rng.normal(size=400)

x=.8*z+v; e=.7*v+rng.normal(size=400); y=1+1.5*x+e

print(sm.OLS(y,sm.add_constant(x)).fit().params)

Run the code in a clean notebook and inspect both the numerical output and the data-generating assumptions. The associated notebook in the student package reproduces the example with a fixed random seed.

Figure 22.1. Why can a beautifully estimated regression still answer the wrong question?

22.6

Interpretation

Interpret results in the units of the variables. Report sign, magnitude, uncertainty, and the population or time period to which the estimate applies. If a variable is logged, categorical, interacted, standardized, or transformed, translate the coefficient accordingly rather than reading it as a raw one-unit effect.

Then separate statistical significance from economic significance. A precise estimate may be too small to matter economically; an economically important estimate may be imprecise. Both dimensions belong in the conclusion.

22.7

Assumptions, diagnostics, and threats to validity

Is the unit of observation appropriate for the question?

Are timing and information sets respected?

Could selection, confounding, measurement error, or reverse causality matter?

Does the uncertainty estimator match the sampling or dependence structure?

Would the result survive reasonable alternative specifications?

Is the task predictive, descriptive, or causal?

Visual evidence

Original Ceteris Lab course figure
Original Ceteris Lab course figure

Guided practice

  1. 1Modify the notebook so that one assumption is deliberately violated. Re-estimate the model, compare the result, and explain why the estimate changed. This turns diagnostics from a checklist into an experiment.

Exercises

  1. 1Concept: In one paragraph, distinguish association, prediction, and causation for the chapter topic.
  2. 2Python: Reproduce the demonstration with a different documented random seed and verify that the qualitative conclusion is stable.
  3. 3Applied econometrics: Replace the simulated outcome with a legally shareable economic variable and document its units, source, and sample.
  4. 4Interpretation: Write a 150-word results paragraph that reports magnitude and uncertainty without exaggerating the evidence.
  5. 5Research challenge: Propose one alternative design or robustness check that would address the most important threat to validity.

Source and downloads

Chapter 22 of Fundamentals of Python for Financial Econometrics by Mohammad Safavi, Ph.D.. The lesson is an original Ceteris Lab web adaptation of the supplied publication package.

Live Python

Omitted Variables, Measurement Error, Simultaneity, and Endogeneity: live Python

Omitted Variables, Measurement Error, Simultaneity, and Endogeneity: live Python

Stdout

Run Python to see results here.

Status / stderr

Ready to run Python in your browser.

Line-by-line guide

  1. Line 1Display a result so students can inspect the output.

Python walkthrough

  1. 1Connect the conceptual chapter to an explicit, reproducible workflow.

Live notebook

Run this lesson as a notebook

Open an editable notebook cell-by-cell, run Python in the browser, and download the `.ipynb` file for later.

Related dataset

Ceteris Lab teaching sample

Estimated time

25 to 40 min

Packages

pandas, numpy, statsmodels, patsy

Expected output

A regression or inference table with coefficients, uncertainty, and short interpretation notes.

Learning goals

  • Load and inspect Ceteris Lab teaching sample.
  • Run the Python cells connected to Omitted Variables, Measurement Error, Simultaneity, and Endogeneity.
  • Interpret the output using omitted-variable bias and bad controls.

Common errors

  • File not found: check that wage_sample.csv is installed or use the course data folder.
  • Package import error: use the browser notebook first, then download for local Jupyter if your local packages differ.
  • Column name error: compare your variable names with the dataset variables listed for this notebook.

Dataset path helper

import pandas as pd

df = pd.read_csv("/data/wage_sample.csv")
df.head()

Interactive activity

Chapter 22 interactive

Assumption stress test

Evidence strength: 55%
Weak designCredible design

What should determine the strength of an econometric claim?

Immediate feedback

Choose a decision, then test how the claim changes as evidence becomes stronger or weaker.

Try it yourself

Write one plain-English sentence explaining the main idea from this lesson.

Common mistakes

Check these before you move on.

A regression coefficient describes a pattern unless the assumptions or research design support a causal interpretation.

Quick quiz

Which statement best answers the Chapter 22 opening question: Why can a beautifully estimated regression still answer the wrong question?

Quick quiz

Which practice should be avoided when applying Omitted Variables, Measurement Error, Simultaneity, and Endogeneity?

Quick quiz

What is the most defensible way to interpret the Python demonstration?

Quick quiz

Why does Chapter 22 matter in an applied econometrics workflow?

Key takeaway

Omitted Variables, Measurement Error, Simultaneity, and Endogeneity is most useful when the economic question, statistical target, assumptions, code, and interpretation point in the same direction. Python makes the workflow reproducible; econometric reasoning determines what the output can mean.