Detection Tests for Heteroscedasticity

ECON 3209 · Week 12, Lecture 2 · Kerala Agricultural University

Department of Development Economics, KAU

Autumn 2026

Learning Outcomes

By the end of this lecture, you will be able to:

  1. use residual plots as a first visual test for heteroscedasticity
  2. state the Breusch-Pagan auxiliary regression
  3. distinguish the Breusch-Pagan and White tests
  4. run both tests in Python using statsmodels
  5. interpret test statistics and p-values correctly

Residual Plots Come First

A good workflow is: 1. Estimate the model. 2. Plot residuals against fitted values or key regressors. 3. If the spread changes systematically, run a formal test.

Visual evidence helps you understand the type of heteroscedasticity before you rely on a test statistic.

Breusch-Pagan Test

The BP test asks whether squared residuals are systematically related to explanatory variables.

\[\hat{\varepsilon}^2_i = \alpha_0 + \alpha_1 Z_{1i} + \ldots + \alpha_p Z_{pi} + v_i\]

  • Null hypothesis: homoskedasticity
  • Alternative: error variance depends linearly on regressors or fitted values

White Test

The White test is more flexible.

It allows variance to depend on: - regressors - squares of regressors - cross-products

This broader design can detect more general forms of heteroscedasticity, though at the cost of using more degrees of freedom.

Detection Workflow

Use BP when

  • you have a simple variance story
  • sample size is moderate
  • you want a targeted diagnostic

Use White when

  • you want a more general test
  • the variance pattern may be nonlinear
  • you can afford more auxiliary regressors

Python Demo: Fit a Baseline Model

Python Demo: Residual Plot

Python Demo: Breusch-Pagan Test

Python Demo: White Test

How to Interpret the Output

  • A small p-value suggests rejecting homoskedasticity.
  • A large p-value means the data do not provide strong evidence against constant variance.
  • Failing to reject is not proof of perfect homoskedasticity.

Tests are evidence summaries, not mechanical truth machines. Always read them together with plots.

What Next After Detection?

Once heteroscedasticity is detected, typical next steps are: - report robust standard errors - consider WLS if a reasonable variance model exists - revisit functional form or scale transformations such as logs

🏋️ Exercise

  1. Estimate an OLS model using profit, land, and irrigation data.
  2. Plot residuals against fitted values.
  3. Run the Breusch-Pagan test and the White test.
  4. State whether the evidence suggests heteroscedasticity.

Summary

✅ Residual plots are the first practical check for heteroscedasticity.

✅ The Breusch-Pagan test regresses squared residuals on explanatory variables.

✅ The White test is more flexible because it allows squares and cross-products.

✅ Small p-values indicate evidence against homoskedasticity.

✅ The natural next step is robust inference or a weighted specification.

Next Lecture

Lecture 3 — WLS & Robust SE in Python

We will cover: - HC3 robust standard errors - Weighted Least Squares - comparison of OLS, robust OLS, and WLS - when each remedy is appropriate