I am running a .do-file which includes many models estimated by xtlogit
. Even if a model does not converge I would like to document this in the log. As the .do-file takes some hours to run, I normally go away and do something else. Unfortunately, the non-convergence of a model stops the whole .do-file.
Therefore, I used capture noisily {}
in order to run the whole .do-file. However, this seems to ignore the maximum number of iterations I have specified in each xtlogit
command separately depending on the number of variables and the assumed complexity of the model.
I already found a workaround by using set maxiter
globally before running the models. But this does not allow for a finer specification of iterations per model (unless I use it a lot).
I could not find any reports about this behaviour of capture
. Maybe, there is a better approach to this than my workaround with set maxiter
?
Here is an example code which reproduces the error manually by imposing too few iterations:
webuse union, clear
capture noisily {
xtlogit union age grade i.not_smsa south##c.year, fe iter(2)
xtlogit union age grade i.not_smsa south##c.year, iter(3) pa
xtlogit union age grade i.not_smsa south##c.year, fe iter(2)
}
The .do-file stops after the second model with an error message "convergence not achieved"
r(430);
and does not proceed with the third model as I would suspect because of capture
.