Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: ml check shows errors but ml maximize works

From   [email protected] (Jeff Pitblado, StataCorp LP)
To   [email protected]
Subject   Re: st: ml check shows errors but ml maximize works
Date   Thu, 26 May 2005 15:24:50 -0500

Alita Nandi <[email protected]> was getting an error message
from -ml check- when -ml max- would otherwise produce estimation results.

Alita privately sent me her likelihood evaluator and a couple of log files.
After looking at the log files and playing with the likelihood evaluator we
have determined that all is well with -ml max- and -ml check-. 

-ml check- tests various things about your likelihood evaluator.  One of which
is that a different likelihood value results when the coefficient vector is
changed.  This is where -ml check- exited with an error for Alita.

Alita's evaluator looks like it calculates the likelihood for something like a
Heckman model (see [R] heckman).  This model has 4 equations, the last two
equations estimate "sigma" and "rho".  As programmed, Alita's likelihood
evaluator requires non-negative values for the "sigma" equation and the "rho"
equation requires values between -1 and 1; otherwise, it results in missing
values for the log likelihood.

By default, -ml- initially supplies your likelihood evaluator with a vector of
zeroes.  If the resulting log likelihood value is not missing, -ml- starts
optimizing; otherwise, -ml- replaces the starting values with random numbers
until it gets a nonmissing value for the log likelihood or runs out of attempts
(which is about 1000 attempts).  This usually doesn't cause a problem, except
when one of the equations has a severely restricted range of feasible values
such as the "rho" equation.

We mention restricted ranges in a 'Technical Note' of the book on -ml-, page
56.  Here is a partial quote, where we are talking about an -ml- version of
the linear regression model:

	The way we have parameterized this model, the log likelihood is
	defined only for sigma>0.  -ml- is designed to deal with restricted
	ranges--there is nothing special you need do--but you should be
	impressed and realize that you are asking a lot of -ml-.  There could
	be convergence problems, and even if there are not, -ml- is going to
	perform more work, so the maximization process may not occur as
	quickly as it otherwise could.

	It would be better if the model were parameterized so that
	[the entire real line] is a valid range for each element of [the
	coefficient vector]

We should add the caveat lector at the end of the above quoted first paragraph:

	quickly as it otherwise could.  Note that -ml- may not be able to
	find feasible initial values for restricted ranges such as (-1,1) or

	It would be better ...


Gould, W., J. Pitblado, and W. Sribney. 2003. Maximum Likelihood Estimation
	with Stata, 2nd edition.  College Station, TX: Stata Press.

Al Feiveson <[email protected]> pointed out that using the ML_ic global
macro in the likelihood evaluator could cause -ml check- to have similar
problems as described above by Alita.

> I encountered this when I referred to the iteration counter $ML_ic in my
> .ado program. Apparently this global doesn't exist at -ml check- time.
> However when I run the program without the -ml check- command it worked. I
> don't know if this is the sort of thing that Alita had in her program.

Al is correct, the ML_ic global macro is created by -ml-'s optimization
routine that loops until convergence; however, -ml check- does not use -ml-'s
optimization routine to call the likelihood evaluator.

[email protected]
*   For searches and help try:

© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index