[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: timeout option
Sascha O. Becker <email@example.com> 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).
* For searches and help try: