Announcement

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

  • Problem with insufficient observations

    Hi!

    I'm with a doubt that i already saw the answer on the forum, but on my code is not working.

    I'm trying to estimate a model with first difference, so im doing:

    A example of my base:

    ano cod_munic pib prop_serv
    2002 2800100 5509.195 .7160816
    2007 2800100 10907.59 .7550546
    2002 2800209 44256.39 .7147408
    2007 2800209 86428.34 .689031

    What i'm doing:

    xtset cod_munic ano, delta(5)
    xtreg pib prop_serv , fe
    xtreg d.pib d.prop_serv

    But the stata is telling me that i have insufficient observations, but i know that i have the same number of observations to the two years.

    The function xtreg works with just two years or i have to try another way??

    Thanks!!

  • #2
    If you have only two observations for each cod_munic, one for 2002 and one for 2007, then d.pib and d.prop_serv are only defined for one observation, as it is the difference between two consecutive observations. So for your second regression, you have just one observation per cod_munic. But singleton panels don't contribute any information to a fixed effects regression. So, you have no information for the regression, and Stata appropriately tells you that.

    Added: I didn't need to use your example data in Stata to answer this question. But if I had, it would have been time-consuming and difficult to get it into Stata from the form in which you posted it. In the future, all data examples should be posted using the -dataex- command, which you can get by running -ssc install dataex-. Read -help dataex- for the simple instructions. Using -dataex- makes it quick and easy for those who want to help you to create a faithful replica of your data example in their own Stata.
    Last edited by Clyde Schechter; 22 Oct 2016, 17:05.

    Comment


    • #3
      Thanks, Clyde!

      So what is the right way to estimate this model with first difference on the stata? I know what i have to do, but i dont know how the stata does that.

      Comment


      • #4
        http://www.statalist.org/forums/foru...nce-regression

        I'm trying to do the same thing that was said in this link

        Comment


        • #5
          Well, that thread never did close with a statement that everything had been worked out. I suspect it had not. You simply can't combine -xtreg, fe-, the difference operator and only two observations per panel and get results. It's a mathematical impossibility, and I suspect that if follow-up on that thread were available we would learn that they were not successful.

          With only two observations per municipality, you are more or less stuck. What you can do is abandon -xtreg, fe- and just do
          Code:
          regress d.pib d.prop_serve
          You still have only one observation per municipality for this regression, but because it is not a fixed effects regression, that will be sufficient to get results. Whether results based on only two years of data per municipality are meaningful depends on your context and your research goals, so I can't comment on that. It might well be quite adequate, or it might not.

          Comment

          Working...
          X