Announcement

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

  • Problem applying sampling weights for two-level mixed effects logit (melogit)

    Dear Forum,

    I am trying to run a mixed effects logit model for the effect of economic inequality (gini_net on country level from Standardized World Income Inequality Database) on voter turnout among immigrants (individual level data from European Social Survey, ESS). My current problem, before introducing an interaction between vote and gini_net, is to get the command melogit to run wile applying sampling weight for the individual data from ESS.

    I have tried to run the following command:

    melogit vote gini_net immi1 pweight=dweight || country:

    ..and I get the message: ​=exp not allowed

    Is it at all possible to add weights in melogit, or what am I doing wrong?


    Any help is appreciated!
    Best regards, Astrid Jæger

  • #2
    Hello Astrid,

    Welcome to the Stata Forum.

    Use [pweight=dweight] instead.

    Hopefully that helps!

    Best,

    Marcos
    Best regards,

    Marcos

    Comment


    • #3
      Dear Marcos,

      Thank you for your answer!


      Unfortunetly, it did not work. I still get the following output, when I run the command:

      . melogit immi vote c.gini_net [pweight=dweight] || country:
      weights not allowed
      r(101);



      Another information that might be of importance is that the command cannot run without the weights either. When trying this, I get the following output:

      . melogit immi1 vote gini_net || country:

      Fitting fixed-effects model:

      Iteration 0: log likelihood = -9818.4831
      Iteration 1: log likelihood = -9014.1057
      Iteration 2: log likelihood = -9007.619
      Iteration 3: log likelihood = -9007.6028
      Iteration 4: log likelihood = -9007.6028

      Refining starting values:

      Grid node 0: log likelihood = -8595.2197

      Fitting full model:

      initial values not feasible
      r(1400);


      Thank you in advance!

      Best regards,
      Astrid

      Comment


      • #4
        melogit does indeed take sampling weights. I've modified Example 5 in the ME Manual entry for meglm and the code, below, runs without error in Stata 14.

        Code:
        use http://www.stata-press.com/data/r14/pisa2000, clear
        sort id_school
        generate sqw = w_fstuwt * w_fstuwt
        by id_school: egen sumw = sum(w_fstuwt)
        by id_school: egen sumsqw = sum(sqw)
        generate pst1s1 = w_fstuwt*sumw/sumsqw
        by id_school: egen mn_isei = mean(isei)
        
        melogit  pass_read female isei mn_isei high_school college test_lang one_for //
        both_for [pw=pst1s1], || id_school:
        In the original there is a sampling weight at the school level as well.

        As to your "initial values not feasible" without weights, a couple of suggestions: 1) try meqrlogit ; 2) add the option "difficult".
        Steve Samuels
        Statistical Consulting
        [email protected]

        Stata 14.2

        Comment


        • #5
          Correction: the comment "//" at the end of the second-to-last line of code should be "///"
          Steve Samuels
          Statistical Consulting
          [email protected]

          Stata 14.2

          Comment


          • #6
            Dear Steve,

            Thank you very much!
            I got the meqrlogit to run!

            Unfortunetly, I run Stata 13, which I should have pointed out of course, and here it still doesn't work.
            I still get the same message: weights not allowed when i paste your code into a do-file. It doesn't work
            with my own variables either.


            I will find a device with Stata 14 and try it there!

            Comment


            • #7
              I'm sorry I didn't think of this earlier: try gllamm (SSC), which can take different weight at each level. Indeed meglm examples 5 & 6 are meant to replicate a gllamm analysis.
              Steve Samuels
              Statistical Consulting
              [email protected]

              Stata 14.2

              Comment

              Working...
              X