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

From |
jpitblado@stata.com (Jeff Pitblado, StataCorp LP) |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: mata optimize |

Date |
Mon, 05 Oct 2009 17:25:05 -0500 |

Stas Kolenikov <skolenik@gmail.com> is using -_optimize_evaluate()- after calling -optimize_init_params()- with a different set of parameter values than the original starting values: > I try to implement some sort of random search over the parameter space > to supply good starting values in my Mata -optimize- problem, and I > was hoping to use -optimize_evaluate()- for that purpose. My > understanding, from the manual, was that it takes the initial values > (supplied by -optimize_init_params()-), computes the function and > posts the results into (the Mata structure visible as) > -optimize_result*()-. As it does not perform any optimization, the > init_params and result_params should be the same. However, they are > not: > > : optimize_init_params(Sth, uniform(1,2) ) > > : optimize_init_params(Sth ) > 1 2 > +-----------------------------+ > 1 | .0087578271 .3072360181 | > +-----------------------------+ > > : _optimize_evaluate(Sth) > b12 = .0581941, b13 = .690081, theta1 = -.0485678, log-likelihood = > -7.07196 > 0 > > : optimize_result_params( Sth ) > 1 2 > +-----------------------------+ > 1 | .0581940888 .6900808689 | > +-----------------------------+ > > : optimize_init_params(Sth, uniform(1,2) ) > > : optimize_init_params(Sth ) > 1 2 > +-----------------------------+ > 1 | .4972361468 .8971257419 | > +-----------------------------+ > > : _optimize_evaluate(Sth) > b12 = .0581941, b13 = .690081, theta1 = -.0485678, log-likelihood = > -7.07196 > 0 > > : optimize_result_params( Sth ) > 1 2 > +-----------------------------+ > 1 | .0581940888 .6900808689 | > +-----------------------------+ > > The vector (0.058, 0.690) is what was there before (after a painful > non-convergent minimization attempt with lots of problematic numeric > derivatives), and it looks like -optimize_evaluate()- just ignored the > starting values I gave. > > Am I missing something, or is it a bug? Stata 11 is fully up to date. This is unintentional behavior (Stata 11 only), and should be fixed in the next ado-file update. You are unlikely to encounter this unless you are doing something sophisticated with -optimize()-, namely using -optimize_evaluate()- to search for alternative starting values like Stas intends. In the mean time, Stas can use the following NOT-documented function (void) optimize_reset_params(S, params) This function resets the parameters used in the call to the evaluator, where-as -optimze_init_params()- was only changing the "initial" parameter values. The "initial" parameter values are stored separately so that -optimize_init_params()- returns the original "initial" parameter values, and -optimize_result_params()- returns the current value of the parameters after attempting to optimize the objective function. > Oh, and one more thing: when I try -optimize_evaluate()- without any > previous optimization attempts, it breaks down as follows: > > opt__eval(): 3010 attempt to dereference NULL pointer > _optimize_evaluate(): - function returned error This too is unintended (Stata 11 only), and will be fixed in a future ado-file update. --Jeff jpitblado@stata.com * * 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/

**Follow-Ups**:**Re: st: mata optimize***From:*Stas Kolenikov <skolenik@gmail.com>

- Prev by Date:
**st: Job Opening at Harvard's Joint Center for Housing Studies** - Next by Date:
**Re: st: mata optimize** - Previous by thread:
**Re: st: mata optimize** - Next by thread:
**Re: st: mata optimize** - Index(es):

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