Announcement

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

  • gaps in paneldata - tsfill and _n-1

    Dear all,

    for my master's thesis I am running a panelanalysis.
    I used the reshape-command to transform the data from wide to long format and than I xtset the data with fallnum and wave.
    There are 5 waves for the years 1996, 2002, 2008, 2011 and 2014.
    68% of the persons took part on the study only once. Because of that I am having a lot of gaps in my paneldata and I should solve the problem.

    I tried to type in
    Code:
    tsfill  and  tsfill, full
    but it didn't work.
    Also I tried it with the following commands
    Code:
    gen x_n1=x[_n-1]
    
    gen x_n1= x[_n-1] if missing(x)
    
    gen x_n1=x[_n-1] if x>=.
    In every case the gaps did not get filled.
    Did I do anything wrong? Or is the number of gaps too large to fulfill them?

    Thank you in advance!
    Kind regards
    Mimi La

  • #2
    I am unsure if I understand your question correctly, but if they appear only once you have no gaps? You do have an unbalanced panel, which isnt necessarily an immediate issue. I would be very careful in creating new observations, since you do not really observe them. I would guess that -tsfill- does not work, since you as mentioned do not have any gaps.

    And your generate codes will not create new rows, only new columns.
    Last edited by Karl Tjensvoll; 10 Oct 2019, 07:58.

    Comment


    • #3
      Thank you for your quick answer!

      Yes, I have an unbalanced panel with in sum 20,715 persons, that took part between 1996 and 2014. If I transform the data from wide to long format, I get 103,575 observations.

      After that I run a regression (with the xtreg, re command) and got for the N of observations 8089 and for the N of groups 7035. By 8089/7035 I get just 1,15 points of measurement for each person on average. That is not a great result for panel data and to test my assumptions and hypothesis over time. Because of that I thought, I could close the gaps to get higher points of measurement for each person.

      When I said 68% of the persons took part only once, than I meant that for example one person took part the first time in the year 2008, but didn't take part in 2011 and 2014. In conlusion there are gaps for 1996, 2002, 2011 and 2014.
      I tried to solve the problem with the commands above, but it didn't work.

      I am really looking forward to get a solution in this forum.

      Thank you again!

      Comment


      • #4
        Mimi:
        the unbalancedness in your data are simply a matter of fact, that you could present and discuss as a limitation of your research.
        I think that presenting a limitation (provided that you cannot obtain the missing data) is, methidologically speaking, far better than eliminating those observations that have gaps and running the panel data regression on complete case analysis only (that I would consider an unlegal making up of your original sample).
        Kind regards,
        Carlo
        (Stata 18.0 SE)

        Comment


        • #5
          I guess most researchers would use wave as the time variable here. Using year as time variable will imply lots of gaps with the default of 1 year spacing, and using a spacing of 3 or 6 years won't solve the problems either.

          Comment


          • #6
            Dear Carlo and Nick,

            thank you very much for your advices!

            I think you are right and I should discuss it in the chapter of limitations. It is not legitimate to compute values for those many gaps and it would deform the data. 68% took part only once, this a fact and I have to deal with it.

            Thank you a lot! That was really helpful!

            Comment


            • #7
              Mimi:
              in order to avoid the sad results of (too) many cautionary tales I know, I do recommend you to propose the approach suggested in this thread (ie, taking and analyze your dataset as it is and put off any comment on the unbalancedness and missing values in the discussion chapter of your dissertation) with your supervisor and get her/his endorsement.
              Kind regards,
              Carlo
              (Stata 18.0 SE)

              Comment


              • #8
                Dear Carlo,

                thank you for your suggestion! Definitely I will talk to my supervisor and ask for the endorsement.

                Thank you very much and have a nice day!

                Kind regards
                Mimi

                Comment


                • #9
                  You too!
                  Kind regards,
                  Carlo
                  (Stata 18.0 SE)

                  Comment

                  Working...
                  X