Statalist The Stata Listserver


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

RE: st: RE: Problems in maximising a likelihood function


From   Deepankar Basu <basu.15@osu.edu>
To   statalist@hsphsun2.harvard.edu
Subject   RE: st: RE: Problems in maximising a likelihood function
Date   Fri, 16 Jun 2006 01:07:56 -0400

Nick,

There is a world of difference between scalars and temporary variables
(generated as -double-) at least in the context of -ml- estimation. As I
discovered the hard way, after several days of labour.

When I had first written the program there were several mistakes. I
corrected them over many iterations, with help and advice from
statlisters. But, I also changed my temporary variables to scalars, and
that was a disaster. 

Because, when I had corrected everything else in the program, I was 
still not getting convergence because of scalars. I had tried everything
and was almost on the verge of giving up; then it struck me as a passing
thought that maybe I should just try using temporary variables once
again. I did so and presto! There was convergence!

Moral of the story: never use scalars in -ml- estimation; use temporary
variables (if you need them) and generate them as -double-. And only as
-double-.

Deepankar

On Thu, 2006-06-15 at 21:48 +0100, Nick Cox wrote:
> Quite so. I spoke too soon on that detail. 
> 
> Nick 
> n.j.cox@durham.ac.uk 
> 
> Deepankar Basu
>  
> > But I cannot clean up the expression for the log likelihood 
> > any further.
> > As I had said earlier, the log likelihood for each 
> > observation is of the
> > following form: ln(a+b); where 'a' and 'b' are huge expressions
> > involving exponentials, etc. I don't see how I can simplify it any
> > further; 
> 
> *
> *   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index