Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • custom maximum likelihood estimators - best way to check for convergence?

    I've made a package to estimate a model by maximum likelihood. I'd like to store a result as e(converged), as many inbuilt commands do, which contains 1 if convergence was achieved, 0 otherwise.

    I know the simple part - let's say I have a local macro converged containing 0 or 1 accordingly, then I would add

    Code:
    ereturn scalar converged = `converged'
    But my question is, what is the best way to set the contents of the local macro converged ? I'd like to follow the method used in inbuilt commands if possible.

  • #2
    ml automatically sets e(converged). See the user's manual entry for maximize.

    If you've written something completely from scratch and haven't used Stata's maximum likelihood commands, then you'd set the ereturn scalar to zero at the top (prior to entering the likelihood-maximization iteration loop) and set it to one when your criterion for convergence has been met and you break out of your loop.

    Comment

    Working...
    X