Announcement

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

  • Paneldata Analysis with years appearing more than once

    Hi fellow people. I am using Stata to make an analysis of how the level of democracy in some countries have developed or regressed during the covid-19 pandemic. From what i have understood, I need to make sure that my data is ready for doing paneldata, with panelregression as a goal. In order to do this, I have a data set that looks like the following:
    Click image for larger version

Name:	Stataexempel.jpg
Views:	1
Size:	130.7 KB
ID:	1676357



    My goal is to make graphs showing how all the countries included (about 90) has changed from 2010 and to 2021 in terms of the democracy variable in the far right of the photo. However when I write in tsset year (as the year is my intended variabel of setting a date) I get the error message "repeated time values in sample". Which I understand why I get because I have multiple countries with the same year in the dataset. Will it be impossible to make the paneldata with the variables I have right now and should I look for another way to reach my goal? Or do I have to change the variables in some way in order to set the year as date?

    I am very thankful for any advice or suggestions on how to go forward with this. If anyone would know a better way to present this data through stata, where the countries, years, and their progression with the v2x_polyarchy variable to the right, I would be so grateful for tips. Thanks in advance.

    Since I posted a photo of the data from VDem, I would also like to cite them correctly:

    Coppedge, Michael, John Gerring, Carl Henrik Knutsen, Staffan I. Lindberg, Jan Teorell, David Altman, Michael Bernhard, Agnes Cornell, M. Steven Fish, Lisa Gastaldi, Haakon Gjerløw, Adam Glynn, Sandra Grahn, Allen Hicken, Katrin Kinzelbach, Kyle L. Marquardt, Kelly McMann, Valeriya Mechkova, Pamela Paxton, Daniel Pemstein, Johannes von Römer, Brigitte Seim, Rachel Sigman, Svend-Erik Skaaning, Jeffrey Staton, Eitan Tzelgov, Luca Uberti, Yi-ting Wang, Tore Wig, and Daniel Ziblatt. 2022. "V-Dem Codebook v12" Varieties of Democracy (V-Dem) Project.

  • #2
    Mans:
    you can simply -xtset- your dataset with -panelid- only.
    That said, while you can still add -i.year- as a predictor in the right-hand side of your regression equation, time-series operators such as lags and leads are no more available after this fix.
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Originally posted by Carlo Lazzaro View Post
      Mans:
      you can simply -xtset- your dataset with -panelid- only.
      That said, while you can still add -i.year- as a predictor in the right-hand side of your regression equation, time-series operators such as lags and leads are no more available after this fix.
      So If i understand you correctly, the paneldata analysis that I would like to do is not possible with the data formated as above?

      Comment


      • #4
        Code:
        tsset country_id  year
        should be tried.

        Comment


        • #5
          Mans:
          how did you -xtset- your dataset?
          What did Stata give you back? Thanks.
          Kind regards,
          Carlo
          (Stata 19.0)

          Comment

          Working...
          X