  # Re: st: nlcom: number of maximum iteration

 From rgutierrez@stata.com (Roberto G. Gutierrez, StataCorp) To statalist@hsphsun2.harvard.edu Subject Re: st: nlcom: number of maximum iteration Date Wed, 26 Nov 2003 14:54:23 -0600

```Jitian Sheu <jtsheu@bu.edu> asks:

> I am doing a nonlinear test after MLE., using testnl; and estimate the CI
> for a nonlinear combination of parameter obtained from a MLE.  The problem
> is that one of my trial of using -testnl- and -nlcom- can not return restuls
> for sure.  The error message is saying that "maximum number of iteration
> exceeds".  I check the manual, it says that the maximum iteration number of
> using nlcom and testnl is set to be 100.  And in the manual it says that we
> should rarely to change this.  However, I have set the maximum number of
> iteration to be 100 (the maxi one) It still does not work(the same error
> message)

-testnl- and -nlcom- work by calculating the derivative of your nonlinear
combination with respect to each coefficient in your estimation table, and
then using these derivatives to apply the delta method to calculate the
standard error of the transformation.

Calculating numerical derivatives is an art in and of itself.  Use a stepsize
that is too large, and your derivative is not very accurate.  Use a stepsize
that is too small, and you run into numerical difficulty since you would be
dividing by a number that is virtually zero.  Both -testnl- and -nlcom-
attempt to find the "optimal" stepsize via an iterative procedure.

For most problems, the iterative procedure works fine and an optimal stepsize
is obtained after only a few iterations.  Sometimes, however, convergence is
not achieved.  There are many possible reasons this can happen, but the most
common is when the derivative is near zero, but not exactly equal to zero.

The default maximum iterations is 100, and as the manual states, you should
rarely have to change this.  In this case, however, increasing this limit may
lead to convergence.  Jitian can try increasing this by specifying
-iterate(500)- or some other large number.  If convergence is still not
achieved, then Jitian can email me privately and I'd be happy to take a closer
look.

--Bobby
rgutierrez@stata.com
*
*   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/
```