Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Stata's ml stucks


From   Stas Kolenikov <[email protected]>
To   [email protected]
Subject   Re: st: Stata's ml stucks
Date   Wed, 28 Jan 2009 15:51:18 -0600

One problem I see with your function is that it is not differentiable.
Stata's -ml maximize- and -optimize- are really intended for nice
smooth functions that have well separated local maxima, and when they
have something like yours, they get crazy estimates of derivatives
that would either throw the algorithm out all the time, or at least
make it fail to recognize the convergence point if the convergence
conditions involve gradients (-gtolerance- and -nrtolerance- options
of -maximize-). I thought Russian mathematical training was good
enough to teach those issues ;).

Also, -difficult- is next to useless with 1D optimization, as far as I
understand it, since its main job is to break down the parameter space
into (almost flat) ridges and nicely convex (approximately) quadratic
components, so as to not invert an ill conditioned matrix for the
first situation.

I'd say in situation like yours simulated annealing is the thing to go
with if you do minimization. If you do root finding, you would need to
work with a pretty rough algorithm that does not involve derivatives.
I don't know what -ridder- relies on, but if it converges, use the
answers and don't touch anything :))

And yes, at some point I've fooled with $ML_b vector, but I would not
recommend doing that since you don't know exactly how -ml- uses it,
unless you reverse engineered everything it does. Given that you've
reverse engineered some of the graphics and tabulated output, I won't
be surprised if you did :))

On 1/27/09, Sergiy Radyakin <[email protected]> wrote:
> Dear All,
>
> I am solving equation F(x) = A, e.g. F(x) = -0.065
>
> It took me 26 iterations (computations of F) to solve it manually to 8
> digits precision:
>
> I have also checked that I can solve it similarly to a couple of other
> randomly chosen reasonable values, e.g. -0.071.
>
> I am using Stata's -ml- command to maximize -(F(x)+0.065)^2 but it
> gets stuck even after thousands of evaluations of F:
>
> 8947.Requested F(.1054786)=-.0623424094117909
> 8948.Requested F(.1054786)=-.0623424094117909
> 8949.Requested F(.1054786)=-.0623424094117909
> 8950.Requested F(-2.634596)=.2516850686732928
> 8951.Requested F(2.845553)=-.4834788090804468
> numerical derivatives are approximate
> flat or discontinuous region encountered
> Iteration 55:  log likelihood = -.05241295  (backed up)
> 8952.Requested F(-.2668051)=.1354119673051408
>
> I wonder if there is any way to tell Stata to stop requesting F(x)
> over and over again with the same x.
> F is quite computationally intensive, and I would like to have a very
> low number of calls to it.
>
> The graph of F looks like this:
> http://img217.imageshack.us/my.php?image=functionfffpd8.png
> And I need to be able to solve F(x)=A for (A<0)  , which is a "good"
> part of the graph.
>

-- 
Stas Kolenikov, also found at http://stas.kolenikov.name
Small print: I use this email account for mailing lists only.
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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