Announcement

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

  • How to deal with treatment assignment times vary problem in STATA17?

    Dear all Statalist experts, today I read the new function of Difference-in-Difference test from STATA17 called xtdidregress

    I applied this code to my data and got the results below:
    Code:
    xtdidregress (FAT_w1  $tatcov_) (post33treat1), group(TYPE2) time(year1)
    Among them, FAT_w1 is the dependent variable, $tatcov_ is the covariates, post33treat1 is a binary variable( receiving value of 1 for the treatment group after event day and 0 other wise), TYPE2 is the firm type and year1 is the real year in me data sample.
    Click image for larger version

Name:	Capture.PNG
Views:	1
Size:	15.9 KB
ID:	1682011





    After that, following the guide of the same link above, I conduct a parallel trend test visually by using the syntax
    Code:
    estat trendplots
    However, the results turns out an error like that
    Click image for larger version

Name:	Capture1.PNG
Views:	1
Size:	2.6 KB
ID:	1682012



    I am wondering why they said "treatment assignment times vary" here. Because in my datasample, I only have one event date and examining 3 years before and 3 years after this event date.



    Could you please kindly to help me in sorting it out?

    Many thanks and warmest regards.
    Last edited by Phuc Nguyen; 14 Sep 2022, 23:08.

  • #2
    in your screenshot treatment assignment times vary from 2019 to 2021. first observed treatment time by group,
    Code:
    egen first = min(year1) if post33treat1, by(TYPE2)

    Comment


    • #3
      Originally posted by Øyvind Snilsberg View Post
      in your screenshot treatment assignment times vary from 2019 to 2021. first observed treatment time by group,
      Code:
      egen first = min(year1) if post33treat1, by(TYPE2)
      Dear Øyvind Snilsberg , thank you for your help, my concern is how to address the technical issue above. Hope that I did not misunderstand your point.


      Much thanks and best regards.

      Comment


      • #4
        Hi Phuc Nguyen, did you find an answer to your question? I am struggling with the same issue!

        Comment


        • #5
          The solution is to make sure that (i) all units in control group start in the sample at the same time and (ii) all units in treatment group start to be treated at the same time.
          The easiest way is to create a balanced sample from the current unbalanced sample. But if you want to keep dynamics of firms (firm entry and exit), then you need to create a new (unbalanced) sample such that it satisfies the two conditions above. You can easy do both approaches in a few steps by using the egen() function.

          Good luck!

          ---------
          Hannah (Hoa) Nguyen
          Last edited by Nguyen Hoa; 15 Jun 2023, 04:31.

          Comment


          • #6
            Originally posted by Nguyen Hoa View Post
            The solution is to make sure that (i) all units in control group start in the sample at the same time and (ii) all units in treatment group start to be treated at the same time.
            The easiest way is to create a balanced sample from the current unbalanced sample. But if you want to keep dynamics of firms (firm entry and exit), then you need to create a new (unbalanced) sample such that it satisfies the two conditions above. You can easy do both approaches in a few steps by using the egen() function.

            Good luck!

            ---------
            Hannah (Hoa) Nguyen
            Thank you so much, I solved it with the same approach previously, this mainly caused by the missing data that makes the treatment date of unit varying

            Comment

            Working...
            X