Error: "Maximum number of iterations exceeded" using nlcom in Stata

1.8k views Asked by At

I am trying to estimate the standard error of marginal effects using nlcom in Stata (Delta method) for the limited dependent variable model . We normally compute the probability, conditional, and unconditional parts when computing the marginal effect. I was also able to obtain the standard errors for conditional and unconditional part using nlcom in Stata. However, I got the error "maximum number of iterations exceeded" when using nlcom for probability. I did look at the solution here and it did solve for some of the binary variables (3). However, I still get the same error for 4 variables. I dig into the problem and find that the error is associated with part where the dummy variable is 0 :

\begin{equation} \Delta P(y>0)= P(y>0|x=1)-P(y>0|x=0) \end{equation}

Here is the sample code for the race variable (dummy variable) for which the nlcom works for the part where dummy variable is 1 (without correction) but not for with 0 even after taking into account the correction suggested in the website mentioned earlier. Increasing the iterations and multiplying by larger magnitudes also didn't help:

       _nl_1:  binormal(1.733373263151318-(.0438395852394023*[Tier1]_b[race])+(1*[Tier1]_b[race]),7.575546508411257-(.0438395852394023*[Tier2]_b[race])+
> (1*[Tier2]_b[race])/exp([lnsigma]_b[_cons]),tanh([tau]_b[_cons]))

------------------------------------------------------------------------------
             |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
       _nl_1 |   .9223902   .0129743    71.09   0.000     .8969611    .9478193
------------------------------------------------------------------------------

       _nl_1:  binormal(1.733373263151318-(.0438395852394023*[Tier1]_b[race])+(0*[Tier1]_b[race]),7.575546508411257-(.0438395852394023*[Tier2]_b[race])+
> (0*[Tier2]_b[race])/exp([lnsigma]_b[_cons]),tanh([tau]_b[_cons]))*(1e+2)
Maximum number of iterations exceeded.

Any idea to fix this issue?

1

There are 1 answers

4
Steve Samuels On BEST ANSWER

I don't know if this is the source of your problem, but in both the successful and unsuccessful nl statement, the estimated standard deviation, exp([lnsigma]_b[_cons]), divides only the last [Tier*]_b[race] term, and then only in the second argument of binormal(this perhaps because you constrained the SD to be 1 in the first argument). Here's a guess at what you meant in the second nl statement, but it's just a guess.

 #delim ;   
_nl_1:
 binormal
((1.733373263151318-(.0438395852394023*[Tier1]_b[race])+(0*[Tier1]_b[race]))
/exp([lnsigma]_b[_cons]),
 (7.575546508411257-(.0438395852394023*[Tier2]_b[race])+ (0*[Tier2]_b[race]))
/exp([lnsigma]_b[_cons]),
tanh([tau]_b[_cons])) ;
#delim cr