# Re: st: Maximum iterations exceeded with predictnl

 From "Matthew R. Polisson" To statalist@hsphsun2.harvard.edu Subject Re: st: Maximum iterations exceeded with predictnl Date Wed, 22 Sep 2004 15:19:40 -0400

```Dear Roberto,

Thanks very much for your help. The mlogpred command works quite
nicely. Is there a similar command which follows logit? I am assuming
that predictnl works after logit, although I can imagine running into
similar iteration problems.

Thanks very much for all of your help.

Matt

On Tue, 21 Sep 2004 10:05:35 -0500, Roberto G. Gutierrez, StataCorp
<rgutierrez@stata.com> wrote:
>
> > I am conducting a multinomial logit with the following command line:
>
> >> mlogit y x1 x2 etc
>
> > The dependent variable y takes on four values (1, 2, 3, and 4). Following
> > the regression, I calculate predicted probabilites for each of the four
> > outcomes using the command line:
>
> >> predict p1 p2 p3 p4, pr
>
> > I wish to establish confidence intervals, and the way I know to do this is
> > to enter four separate commands as follows:
>
> > predictnl p1 = predict(outcome(1)), ci(p1_l p1_u)
> > predictnl p2 = predict(outcome(2)), ci(p2_l p2_u)
> > predictnl p3 = predict(outcome(3)), ci(p3_l p3_u)
> > predictnl p4 = predict(outcome(4)), ci(p4_l p4_u)
>
> > This works about half of the time, but the other half of the time I receive
> > an error message reading:
> > 'Maximum number of interations exceed.'
>
> > [...]
>
> In cases where you get the error message, -predictnl- is having a hard time
> finding an optimal step size with which to calculate the numerical derivative
> of the prediction wrt the estimated parameters.  This derivative is necessary
> to get delta-method standard errors, confidence intervals, etc.
>
> A nonconvergence of the step-size search can be caused by many things, but one
> of the first things I always check are the scales of the dependent variables
> used in the model.  If one or more are very large or very small, then
> rescaling the variables will usually do the trick.
>
> Matthew can either try this technique or, since he is using -mlogit-, download
> Bill Sribney's -mlogpred- command that gets delta-method standard errors and
> CIs for predictions after -mlogit-.  Since -mlogpred- is hard-wired to
> -mlogit-, it uses analytical derivatives and thus won't suffer from any
> convergence problems.  You can obtain -mlogpred- by typing
>
>   . findit mlogpred
>
>
> --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/
>
*
*   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/
```