Statalist


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

Re: st: Optimize problem after update


From   [email protected] (Jeff Pitblado, StataCorp LP)
To   [email protected]
Subject   Re: st: Optimize problem after update
Date   Tue, 15 Dec 2009 10:08:18 -0600

Marike Knoef <[email protected]> is getting a conformability error from
-optimize()- when tracing the graient vector:

> I am using Stata 11
> 
> Stata/IC 11.0 for Windows (32-bit)
> Born 21 Oct 2009
> 
> After my last update I have problems with -optimize-. The following example
> does not work anymore:

The example Marike posted is included following my signature.

> I found that the technique "nm" does work, but the techniques "nr", "bhhh"
> and "dfp" are not working anymore. They do work in the old Stata 10 version
> on my old computer (Stata/IC 10.1 for Windows
> Born 02 Feb 2009).
> 
> What could be the problem?

Marike found a bug in the trace logic when it's reporting on the element-wise
changes to the gradient vector.  We have determined the cause and the fix will
be available in the next Stata update.

--Jeff
[email protected]

Marike's original example:

> #delimit;
> mata ;
> x=(0.35 \ 0.29 \ 0.3\ 0.3\ 0.65\ 0.56\ 0.37\ 0.16\ 0.26\ 0.19)
> 
> void lnbetaden04(todo, p, x, lnf, S, H)
> {
> 	a=p[1]
> 	b=p[2]
> 	lnf= lngamma(a+b) :- lngamma(a) :- lngamma(b) :+ (a-1)*log(x) :+
> (b-1)*log(1:-x)
> }
> 
> mata
> S=optimize_init()
> optimize_init_which(S, "max")
> optimize_init_evaluator(S, &lnbetaden04())
> optimize_init_evaluatortype(S, "v0")
> optimize_init_params(S, (1,1))
> optimize_init_argument(S, 1, x)
> optimize_init_conv_ptol(S, 1e-8)
> optimize_init_tracelevel(S, "params")
> optimize_init_tracelevel(S, "step")
> optimize_init_tracelevel(S, "gradient")
> optimize_init_nmsimplexdeltas(S, (1e-3, 1e-3))
> optimize_init_technique(S,"nr")
> p=optimize(S)
> end; 
> 
> After "iteration 0" I get the following message:
> 
> Iteration 1:
> Parameter vector:
>           c1        c2
> r1  4.084429  7.868267
> 
> 
> Changed elements of parameter vector:
> 
>                 select():  3200  conformability error
>     opt__looputil_step():     -  function returned error
>           opt__loop_nr():     -  function returned error
>               optimize():     -  function returned error
>                  <istmt>:     -  function returned error
> r(3200);
> 
*
*   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