Announcement

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

  • CSDID with unbalanced data

    Hi All,
    I am using CSDID command, I have unbalanced panel data on more than 3000 firms from 1988-2020, since some of the ids were treated in the first year itself i.e., 1988, i constructed the clone year of 1987 where no ids were treated. Now when I use the command some of the results for years omitted.
    if possible can you please help me with this.
    Below is the command i am using:
    set seed 1
    gen sample = runiform()<.9
    csdid lnirddintensity lnipd if sample==1, ivar(id) time(year) gvar(treat) method(reg)

    i have also used the default method but getting the issue.
    @FernandoRios

  • #2
    First things first
    can you provide the following
    tab year treat

    That will show me if the data is correctly setup and which years could be potentially dropped

    Comment


    • #3
      Thank you so much for your reply.
      Here you go
      year treat
      0 1988 1989 1991 1994 1995 1996 1997 1998 2005 2016 Total
      1987 12 545 34 416 233 37 9 67 54 190 16 1613
      1988 13 575 36 437 244 38 9 68 58 201 17 1696
      1989 14 606 36 459 256 40 11 68 61 214 17 1782
      1990 14 629 37 484 266 43 13 70 62 223 18 1859
      1991 14 659 39 509 278 45 15 76 64 241 18 1958
      1992 14 687 41 532 288 46 15 82 66 261 20 2052
      1993 14 709 45 552 294 54 17 84 70 277 22 2138
      1994 14 741 45 577 308 57 19 88 74 290 24 2237
      1995 18 772 50 599 325 61 22 89 79 304 24 2343
      1996 18 796 51 614 350 62 22 93 79 313 25 2423
      1997 18 813 52 630 370 64 22 93 85 324 26 2497
      1998 18 837 53 647 379 66 22 93 87 329 27 2558
      1999 19 855 54 654 390 67 22 94 91 337 29 2612
      2000 19 871 54 663 402 71 23 98 94 342 29 2666
      2001 19 879 54 671 406 71 23 100 96 352 30 2701
      2002 19 885 55 675 415 71 24 101 97 361 30 2733
      2003 19 894 55 685 421 72 24 102 97 369 30 2768
      2004 19 909 57 692 442 72 25 102 97 379 30 2824
      2005 19 929 58 705 448 72 25 103 98 393 30 2880
      2006 19 950 59 719 459 73 25 106 98 396 31 2935
      2007 19 977 60 729 473 74 25 109 99 401 31 2997
      2008 20 990 60 737 486 74 25 113 100 406 31 3042
      2009 20 1000 60 745 488 74 26 113 101 407 31 3065
      2010 20 1007 60 748 495 74 26 113 101 408 31 3083
      2011 20 1022 60 755 502 74 26 113 101 409 31 3113
      2012 20 1025 60 758 503 74 26 114 101 409 31 3121
      2013 20 1035 60 763 504 74 27 114 101 412 31 3141
      2014 20 1037 60 764 507 74 27 114 101 412 31 3147
      2015 20 1041 61 765 509 74 27 114 102 414 31 3158
      2016 20 1041 62 767 509 74 27 114 102 416 31 3163
      2017 20 1041 62 767 509 74 27 114 102 417 31 3164
      2018 20 1041 62 767 509 74 27 114 102 417 31 3164
      2019 20 1041 62 767 509 74 27 114 102 417 31 3164
      2020 20 1041 62 767 509 74 27 114 102 417 31 3164
      Total 612 29880 1816 22519 13986 2218 757 3364 3024 11858 927 90961

      Comment


      • #4
        @FernandoRios any update?

        Comment


        • #5
          There is nothing obvious about the problem
          my guess is the panel is not appropriate or some
          covRiates are missing

          Comment


          • #6
            When I am using the default method then drops (omissions) are more but with reg produces good results [ can I use reg method instead of default method?].
            Can you please guide me to plot the calendar ATT. I am not aware of the code for the same. @FernandoRios

            Comment


            • #7
              In that case other methods may be trying to force balance when there is none. This omitting cases.
              for calendar plot
              estat calendar
              csdid_plot

              Comment


              • #8
                Thanks @FernandoRios.
                I have one another doubt.
                Click image for larger version

