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

Re: st: Re: maximum likelihood estimation


From   "Jeff S. Pitblado" <[email protected]>
To   [email protected]
Subject   Re: st: Re: maximum likelihood estimation
Date   Tue, 3 Feb 2004 07:35:32 -0600

Christopher F Baum points out that $ML_y is an undocumented global defined by
the -ml- command:

> On Feb 3, 2004, at 2:33 AM, David wrote:
> 
> >    replace `lnf' = -`Xb' -ln(1+exp(-`Xb')) if $ML_y==0
> 
> Jeff said this was acceptable syntax. But what is $ML_y ? Is that 
> automatically taken to be the same as $ML_y1? I thought that all $ML 
> globals had to be $ML_y1, $ML_y2, etc. What is the parser doing at this 
> point for those who ran this successfully?

That is true.  The reason why it still works is that David has a single
dependent variable, and (internally) -ml- defines the global ML_y to contain
the list of all the dependent variables.  Thus in this example $ML_y and
$ML_y1 contain the same variable name.

Thus, as indicated above, the code should read:

	program define mylogit
		version 8.2
		args lnf Xb
		replace `lnf' = -ln(1+exp(-`Xb')) if $ML_y1==1
		replace `lnf' = -`Xb' -ln(1+exp(-`Xb')) if $ML_y1==0
	end


--Jeff Pitblado
  [email protected]
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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