Announcement

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

  • Can you xtset repeated cross sectional data?

    Hello everyone,

    I am using the bacomdecomp command in Stata, which decomposes the 2WFE estimate into mutually exclusive components. More can be found out here: https://ideas.repec.org/c/boc/bocode/s458676.html

    The issue I run into it that it requires me to xtset the data before doing the decomposition. The thing is, I don't have panel data. I have repeated cross sections. Is there anyway that this type of data can be xtset so I can use the bacondecomp command?

    Many thanks for your help in advance!






  • #2
    I am a bit lost. From the output of help bacondecomp we see

    bacondecomp implements a Bacon decomposition of a difference-in-differences (DD) estimator with variation in treatment timing, based on Goodman-Bacon (2018). The two-way fixed effects DD model is a weighted average of all possible two-group/two period DD estimators.
    This suggests that a fuller statement in post #1 would have been that bacondecomp decomposes the 2WFE difference-in-differences estimate, and my understanding, which may be wrong, is that the difference-in-differences model requires panel data, which you do not have.

    Comment


    • #3
      I don't know anything about the bacondecomp command, and perhaps it does require panel data. I don't know.

      But it is not true that difference in difference estimators require panel data. You can do DID estimation with serial cross sections provided you have both pre- and post-intervention observations for both the intervention group and the control group. The DID estimators are more efficient with panel data than with serial cross sections, as you gain the benefit of the longitudinal within-entity contrast. But panel data is not required, just preferred, for DID.

      For example, one might do a DID study of the impact of some legislative policy on some person-level outcome in different states. You would have states that legislated the policy and those that didn't. Then you might have survey data in both groups of states before the policy is implemented, and repeat surveys in the same states, but not of the same people, post-intervention. This would be serial cross sections, rather than panel data, and you could -xtset state- and -xtreg outcome i.treat##i.pre_post, fe-. This would give you a DID estimate of the within-state treatment effect; the within-person treatment effect would not be estimable from this kind of data.


      Comment


      • #4
        Hi William,

        Thanks for your response.

        Yes, you are right in saying that the bacomdecomp command decomposes the 2WFE difference-in-differences estimate. I don't have panel data, but I am under the impression that you can use difference-in-differences on repeated cross sectional data. So in light of that, I am wondering if I could still xtset my data for the purposes of doing a bacondecomp on my data, to get a sense for the weights among all the possible permutations of treatment and control groups driving my single DD coefficient. I hope this helps clarify what I am trying to do? Thanks for your help!



        Comment


        • #5
          Ola Aboukhsaiwan -

          Clyde answered your question in post #3, in which he corrected the mistaken assumption that xtset required panel data in post #1, and the mistaken assumption that difference-in-differences required panel data in post #2 (based on a statement in the Wikipedia entry for Difference-in-Differences, if someone would care to correct that!), by describing difference-in-differences on repeated cross-sectional data.

          I would think of repeated cross-sectional data, in Clyde's example, as panel data at the state level with repeated measurements within each panel. I had not previously seen the term "serial cross-sections" used.
          Last edited by William Lisowski; 29 Mar 2021, 14:07.

          Comment


          • #6
            Ah yes, I just saw Clyde's response! I started responding to your post before I could see that he had posted.

            Thanks so much Clyde Schechter. I have tried xtset state on my data, but I get this error in response when I try to run the bacondecomp command:

            Click image for larger version

Name:	bacondecomp.PNG
Views:	1
Size:	4.7 KB
ID:	1600460


            I'm not sure what to make of this. Do you have any ideas?

            For a bit more background, I have a staggered diff-in-diff setting, as there are two treatment periods across states. So to estimate the diff-in-diff coefficient, I am effectively running a two way fixed effects estimation (state and year) with the treatment variable being the key explanatory variable in my regression. The treatment is an indicator that switches on once a state is treated over time.

            Thanks again for everybody's input!


            Comment


            • #7
              That error means exactly what it says. It means that the -bacondecomp- command (though not DID in general) does require panel data, which you do not have. Nor will you be able to get around this by including a time variable in your -xtset- command because you will then run into a "repeated time values" error from -xtset-. So your data is not suitable for use with -bacondecomp-.

              As I know nothing about Bacon decomposition, I cannot advise you whether this is specifically a limitation of that particular implementation, or if Bacon decomposition in general is only defined for true panel data. If you cannot find the answer to this in the literature, you might consider contacting one of the authors of the -bacondecomp- command directly.

              Comment

              Working...
              X