Announcement

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

  • Panel Data Analysis

    Hello, everyone.

    I have a panel dataset consisting of two survey waves, and I am running fixed effects regression model. However, in addition to panel estimation, I would like to conduct a cross-sectional analysis for each of these waves separately. I get a different number of observations for each of the cross-sectional regressions. How can I make sure that I use the same individuals that were used by STATA in wave1 in a subsequent regression for wave2? I presume the problem arises due to missing values for certain variables.


    Thank you very much in advance!

  • #2
    Code:
    xtreg y x ..., fe
    gen sample=e(sample)
    reg y x... if sample & wave1
    reg y x... if sample & wave2
    See

    Code:
    help e(sample)

    Comment


    • #3
      Thank you so much for your prompt response! I have done this before, but this does not work. There are still more observations in wave 2 than in wave1 for a cross-sectional regression. This is likely due to missing values and unbalanced panel data. Is there a way to choose the same people that were chosen in wave 2 but for wave 1? I am saying in wave 2 because that wave has fewer observations. As a sidetone, when I tabulate the wave I get an equal number of observations for both waves.

      Comment


      • #4
        Let me reformulate my question.

        I was experiencing the problem of "repeated time values within panel," that I solved with the following command:

        duplicates drop
        sort id wave
        drop if wave==wave[_n-1]


        After performing this, I ended up with an equal number of observations within each wave.

        As stated before, I still end up with a different number of observations while running the separate regressions for each wave.
        So, how can I make sure that the observations in the dataset are truncated to only include those who are in both waves?

        Comment


        • #5
          I know xtreg keeps singleton observations, but apart from this, an unbalanced panel is not an issue due to listwise deletion. For panel data, you need a minimum of two time periods, so the panel estimator's sample should be the overlap over the two samples. Provide a data example that replicates your issue.

          Comment


          • #6
            I have resolved the issue. It was due to missing values in the independent variables.

            Thank you very much!

            Comment


            • #7
              I have one more follow-up question. How can one achieve min, avg, and max obs per group in xtreg,fe to equal 2?

              Comment

              Working...
              X