Announcement

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

  • Limit iterations for ALL stages of biprobit

    Hello,

    I am running a bivariate probit model (-biprobit-), and if one of the models is not converging, I would like the program to move on to the next one. I had thought I could do this by specifying the option -iterate(#)-, but this seems to only apply the limit to the final step ("Fitting full model"), not the prior ones ("Fitting comparison equation [1/2]").

    For example, you can do:

    sysuse auto
    gen temp = (mpg>15)
    biprobit (foreign temp) (temp length), iterate(3)

    You will see that while the full model only does 3 iterations, comparison equation 2 does 5 iterations.

    Does anyone how to set a limit on the iterations of the estimation of the comparison equations, as well? Thanks!

    Josh

  • #2
    Here is one way. There might be others. If you change maxiter you may want to change it back.

    Code:
    sysuse auto, clear
    gen temp = (mpg>15)
    set maxiter 3
    biprobit (foreign temp) (temp length)
    The default of 16,000 iterations has always seemed bizarre to me. Are there really models that converge on iteration 15,977? At least with the things I tend to run, anything that goes past a few hundred iterations is probably never going to come to a solution.
    -------------------------------------------
    Richard Williams, Notre Dame Dept of Sociology
    StataNow Version: 19.5 MP (2 processor)

    EMAIL: [email protected]
    WWW: https://www3.nd.edu/~rwilliam

    Comment


    • #3
      The default of 16,000 iterations has always seemed bizarre to me. Are there really models that converge on iteration 15,977? At least with the things I tend to run, anything that goes past a few hundred iterations is probably never going to come to a solution.
      I quite agree! I suppose if you are running a model with several hundred parameters to estimate, you might need thousands of iterations to get to convergence, and maybe in some disciplines that sort of thing happens. But with the kinds of models I run, my experience is like yours, Richard.

      Comment


      • #4
        Ah just what I was looking for - thank you!

        Comment


        • #5
          Hello everyone,
          I am experiencing a similar problem; re; iterations running continuously.

          Am running a Cox regression model with 22 explanatory variables plus 7 interaction terms. I might have made a mistake (yesterday) by setting stata to maximum iterations (permanently - which am now regretting).

          The model has been running for >3 hours now and has done >5000 iterations.

          I would rather use the default number of iterations (or default minimum iterations - if anything like that).

          Is there a way to revert back to default use?

          Please help

          Help much appreciated.
          Last edited by Hemson Hendrix; 15 May 2018, 06:58.

          Comment


          • #6
            set maxiter 16000, permanently
            -------------------------------------------
            Richard Williams, Notre Dame Dept of Sociology
            StataNow Version: 19.5 MP (2 processor)

            EMAIL: [email protected]
            WWW: https://www3.nd.edu/~rwilliam

            Comment


            • #7
              Originally posted by Richard Williams View Post

              The default of 16,000 iterations has always seemed bizarre to me... At least with the things I tend to run, anything that goes past a few hundred iterations is probably never going to come to a solution.
              Originally posted by Clyde Schechter View Post
              I quite agree! ... But with the kinds of models I run, my experience is like yours, Richard.
              I'm late to this particular party, but I will second this. When running latent class models, which often have convergence difficulties, the models have tended to either converge within 100 iterations, or clearly be on the path to trouble within that timeframe (usually an infinite and not improving iteration log, which indicates the maximizer is in a non-concave part of the parameter space). I am currently exploring item response theory models, and at least in my data, I've observed similar tendencies so far.
              Be aware that it can be very hard to answer a question without sample data. You can use the dataex command for this. Type help dataex at the command line.

              When presenting code or results, please use the code delimiters format them. Use the # button on the formatting toolbar, between the " (double quote) and <> buttons.

              Comment


              • #8
                Thanks Richard and Weiwen for the responses. And, apologies if I did not use the proper codes.. I was kind in a 'rush'.

                Richard, the code you've given above
                set maxiter 16000, permanently
                is what I used and what I am asking is if there's a way to counteract that and revert back to 'normal' or simple & minimum default iterations permanently. If not, then, it is possible to limit number of iterations every time am running a model.

                FYI, my model run up to the maximum 16000 iterations and took over 9 hours to complete.

                Comment


                • #9
                  Originally posted by Hemson Hendrix View Post
                  Thanks Richard and Weiwen for the responses. And, apologies if I did not use the proper codes.. I was kind in a 'rush'.

                  Richard, the code you've given above is what I used and what I am asking is if there's a way to counteract that and revert back to 'normal' or simple & minimum default iterations permanently. If not, then, it is possible to limit number of iterations every time am running a model.

                  FYI, my model run up to the maximum 16000 iterations and took over 9 hours to complete.
                  Hemson,

                  16k iterations is actually Stata's default. You can set any number of iterations you desire, be that 100, 160k, or anything in between. For example,

                  Code:
                  set max iter 1, permanently
                  will set the maximum number of iterations to 1, permanently - don't do this, this is just for illustration!!!!

                  If your model literally ran to exactly 16,000 iterations without the log-likelihood changing, then chances are it is unidentified. Type

                  Code:
                  di e(converged)
                  after the model. If Stata returns a 0, then your model did not converge - that is, the likelihood maximizer did not think that it was at a maximum, and Stata only terminated because you hit the maximum number of iterations. As Richard, Clyde, and I noted, models that actually require over 10,000 iterations to converge should be exceedingly rare. You probably need to diagnose the model and find out which parameters were causing convergence trouble. Sometimes, errors in your data management can cause a model to not converge (happened to me before). There may be other explanations - e.g. you may have to constrain some parameters.
                  Be aware that it can be very hard to answer a question without sample data. You can use the dataex command for this. Type help dataex at the command line.

                  When presenting code or results, please use the code delimiters format them. Use the # button on the formatting toolbar, between the " (double quote) and <> buttons.

                  Comment

                  Working...
                  X