Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: ignoring "maximum number of iterations" error error in a loop


From   "Andrade, Sandro" <[email protected]>
To   <[email protected]>
Subject   st: ignoring "maximum number of iterations" error error in a loop
Date   Wed, 23 Jul 2008 23:31:09 -0400

Dear all

I am running into problems when a loop stops because of an error
message. I want the loop to continue regardless of the error. 

Let me be more precise:

My dataset has a panel format, in which ticker is the "non-time"
dimension. I have a time-series of "spread" for each of the several
tickers numbered 1 through 150.

I want to estimate a model for "spread" by NLS for all tickers, and to
keep fitted values. The model is defined on the program cg_calibra.

I have the following loop:

forvalue i=1/150 {
       capture nl cg_calibra spread if ticker==`i'
	predict modelimplied`i' 
				}

The problem is that for a few tickers the NLS does not converge before
the maximum number of iterations is reached. I get error r(498) and the
loop stops.

I do not want to increase the number of iterations to avoid being
trapped in a flat surface. How do I tell Stata 10 to continue the loop
for the following ticker in case the maximum number of iterations is
reached for some ticker?

Thanks!!!
Sandro.


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