Announcement

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

  • How to add a reference period when I using the csdid package

    Hi everyone,

    I am using the csdid package and event_plot comment to draw an dynamic change graph. But I did not find the way to choose the reference period, like period -1. I found this problem is common for other new DID methods like did_imputation. So, is there any method to fix it?

    Best,
    Zichun

  • #2
    Hi Zichun
    CSDID uses T-1 as the base period by default. You cannot choose other periods (for example allowing for anticipation), except by changing gvar manually.
    If you see an effect on T-1, is probably because you are using default option, which relies on short gaps. Add the option -long2-, soyou can see t-1 as blank in the plot (and table)
    F

    Comment


    • #3
      Originally posted by FernandoRios View Post
      Hi Zichun
      CSDID uses T-1 as the base period by default. You cannot choose other periods (for example allowing for anticipation), except by changing gvar manually.
      If you see an effect on T-1, is probably because you are using default option, which relies on short gaps. Add the option -long2-, soyou can see t-1 as blank in the plot (and table)
      F
      Thank you so much!

      Comment


      • #4
        Originally posted by FernandoRios View Post
        Hi Zichun
        CSDID uses T-1 as the base period by default. You cannot choose other periods (for example allowing for anticipation), except by changing gvar manually.
        If you see an effect on T-1, is probably because you are using default option, which relies on short gaps. Add the option -long2-, soyou can see t-1 as blank in the plot (and table)
        F
        Hi Fernando!

        I am having the same question. In my case, adding the option -long2- does not make the coefficient of g-1 disappear.

        I suppose this is because csdid uses t-1 vs. t (t is varying) for pre-treatment estimation, and the coefficient of g-1 represents the difference of g-2 vs. g-1 between treat group and control group.

        I was wondering whether csdid has a way to use universal reference period for pre-treatment estimation, like in R's did (the option "base_period"). That is, to use g-1 as the reference period for all the pre- and post-treatment estimation. I see the help file says the option -long2- "is similar to base universal" but I still don't get how this option works.

        Could you kindly explain a bit? Thank you so much!

        Comment


        • #5
          Can you show the results?

          Comment


          • #6
            Sure. Here is the data example:

            Code:
            * Example generated by -dataex-. For more info, type help dataex
            clear
            input float Y long gvkey float(year first_treat clustervar)
            1  14002 2000    0 46
            1  14002 2001    0 46
            1  14002 2003    0 46
            1 140760 2003 2001  8
            1 140760 2004 2001  8
            end
            And here is the result:

            Code:
            . csdid Y, ivar(gvkey) time(year) gvar(first_treat) agg(event) method(reg) rseed(1) notyet cluster(clustervar) long2
            
            Units always treated found. These will be excluded
            Panel is not balanced
            Will use observations with Pair balanced (observed at t0 and t1)
            .........x.....x.......x.......x
            Difference-in-difference with Multiple Time Periods
            
            Number of obs = 6,212
            Outcome model : regression adjustment
            Treatment model: none
            (Std. err. adjusted for 46 clusters in clustervar)
            ------------------------------------------------------------------------------
            | Coefficient Std. err. z P>|z| [95% conf. interval]
            -------------+----------------------------------------------------------------
            T-5 | -.0241309 .0186482 -1.29 0.196 -.0606807 .0124189
            T-4 | -.0845919 .0289547 -2.92 0.003 -.1413421 -.0278417
            T-3 | -.01381 .0184488 -0.75 0.454 -.0499689 .022349
            T-2 | -.0266007 .0151541 -1.76 0.079 -.0563023 .0031008
            T-1 | -.013177 .0089546 -1.47 0.141 -.0307278 .0043737
            T+0 | -.0362986 .0071993 -5.04 0.000 -.0504089 -.0221882
            T+1 | -.029889 .0096612 -3.09 0.002 -.0488247 -.0109534
            T+2 | -.0250312 .0105008 -2.38 0.017 -.0456125 -.00445
            T+3 | -.0041936 .0122462 -0.34 0.732 -.0281956 .0198085
            T+4 | -.0158408 .0189659 -0.84 0.404 -.0530133 .0213316
            T+5 | -.0457156 .0307329 -1.49 0.137 -.105951 .0145198
            T+6 | -.4788718 . . . . .
            ------------------------------------------------------------------------------
            Control: Not yet Treated
            end
            Last edited by Lucy Lin; 29 May 2024, 18:13.

            Comment


            • #7
              Are you sure you have the latest versions of csdid and drdid?

              Comment


              • #8
                Originally posted by FernandoRios View Post
                Are you sure you have the latest versions of csdid and drdid?
                I updated csdid and drdid to the latest version and it works as below. Thank you for reminding me!

                Code:
                . csdid Y, ivar(gvkey) time(year) gvar(first_treat) agg(event) method(reg) rseed(1) notyet cluster(clustervar) long2
                Units always treated found. These will be ignored
                Panel is not balanced
                Will use observations with Pair balanced (observed at t0 and t1)
                .........x.....x.......x.......x
                Difference-in-difference with Multiple Time Periods
                
                                                                         Number of obs = 6,212
                Outcome model  : regression adjustment
                Treatment model: none
                                            (Std. err. adjusted for 46 clusters in clustervar)
                ------------------------------------------------------------------------------
                             | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
                -------------+----------------------------------------------------------------
                     Pre_avg |  -.0324621   .0140837    -2.30   0.021    -.0600657   -.0048585
                    Post_avg |  -.0908344   .0095774    -9.48   0.000    -.1096058    -.072063
                         Tm6 |  -.0241309   .0186482    -1.29   0.196    -.0606807    .0124189
                         Tm5 |  -.0845919   .0289547    -2.92   0.003    -.1413421   -.0278417
                         Tm4 |    -.01381   .0184488    -0.75   0.454    -.0499689     .022349
                         Tm3 |  -.0266007   .0151541    -1.76   0.079    -.0563023    .0031008
                         Tm2 |   -.013177   .0089546    -1.47   0.141    -.0307278    .0043737
                         Tp0 |  -.0362986   .0071993    -5.04   0.000    -.0504089   -.0221882
                         Tp1 |   -.029889   .0096612    -3.09   0.002    -.0488247   -.0109534
                         Tp2 |  -.0250312   .0105008    -2.38   0.017    -.0456125     -.00445
                         Tp3 |  -.0041936   .0122462    -0.34   0.732    -.0281956    .0198085
                         Tp4 |  -.0158408   .0189659    -0.84   0.404    -.0530133    .0213316
                         Tp5 |  -.0457156   .0307329    -1.49   0.137     -.105951    .0145198
                         Tp6 |  -.4788718          .        .       .            .           .
                ------------------------------------------------------------------------------
                Control: Not yet Treated
                end
                One more question here. Can I wrap up all periods before g-3 (that is, collapse Tm6 Tm5 Tm4 Tm3 into one line)?

                I really appreciate your help!

                Comment

                Working...
                X