Training Course

Implementing an Estimation Command in Stata/Mata


David Drukker

Date & Time

4 December 2017


Training Course


The Institute for Fiscal Studies
7 Ridgmount Street,


HE Delegates: £40
Charity or Government: £40
Other Delegates: £40

David Drukker the Executive Director of Econometrics at Stata will deliver a course on Implementing an estimation command in Stata/Mata.

Writing a Stata command for methods that you use or develop disseminates your research to a huge audience. This short course shows how to write a Stata estimation command. No Stata or Mata programming experience is required, but it does help. After providing an introduction to basic Stata do-file programming, the course covers basic and advanced ado-file programming. Next, it provides an introduction to Mata, the byte-compiled matrix language that is part of Stata. Then the course shows how to implement linear and nonlinear statistical methods in Stata/Mata programs. Finally, the course discusses using Monte Carlo simulations to test the implementation.


o How does Stata work?
o Estimation-postestimation framework
o Estimation followed by test, predict, and margins

o A quick introduction to Stata do-file programming

o An introduction to Stata ado-file programming and to syntax

o A Stata program that implements the ordinary least-squares (OLS) estimator

o Writing a certification script

o An introduction to basic Mata programming

o Making our OLS program use Mata

o More Mata programming examples

o Mata programming for nonlinear statistical estimation

o A Stata/Mata program for Poisson regression

o Making predict and margins work with our command

o Monte Carlo simulations in Stata


10:00 – 10:30: Registration and refreshments

10:30 – 11:30: The syntax of Stata estimation commands and basic Stata programming

11:30 – 12:30: Programming an estimation command in Stata (Basics)

12:30 – 13:15: Lunch

13:15 – 14:30: An introduction to the Mata matrix language 14:30 – 15:15: An introduction to Mata/Stata programming

15:15 – 15:30: Coffee Break

15:30 – 16:30: Using optimize() to implement nonlinear statistical estimators in Stata/Mata programs

16:30 – 17:15: Testing a command by Monte Carlo simulation

17:15: Close