Announcement

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

  • issue with meologit

    I'm new in Stata and I'm having a problem with meologit commands. I wanted to examine estimates of the state (level 2) effects in my data and I only want one record of each state in order to prduce a caterpillar plot. these are my syntax:

    predict u, reffects reses(use)
    (calculating posterior means of random effects)
    (using 15 quadrature points)


    egen pickone=tag(state)

    egen urank=rank(u) if pickone==1
    (7282 missing values generated)

    I don't know why there are missing values generated and more than 50% of my empirical bayes means for _cons[state] is zero. anyone have an answer or suggestion?

    Thanks in advance

  • #2
    I don't know why there are missing values generated
    Well, your command -egen urank=rank(u) if pickone==1- tells Stata to only create a value of urank in those observations where pickone == 1 (which amounts to one observation for each state). For all other observations (presumably the majority) you have told Stata to leave a missing value there. (And that is quite appropriate if you are going on to produce a caterpillar plot.)

    If you mean that Stata is produceing missing values of urank even in observations where pickone == 1, that is a separate issue. But, like your second question about zero estimates for _cons[state], one that I don't see any way to help out with unless you show: both the exact -meologit- command you used and the complete and exact -meologit- output you got from Stata. Even with all of that, it may not be clear what the source of the problem is: it could be some peculiarity of your data. But at least with those two, some possibilities could be ruled out, and perhaps some considered probable.

    Comment


    • #3
      Originally posted by Clyde Schechter View Post
      Well, your command -egen urank=rank(u) if pickone==1- tells Stata to only create a value of urank in those observations where pickone == 1 (which amounts to one observation for each state). For all other observations (presumably the majority) you have told Stata to leave a missing value there. (And that is quite appropriate if you are going on to produce a caterpillar plot.)

      If you mean that Stata is produceing missing values of urank even in observations where pickone == 1, that is a separate issue. But, like your second question about zero estimates for _cons[state], one that I don't see any way to help out with unless you show: both the exact -meologit- command you used and the complete and exact -meologit- output you got from Stata. Even with all of that, it may not be clear what the source of the problem is: it could be some peculiarity of your data. But at least with those two, some possibilities could be ruled out, and perhaps some considered probable.
      Yes, I mean Stata producing missing values of urank. well, here is my command and output for meologit ((kode_kab in command below means state))

      . meologit y || kode_kab:,intpoints(15)

      Fitting fixed-effects model:

      Iteration 0: log likelihood = -5752.0839
      Iteration 1: log likelihood = -5752.0839


      Refining starting values:

      Grid node 0: log likelihood = -5741.42


      Click image for larger version

Name:	output.jpg
Views:	1
Size:	232.6 KB
ID:	1384091


      Last edited by andin anindya; 17 Apr 2017, 15:07.

      Comment


      • #4
        Log likelihood = -5709.5501 Prob > chi2 = .
        ------------------------------------------------------------------------------
        y | Coef. Std. Err. z P>|z| [95% Conf. Interval]
        -------------+----------------------------------------------------------------
        /cut1 | -2.087391 .0450602 -46.32 0.000 -2.175707 -1.999074
        /cut2 | -.6080492 .0327438 -18.57 0.000 -.6722259 -.5438725
        -------------+----------------------------------------------------------------
        kode_kab |
        var(_cons)| .4120288 .298579 .0995634 1.705122
        ------------------------------------------------------------------------------
        LR test vs. ologit model: chibar2(01) = 85.07 Prob >= chibar2 = 0.0000

        Comment


        • #5
          As a sidelight this would be much easier to read if you used code tags; see pt 12 of the FAQ. Otherwise everything that is 2 spaces or more gets reduced to 1 space which totally screws up the spacing.
          -------------------------------------------
          Richard Williams, Notre Dame Dept of Sociology
          StataNow Version: 18.5 MP (2 processor)

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

          Comment


          • #6
            Originally posted by Richard Williams View Post
            As a sidelight this would be much easier to read if you used code tags; see pt 12 of the FAQ. Otherwise everything that is 2 spaces or more gets reduced to 1 space which totally screws up the spacing.
            I'm sorry Sir, I've edit it so it can be much easier to read

            Comment


            • #7
              OK. You are getting exactly the number of missing values of urank that you should be getting. The -meologit- output shows you start with 7,290 observations in the estimation sample. And they are in 8 groups (kode_kab). So your command generating the variable pickone will select 8 observations to set pickone = 1, and for the others pickone = 0. So there will be 7290-8 = 7282 observations that don't have pickone = 1. All of those observations will not get a value of urank because your -egen urank...if pickone == 1- command explicitly says to evaluate urank only in those 8 observations. In the remaining 7,282 observations urank is set to missing value.

              As for 50% of your empirical Bayes estimates being zero, this isn't terribly surprising either. You have only 8 groups. So 50% of your empirical Bayes estimates is exactly four of them. With only 8 different groups, you are not really getting a very good sample of the distribution of effects at the kode_kab level. So pretty much anything can happen.

              In all honesty, I don't think I would even do a random effects model with just 8 groups. There just isn't enough information there to really get a decent estimate of the parameters of that distribution.

              Comment


              • #8
                Originally posted by Clyde Schechter View Post
                OK. You are getting exactly the number of missing values of urank that you should be getting. The -meologit- output shows you start with 7,290 observations in the estimation sample. And they are in 8 groups (kode_kab). So your command generating the variable pickone will select 8 observations to set pickone = 1, and for the others pickone = 0. So there will be 7290-8 = 7282 observations that don't have pickone = 1. All of those observations will not get a value of urank because your -egen urank...if pickone == 1- command explicitly says to evaluate urank only in those 8 observations. In the remaining 7,282 observations urank is set to missing value.

                As for 50% of your empirical Bayes estimates being zero, this isn't terribly surprising either. You have only 8 groups. So 50% of your empirical Bayes estimates is exactly four of them. With only 8 different groups, you are not really getting a very good sample of the distribution of effects at the kode_kab level. So pretty much anything can happen.

                In all honesty, I don't think I would even do a random effects model with just 8 groups. There just isn't enough information there to really get a decent estimate of the parameters of that distribution.
                thank you so much for your answer Sir, I get it now

                Comment


                • #9
                  deleted post as i figured out the issue.
                  Last edited by Liting Cai; 08 Feb 2022, 21:07.

                  Comment

                  Working...
                  X