Maximum Likelihood Estimation with Stata, Fourth Edition
Authors: 
William Gould, Jeffrey Pitblado, and Brian Poi 
Publisher: 
Stata Press 
Copyright: 
2010 
ISBN13: 
9781597180788 
Pages: 
352; paperback 
Price: 
$54.00 



Comment from the Stata technical group
Maximum Likelihood Estimation with Stata, Fourth Edition is the essential
reference and guide for researchers in all disciplines who wish to write
maximum likelihood (ML) estimators in Stata. Beyond providing comprehensive
coverage of Stata’s ml command for writing ML estimators, the
book presents an overview of the underpinnings of maximum likelihood and how
to think about ML estimation.
The book shows you how to take full advantage of the ml command’s
noteworthy features:
 linear constraints
 four optimization algorithms (Newton–Raphson, DFP, BFGS, and BHHH)
 observed information matrix (OIM) variance estimator
 outer product of gradients (OPG) variance estimator
 Huber/White/sandwich robust variance estimator
 cluster–robust variance estimator
 complete and automatic support for survey data analysis
 direct support of evaluator functions written in Mata
When appropriate options are used, many of these features are provided
automatically by ml and require no special programming or
intervention by the researcher writing the estimator.
The fourth edition has been updated to include new features introduced in
recent versions of Stata. Such features include new methods for handling scores, more
consistent arguments for likelihoodevaluator programs,
and support for likelihood evaluators written in
Mata (Stata’s matrix programming language). The authors illustrate how to
write your estimation command so that it fully supports factorvariable
notation and the svy prefix for estimation with survey data. They
have also restructured the chapters that introduce ml in a way that
allows you to begin working with ml faster. This edition is essential for anyone using Stata 11.
In the final chapter, the authors illustrate the major steps required to get
from loglikelihood function to fully operational estimation command. This
is done using several different models: logit and probit, linear regression,
Weibull regression, the Cox proportional hazards model, randomeffects
regression, and seemingly unrelated regression.
The authors provide extensive advice for developing your own estimation
commands. With a little care and the help of this book, users will be able
to write their own estimation commands—commands that look and behave
just like the official estimation commands in Stata.
Whether you want to fit a special ML estimator for your own research or wish
to write a generalpurpose ML estimator for others to use, you need this
book.
Table of contents
List of tables
List of figures
Versions of Stata
Notation and typography
1 Theory and practice
1.1 The likelihoodmaximization problem
1.2 Likelihood theory
1.2.1 All results are asymptotic
1.2.2 Likelihoodratio tests and Wald tests
1.2.3 The outer product of gradients variance estimator
1.2.4 Robust variance estimates
1.3 The maximization problem
1.3.1 Numerical root finding
Newton’s method
The Newton–Raphson algorithm
1.3.2 QuasiNewton methods
The BHHH algorithm
The DFP and BFGS algorithms
1.3.3 Numerical maximization
1.3.4 Numerical derivatives
1.3.5 Numerical second derivatives
1.4 Monitoring convergence
2 Introduction to ml
2.1 The probit model
2.2 Normal linear regression
2.3 Robust standard errors
2.4 Weighted estimation
2.5 Other features of methodgf0 evaluators
2.6 Limitations
3 Overview of ml
3.1 The terminology of ml
3.2 Equations in ml
3.3 Likelihoodevaluator methods
3.4 Tools for the ml programmer
3.5 Common ml options
3.5.1 Subsamples
3.5.2 Weights
3.5.3 OPG estimates of variance
3.5.4 Robust estimates of variance
3.5.5 Survey data
3.5.6 Constraints
3.5.7 Choosing among the optimization algorithms
3.6 Maximizing your own likelihood functions
4 Method lf
4.1 The linearform restrictions
4.2 Examples
4.2.1 The probit model
4.2.2 Normal linear regression
4.2.3 The Weibull model
4.3 The importance of generating temporary variables as doubles
4.4 Problems you can safely ignore
4.5 Nonlinear specifications
4.6 The advantages of lf in terms of execution speed
5 Methods lf0, lf1, and lf2
5.1 Comparing these methods
5.2 Outline of evaluators of methods lf0, lf1, and lf2
5.2.1 The todo argument
5.2.2 The b argument
Using mleval to obtain values from each equation
5.2.3 The lnfj argument
5.2.4 Arguments for scores
5.2.5 The H argument
Using mlmatsum to define H
5.2.6 Aside: Stata’s scalars
5.3 Summary of methods lf0, lf1, and lf2
5.3.1 Method lf0
5.3.2 Method lf1
5.3.3 Method lf2
5.4 Examples
5.4.1 The probit model
5.4.2 Normal linear regression
5.4.3 The Weibull model
6 Methods d0, d1, and d2
6.1 Comparing these methods
6.2 Outline of method d0, d1, and d2 evaluators
6.2.1 The todo argument
6.2.2 The b argument
6.2.3 The lnf argument
Using lnf to indicate that the likelihood cannot be calculated
Using mlsum to define lnf
6.2.4 The g argument
Using mlvecsum to define g
6.2.5 The H argument
6.3 Summary of methods d0, d1, and d2
6.3.1 Method d0
6.3.2 Method d1
6.3.3 Method d2
6.4 Paneldata likelihoods
6.4.1 Calculating lnf
6.4.2 Calculating g
6.4.3 Calculating H
Using mlmatbysum to help define H
6.5 Other models that do not meet the linearform restrictions
7 Debugging likelihood evaluators
7.1 ml check
7.2 Using the debug methods
7.2.1 First derivatives
7.2.2 Second derivatives
7.3 ml trace
8 Setting initial values
8.1 ml search
8.2 ml plot
8.3 ml init
9 Interactive maximization
9.1 The iteration log
9.2 Pressing the Break key
9.3 Maximizing difficult likelihood functions
10 Final results
10.1 Graphing convergence
10.2 Redisplaying output
11 Matabased likelihood evaluators
11.1 Introductory examples
11.1.1 The probit model
11.1.2 The Weibull model
11.2 Evaluator function prototypes
Methodlf evaluators
lffamily evaluators
dfamily evaluators
11.3 Utilities
Dependent variables
Obtaining model parameters
Summing individual or grouplevel log likelihoods
Calculating the gradient vector
Calculating the Hessian
11.4 Randomeffects linear regression
11.4.1 Calculating lnf
11.4.2 Calculating g
11.4.3 Calculating H
11.4.4 Results at last
12 Writing dofiles to maximize likelihoods
12.1 The structure of a dofile
12.2 Putting the dofile into production
13 Writing adofiles to maximize likelihoods
13.1 Writing estimation commands
13.2 The standard estimationcommand outline
13.3 Outline for estimation commands using ml
13.4 Using ml in noninteractive mode
13.5 Advice
13.5.1 Syntax
13.5.2 Estimation subsample
13.5.3 Parsing with help from mlopts
13.5.4 Weights
13.5.5 Constantonly model
13.5.6 Initial values
13.5.7 Saving results in e()
13.5.8 Displaying ancillary parameters
13.5.9 Exponentiated coefficients
13.5.10 Offsetting linear equations
13.5.11 Program properties
14 Writing adofiles for survey data analysis
14.1 Program properties
14.2 Writing your own predict command
15 Other examples
15.1 The logit model
15.2 The probit model
15.3 Normal linear regression
15.4 The Weibull model
15.5 The Cox proportional hazards model
15.6 The randomeffects regression model
15.7 The seemingly unrelated regression model
A Syntax of ml
B Likelihoodevaluator checklists
B.1 Method lf
B.2 Method d0
B.3 Method d1
B.4 Method d2
B.5 Method lf0
B.6 Method lf1
B.7 Method lf2
C Listing of estimation commands
C.1 The logit model
C.2 The probit model
C.3 The normal model
C.4 The Weibull model
C.5 The Cox proportional hazards model
C.6 The randomeffects regression model
C.7 The seemingly unrelated regression model
References