Lesson 14
The Lagrange Multiplier Test
Big question
How can a restricted model test omitted regressors?
Lesson progress
Complete checkpoints as you learn
Learning objectives
- Explain the lagrange multiplier test in plain language.
- Use asymptotic normality correctly in an interpretation.
- Connect the lesson idea to a formula, graph, Python result, or real example.
Simple explanation
The LM test estimates the restricted model, saves restricted residuals, runs an auxiliary regression, and uses n times R-squared.
Key terms
- asymptotic normality
- Approximate normality of an estimator in large samples.
- histogram
- A graph showing how observations are distributed across bins.
- asymptotic efficiency
- Having the smallest large-sample variance among a class of consistent estimators.
Core formula
Use plain-language interpretation before algebra.
Example
CRIME1 gives students a real-data setting for the lagrange multiplier test. The lesson reports code and diagnostics only after the student runs the live Python lab.
Interactive visual
LMTestBuilder
Original Module 5 visual for The Lagrange Multiplier Test.
y variable
wage
The dependent variable. It is the outcome students want to explain.
x variable
education
The explanatory variable. It is used to describe changes in wage.
Live Python
The Lagrange Multiplier Test Python example
The Lagrange Multiplier Test Python example
Stdout
Run Python to see results here.
Status / stderr
Ready to run Python in your browser.
Line-by-line guide
- Line 1Load a Python library needed for data work or regression.
- Line 2Load a Python library needed for data work or regression.
- Line 3Load a Python library needed for data work or regression.
- Line 5Load the dataset into a pandas DataFrame.
- Line 6Create or update a Python object used in the analysis.
- Line 7Keep rows that have the variables required for this model.
- Line 8Add an intercept column to the regression design matrix.
- Line 9Estimate an ordinary least squares regression.
- Line 10Create or update a Python object used in the analysis.
- Line 11Add an intercept column to the regression design matrix.
- Line 12Estimate an ordinary least squares regression.
- Line 13Create or update a Python object used in the analysis.
- Line 14Create or update a Python object used in the analysis.
- Line 15Create or update a Python object used in the analysis.
- Line 16Display a result so students can inspect the output.
- Line 17Display a result so students can inspect the output.
- Line 18Display a result so students can inspect the output.
Python walkthrough
- 1Load libraries and data or set a simulation seed.
- 2Build the model or simulation that matches the lesson question.
- 3Compute the statistic, graph, or summary table.
- 4Interpret the result as large-sample evidence, not automatic causality.
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
CRIME1
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 CRIME1.
- Run the Python cells connected to The Lagrange Multiplier Test.
- Interpret the output using LM test and auxiliary regression.
Common errors
- File not found: check that CRIME1.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/module-5/CRIME1.csv")
df.head()Interactive activity
LMTestBuilder
Build the LM statistic
Use the restricted residual auxiliary regression and remember the n times R-squared step.
Inputs
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
What is the core LM test workflow?
Quick quiz
Which reporting habit is most important in The Lagrange Multiplier Test?
Quick quiz
Why is BWGHT a reasonable practice dataset here?
Key takeaway
The Lagrange Multiplier Test helps students separate large-sample approximation from valid research design.