Statalist The Stata Listserver


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

Re: st: timeout option


From   jpitblado@stata.com (Jeff Pitblado, StataCorp LP)
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: timeout option
Date   Wed, 19 Apr 2006 18:08:21 -0500

Sascha O. Becker <sascha.becker@gmx.de> wants to limit how long Stata spends
on a model fit when using -bootstrap-:

> I often need to use a server when running code (involving bootstraps) 
> for several days. Server RAM and time are scarce resources, obviously. 
> When looping (using global varlists) over several specifications, it 
> often turns out that some of the specifications take (unpredictably) a 
> lot more time than the "average specification" and I would (ex post) 
> rather skip those to go on with the code (and back to the "complicated 
> cases" later). To be concrete, some specifications take 1 or 2 minutes 
> to converge, others 5 to 10 hours.
> 
> Is there a way to tell Stata something like: "If this maximum likelihood 
> procedure does not converge in an hour, jump to the next 
> specification.", i.e. is there a way to implement a timeout?

In Stata 9, -bootstrap- has a -reject()- option and all -ml- based commands
save -e(converged)- to indicate when they have converged to a solution.
Combining them with the -iterate()- option can cut down on some of the time
consuming bootstrap replicates.  Here is an example using the auto data:

	. sysuse auto
	. nbreg mpg turn trunk, iter(30) vce(bootstrap, reject(e(converged)!=1) seed(1234))

After running the above, you'll notice that 5 of the 50 replicates were
rejected (represented by a red 'x' in the replication log).

--Jeff
jpitblado@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/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index