Name:	Calendar Aggregation.png
Views:	1
Size:	138.0 KB
ID:	1743045

                When I am plotting graphs for different aggregation then what does the rectangular region indicates?
                For example, in the following image what is the interpretation of the blue region since the triangles shows the ATT of particular aggregation? can one also observe the significance of the coefficients based on the plot?
                Thanks once again.

                Comment


                • #9
                  @FernandoRios, sorry for disturbing you again, if possible reply.

                  Comment


                  • #10
                    The regions are the 95% CI

                    Comment


                    • #11
                      Hi Dear FernandoRios,
                      When I am reproducing the results, I am getting no values. All variables are dropped, and zero observation is found while running the model.
                      I have also emailed you regarding this. Please help me to get the issue solved.

                      for your convenience, I am also attaching : tab year treatment.
                      year treatment
                      0 1988 1989 1991 1994 1995 1996 1997 1998 2005 2016 Total
                      1987 1610 0 0 0 0 0 0 0 0 0 0 1610
                      1988 1121 572 0 0 0 0 0 0 0 0 0 1693
                      1989 1138 602 37 0 0 0 0 0 0 0 0 1777
                      1990 1192 625 37 0 0 0 0 0 0 0 0 1854
                      1991 783 655 38 477 0 0 0 0 0 0 0 1953
                      1992 825 683 40 499 0 0 0 0 0 0 0 2047
                      1993 867 704 44 515 0 0 0 0 0 0 0 2130
                      1994 601 737 44 539 308 0 0 0 0 0 0 2229
                      1995 572 769 49 560 325 61 0 0 0 0 0 2336
                      1996 570 793 50 570 349 62 22 0 0 0 0 2416
                      1997 497 810 51 585 368 64 22 93 0 0 0 2490
                      1998 420 833 52 600 377 66 22 93 87 0 0 2550
                      1999 431 851 53 607 388 67 22 94 91 0 0 2604
                      2000 438 867 53 614 400 71 23 98 94 0 0 2658
                      2001 450 875 53 621 404 71 23 100 96 0 0 2693
                      2002 459 882 54 625 413 71 24 101 97 0 0 2726
                      2003 468 891 54 634 419 72 24 102 97 0 0 2761
                      2004 479 907 56 640 440 72 25 102 97 0 0 2818
                      2005 102 927 57 652 446 72 25 103 98 392 0 2874
                      2006 104 948 58 665 457 73 25 106 98 395 0 2929
                      2007 104 976 59 675 472 74 25 109 99 401 0 2994
                      2008 107 989 59 682 485 74 25 113 100 406 0 3040
                      2009 107 999 59 690 488 74 26 113 101 407 0 3064
                      2010 108 1006 59 693 495 74 26 113 101 408 0 3083
                      2011 108 1021 60 700 502 74 26 113 101 409 0 3114
                      2012 108 1024 60 703 503 74 26 114 101 409 0 3122
                      2013 108 1034 60 708 504 74 27 114 101 412 0 3142
                      2014 108 1036 60 709 507 74 27 114 101 412 0 3148
                      2015 108 1040 61 710 509 74 27 114 102 414 0 3159
                      2016 77 1040 62 712 509 74 27 114 102 416 31 3164
                      2017 77 1040 62 712 509 74 27 114 102 417 31 3165
                      2018 77 1040 62 712 509 74 27 114 102 417 31 3165
                      2019 77 1040 62 712 509 74 27 114 102 417 31 3165
                      2020 77 1040 62 712 509 74 27 114 102 417 31 3165
                      Total 14478 29256 1727 19233 12104 1858 627 2579 2272 6549 155 90838

                      One more doubt: If an entity is treated in the year 1997, then the value for the treatment variable will be 1997 in the year 1997 and thereafter, but for all years before 1997, should it be zero or still 1997?


                      Thanks and Regards,
                      Hariom
                      Last edited by hariom arora; 27 Feb 2025, 07:36.

                      Comment


                      • #12
                        Still 1997
                        think of it as a more explicit test for anticipation.
                        You know they would be treated in 1997, so you can still treat them separately. If they do not know, PTA will hold. If they knew and reacted to it, PTA will be violated

                        Comment

                        Working...
                        X