Announcement

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

  • logit not converging (rare event?)

    I have a 0/1 dependent variable: firm adopting technology (1 = adoption, 0 otherwise). I have around 8400 observations with only 70 1's. I tried logit model for adoption and it never converged. Then I tried ReLogit but my stata would always say: cannot find ReLogit. Then I tried firthlogit ad it again would not converge. Lastly, I tried mlogit by using initial values from the linear probability model and it threw the following error after around 2200 iterations.


    nvsym(): 3900 unable to allocate real <tmp>[584,584]
    opt__adjH(): - function returned error
    opt__singularH_m_marquardt(): - function returned error
    opt__looputil_step(): - function returned error
    opt__loop_nr(): - function returned error
    _moptimize(): - function returned error
    Mopt_maxmin(): - function returned error
    <istmt>: - function returned error

    Can someone help here?

    Best,
    Guneet

  • #2
    relogit can be found at https://gking.harvard.edu/relogit. When commands support it, sometimes the -difficult- option helps. If you have several independent variables in your model, try to simplify it and add variables back gradually. You may be able to identify a variable that is causing you grief. I would think that the mlogit strategy you describe would be the worst way to go about this.

    Other than that, we would probably need to know more about your data and commands to advise you further.
    -------------------------------------------
    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
      I'll second Richard's request for your command exactly as typed. The 3900 unable to allocate real error may relate to you accidentally treating a continuous variable as a factor variable - Stata will then create one dummy for every unique value, which exceeds the maximum matrix size Stata is allowed to create. If this happened, that error cascaded into a bunch of other commands that the initial command called.
      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


      • #4
        I'm guessing that you've got a factor variable with hundreds and hundreds of levels, with only 70 outcomes of a type to split among them. Nevertheless, it's my understanding that if you've got at least one failure and at least one success, then the Firth-penalized logistic regression algorithm will converge. And you really shouldn't be getting the Mata error no matter what. (For me, accidentally treating a continuous variable with factor notation has always resulted in a prompt matsize-too-small error and not some kind of disgorgement emanating from Mata.)

        So I'm curious to see what's going on with your particular dataset. From the sound of it, it isn't any kind of trade secret or something protected by data-privacy law. So, skip -dataex- and attach the entire dataset to your follow-up post along with the syntax of the model that you're trying to fit.

        Comment

        Working...
        X