  # Re: st: Maximum iterations exceeded with predictnl

 From rgutierrez@stata.com (Roberto G. Gutierrez, StataCorp) To statalist@hsphsun2.harvard.edu Subject Re: st: Maximum iterations exceeded with predictnl Date Tue, 21 Sep 2004 10:05:35 -0500

```Matthew Polisson <matthew.polisson@regents-park.oxford.ac.uk> asks:

> 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
> '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