Basic Monte Carlo Simulation for Beginning Econometrics

This page authored by Betty J. Blecha at 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.

Initial Publication Date: May 24, 2010


Summary: Beginning econometrics students often have an uneven preparation in statistics. Simulation can help with both an understanding of the analytically derived means and variances of regression estimators and the intuition of a sampling distribution. The instructional problem, however, is that many simulations are either black boxes to students or written in a programming language that is not easily understood by beginning students. The Stata simulate command opens up the use of very basic programs using Stata commands students use at the Stata command line.

Used this activity? Share your experiences and modifications

Learning Goals

The learning goal of the simulation is to give students a clearer understanding of the behavior of OLS estimators.

Context for Use

The simulation can be used in a classroom by an instructor. A microcomputer and projector are necessary. Students should have previously used Stata for estimating simple regressions and calculated some scalar r() values before seeing the simulation.

Description and Teaching Materials

The simulation uses the following files: ( 257bytes Mar19 10)
sample_size_9.dta ( 351bytes Mar19 10)
sample_size_16.dta ( 379bytes Mar19 10)
sample_size_25.dta ( 415bytes Mar19 10)
sample_size_100.dta ( 715bytes Mar19 10)
The instructor loads the data file. The program is loaded using the do command. The program lists in the Stata results window, and the instructor can discuss what each line is doing and why. It is helpful to run the program and discuss the results for one sample. The simulate command is then used to generate 10000 samples and create a data file of the slopes and variances of the estimators. Students use the summarize command and histograms to evaluate the results. The simulate command is

simulate r(seb1) r(b1) r(seb2) r(b2), seed(10101) reps(10000) nodots: reg_simple.

Instructor preparation: 30 minutes if the instructor is using Stata
Both class preparation and class simulation will take one 50 minute class period.

Teaching Notes and Tips

The simple regression program can be expanded over the semester to simulate many econometric issues.


If students have access to a microcomputer lab with Stata, the various data sets of different sizes provide a good source for a homework problem to test if the behavior of the estimators in different sizes has been understood.

In addition, all traditional assessment tools can be used. For more information about assessment, see the SERC assessment module.

References and Resources

The simulation should be clearly tied to the econometrics text students are using in the course.