Announcement

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

  • "No Free Constraints" Error with gologit2 in Large Dataset

    Hello Statausers,

    I am encountering a "no free constraints" error while attempting to run a generalized ordered logit model using the gologit2 command. My model includes a significant number of dummy variables for each country (over 60 countries) and several other covariates. Additionally, the dataset comprises more than 2,000,000 observations, which I suspect is contributing to reaching the maximum constraint limit in Stata (1,999 constraints).

    Below is a snippet of the code:

    Here's a snippet of my code for reference:

    Code:
        
    
    global countries = "Algeria Argentina.........[list of countries].... United_Kingdom " 
    global reference = "United_States"
    global covariates = "leisure group family couple nights domestic"    
    
    * define dummies
        foreach c in $countries_all {
            gen `c' = 0
            replace `c'  = 1 if guest_country_name == "`c'"
        }
    
    *Run generalized ordered probit (or logit) regression
    
    gologit2 score $countries $covariates i.unique_booking_id, npl($countries ) link(logit)
    gologit2 score $countries $covariates i.unique_booking_id,  npl($countries) link(probit) difficult
    Does anyone have experience handling this constraint issue or suggestions on how to bypass or mitigate this problem in such large-scale models? Any tips or alternative approaches that could help avoid hitting the constraint limit would be highly appreciated. Thank you in advance for your advice and insights!

  • #2
    Hi, please let me know if my question was not properly formulated or I can do something to reach a broader audience. As I didn't have any answer, I'm worried it was unclear.

    Comment


    • #3
      Is there any particular reason you are using gologit2 instead of xtlogit? The latter is the most up to date internal Stata command for panel data logit models. See help xtlogit and the associated PDF documentation.

      Comment


      • #4
        Thanks for the answer. I think they're not exactly the same. gologit2 is specifically for ordered logistic regression with a focus on relaxing certain assumptions (i.e. the parallel lines assumption, which assumes that the relationship between each pair of outcome groups is the same, is relaxed). xtlogit is used for binary or multinomial logistic regression models in a panel data context. Please correct me if I'm wrong

        Comment


        • #5
          Sorry about that! You are not wrong. I meant to say xtologit. Relaxing the parallel lines assumption is not a bad idea at all, but I'm not sure how feasible it is with 2,000,000 observations. I'm honestly not even sure xtologit will handle that many observations, but it is where I would go first. You could always randomly sample 30-40% of cases within cluster and try gologit2. See gsample, from SSC, for this purpose.

          Comment


          • #6
            In the paper "adjcatlogit, ccrlogit, and ucrlogit: Fitting ordinal logistic regression models", The Stata Journal (2014) 14, Number 4, pp. 947–964, Fagerland (on page 952) suggests to use "constraint drop" to allow more than 1.999 constraints.

            https://journals.sagepub.com/doi/pdf...867X1401400414

            Perhaps that will work for gologit2 as well?

            Comment


            • #7
              How many categories does score have? That will affect the number of constraints needed.

              Why create all these dummies for country? Why not just have something like i.country instead?

              If you use ologit or mlogit instead, will the model run?

              If you can greatly reduce the number of parameters (e.g. collapse countries into a small number of regions) you might have a fighting chance of getting gologit2 to run. Otherwise I suspect some sort of xt or me method is better.
              -------------------------------------------
              Richard Williams, Notre Dame Dept of Sociology
              Stata Version: 17.0 MP (2 processor)

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

              Comment


              • #8
                Also, the gologit2 troubleshooting FAQ discusses how other programs can be used to estimate random effects or multilevel gologit models. That makes more sense to me than including all these dummies for country. See

                https://www3.nd.edu/~rwilliam/gologit2/tsfaq.html
                -------------------------------------------
                Richard Williams, Notre Dame Dept of Sociology
                Stata Version: 17.0 MP (2 processor)

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

                Comment

                Working...
                X