Pedagogy in Action > Library > Teaching with Simulations > Economics Examples > Stata Monte Carlo Simulation for Heteroskedasticity

Stata Monte Carlo Simulation for Heteroskedasticity

Betty J. Blecha San Francisco State University
Author Profile
This material was originally created for Starting Point: Teaching Economics
and is replicated here as part of the SERC Pedagogic Service.


Beginning econometrics students often struggle with how heteroskedasticity biases an interval estimator. They also have difficulty with why the power of a statistical text is important. This compact Stata simulation written by Christopher F. Baum at Boston College demonstrates the effect of varying degrees of heteroskedasticity on the sample mean. The program is also easily modified to evaluate the power of a test for heteroskedasticity. The simulation includes the case of homoskedasticity for comparison purposes. Varying degrees of heteroskedasticity are user determined.

Learning Goals

The learning goals of the simulation are to give students a clearer understanding of two significant concepts taught in beginning econometrics.
  • How heteroskedasticity generates a biased interval estimator.
  • Why the power of a statistical test is as important as the size of the test.

Context for Use

The simulation can be used as a classroom presentation. A microcomputer and projector are necessary. The simulation is not appropriate for homework unless carefully controlled by the instructor. Most students will understand the explanation of what the simulation does without any knowledge of Stata programming.

Description and Teaching Materials

Christopher Baum has written a description of the simulation including all the necessary Stata code and example output. The document is available on the Faculty Microcomputer Resource Center web site at Boston College: Monte Carlo Simulation in Stata. The simulation is written for Stata version 10 and uses the Stata simulate command.

Instructor preparation: One hour for a knowledgeable Stata user to download and prepare for class presentation
Class preparation: One 50 minute class period
Class simulation: One 50 minute class period

Teaching Notes and Tips

Depending on the econometrics text being used in the course, some attention should be given to the analytical derivation of heteroskedasticity and how an interval estimator of the sample mean is biased in the presence of heteroskedasticity before conducting the simulation. The goal of the simulation is to help students understand the analytical argument. It is reasonable to suggest that the stronger the presentation of the analytical argument, the more useful the simulation will be for students.


All traditional forms of assessment can be used. For more information about assessment, see the SERC assessment module.

References and Resources

Monte Carlo Simulation in Stata Includes the Stata program code for the simulation.