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

From |
Jeph Herrin <junk@spandrel.net> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: capture number of -xtmixed- iterations? |

Date |
Wed, 26 Dec 2007 15:11:08 -0500 |

Thanks. I figured this out eventually - actually, I copied and modified -xtmixed.ado- to return e(ic), and then captured that. thanks, Jeph Yulia Marchenko, StataCorp wrote:

Jeph Herrin <junk@spandrel.net> wants to keep track of how many times -xtmixed- failed to converge in the simulations:I'm running a simulation using -simulate- to call a wrapper program for -xtmixed-. Sometimes -xtmixed- doesn't converge, so I call -xtmixed- with

the option -iterate(1000)-, which forces it to stop after 1000 iterations.

What I would like to do is keep track of how often -xtmixed- is not

converging before 1000 iterations. However, there seems to be no way that I

can find to capture the number of iterations, other than parse the output of

-xtmixed- itself. Is there anywhere that the number of iterations is stored

for use post-estimation?

The number of iterations is not saved after -xtmixed- (or other -ml- commands). However, Jeph can use -e(converged)-, saved after -xtmixed- and other -ml- commands, to count how many times the model failed to converge during simulations. To do this, return the values of -e(converged)- as a returned result from the wrapper command. See an example below. /******************************************************/ cap program drop mywrapper program mywrapper, rclass version 10 clear set obs 10 gen double id = _n gen double y = 2*invnormal(uniform()) expand 5 replace y = 5 + y + invnormal(uniform()) xtmixed y || id: , iter(3) return scalar Nconverged = e(converged) end simulate (r:conv = r(Nconverged)) _b, reps(3): mywrapper qui summ r_conv di as txt "# converged: " as res r(N) /******************************************************/ --Yulia ymarchenko@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/

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

**References**:**Re: st: capture number of -xtmixed- iterations?***From:*ymarchenko@stata.com (Yulia Marchenko, StataCorp)

- Prev by Date:
**Re: st: capture number of -xtmixed- iterations?** - Next by Date:
**st: sample size for multiple group study** - Previous by thread:
**Re: st: capture number of -xtmixed- iterations?** - Next by thread:
**Re: st: capture number of -xtmixed- iterations?** - Index(es):

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