Announcement

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

  • Error paneldata: repeated time values within paneldata

    Hello,

    I would like to work with paneldata. But when I try the command 'xtset Country Year', I get an error which says: repeated time values within paneldata.
    I think it is because I have multiple firms for every Country and Year, but since Stata is new for me, I'm not sure. Can someone help me and try to explain how I can use country-year fixed effects?

    Thank you in advance.

    My database is like this:
    Click image for larger version

Name:	Database Stata.png
Views:	1
Size:	5.5 KB
ID:	1345100




  • #2
    It's exactly what you said. why are you trying to use country as your panel identifier? shouldn't it be firm? what is the model you want to estimate?

    Comment


    • #3
      Thank you for your response. For my thesis I am replicating a paper and in the paper they include ' country-year fixed effects'.

      Click image for larger version

Name:	Model thesis.png
Views:	1
Size:	2.4 KB
ID:	1345106

      Bank i, Country j, Year t.
      Cj*Yt should be the country-year effects.

      Comment


      • #4
        This means that the panel unit should be firm. in the regression command you can manually input any fixed effects you want, using factor variable notations. see help fvvarlist for more information.
        also see here: https://www.princeton.edu/~otorres/Panel101.pdf

        Thus your model as a stata command will be something along the lines of:

        xtreg bank B i.country##i.year, fe

        Comment


        • #5
          Thank you so much Ariel.

          Comment


          • #6
            Coco:
            if Ariel's helpful advice does not solve your problem, you can also investigate erroneous duplicates in your dataset via:
            Code:
            isid bank year
            Kind regards,
            Carlo
            (Stata 19.0)

            Comment


            • #7
              Coco:
              Part of the problem is that what your equation doesn't match your description of the paper being replicated. I assume bank is the firm level. Your equation would be most normally handled as a panel with the panel variable bank, and country and year put in as Ariel shows. Note that Ariel's model includes the main effects that your model omits - it is almost automatic to include the main effects as well as interactions. But, in this case, you would describe the panel as bank, not country.

              If you just want fixed effects for country (and not bank), you can easily estimate a fixed effect model with regression and an i.country included. Something like:

              reg bank B i.country##i.year

              Depending on the specifics, if banks are only identified in the data as in one country and do not switch country, you cannot estimate both bank and country fixed effects. The bank fixed effect would take care of any country fixed effects. [This can be modified I think in mixed models depending on assumptions being imposed, but is true in conventional fixed effects estimators like xtreg, fe.] If the original estimate did the panel at the country level, and you set the panel at the bank/firm level, then you probably are not replicating the earlier work.

              Phil

              Comment

              Working...
              X