Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: a problem on ml command


From   "Jian Zhang" <[email protected]>
To   Maarten buis <[email protected]>, [email protected]
Subject   Re: st: a problem on ml command
Date   Mon, 16 Oct 2006 16:28:09 -0700 (PDT)

Thanks, Maarten!  

Best regards,
Jian


> Jian Zhang:
> Easiest way to do that is to use the -normalden- function like this:
> 
> sysuse auto, clear
> capture program drop try1
> program try1
>         args lnf xb ln_sigma
>         quietly replace `lnf'=ln(normalden($ML_y1, `xb',
> exp(`ln_sigma')))
> end
> 
> ml model lf try1 (price=mpg foreign) ()
> ml maximize
> 
> If Stata has a function for the density you want to use preprogrammed
> than using it will generally result in more readable code and less
> bugs. 
> HTH,
> Maarten
> 
> --- Jian Zhang <[email protected]> wrote:
> 
> > I am using ml command to do maximum likelihood estimation with normal
> > distribution of error terms.   But the the result returned with an 
> > error message. 
> 
> > Here is the code I wrote:
> > 
> >  capture program drop try1
> >  program try1
> >          args lnf theta1 theta2
> >          quietly replace
> > `lnf'=-1/2*ln(`theta2')-1/2*($ML_y1-`theta1')
> >  end
> > 
> > ml model lf try1 (year=i firm) ()
> > ml maximize
> > 
> > But the result shows as follows :
> > initial:       log likelihood =     -<inf>  (could not be evaluated)
> > feasible:      log likelihood = -97165.343
> > rescale:       log likelihood = -60002.996
> > rescale eq:    log likelihood = -60002.996
> > could not calculate numerical derivatives
> > discontinuous region with missing values encountered
> > r(430);
> > 
> > end of do-file
> > r(430);
> > 
> 
> 
> -----------------------------------------
> Maarten L. Buis
> Department of Social Research Methodology
> Vrije Universiteit Amsterdam
> Boelelaan 1081
> 1081 HV Amsterdam
> The Netherlands
> 
> visiting adress:
> Buitenveldertselaan 3 (Metropolitan), room Z434
> 
> +31 20 5986715
> 
> http://home.fsw.vu.nl/m.buis/
> -----------------------------------------
> 
> 
> 		
> ___________________________________________________________ 
> Inbox full of spam? Get leading spam protection and 1GB storage with All
> New Yahoo! Mail. http://uk.docs.yahoo.com/nowyoucan.html
> *
> *   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/
> 
*
*   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