Announcement

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

  • Install csdid2 package

    Dear all,

    I´m trying to install the csdid2 package from github: https://github.com/friosavila/csdid2.

    However my code is not working. This is:

    Code:
    net install github, from("https://haghish.github.io/github/")
    github install friosavila/csdid2
    Using the checking command, the install option is not available. How can I install the package?

    Code:
    github search csdid2, in(all) language(Stata) all
    Thanks.



  • #2
    Hi Luis,
    the latest is installed as follows

    net install csdid2, from("https://friosavila.github.io/stpackages")

    This is the place where i have all my latest updates, both released, or just experimental

    Comment


    • #3
      Thanks Fernando!

      Comment


      • #4
        Hi, FernandoRios this install method no longer seems to be working (at least not form me). However, I found the approach listed here (https://economistwritingeveryday.com/tag/honestdid/) works.

        Code:
        program fra
            syntax anything, [all replace force]
            local from "https://friosavila.github.io/stpackages"
            tokenize `anything'
            if "`1'`2'"==""  net from `from'
            else if !inlist("`1'","describe", "install", "get") {
                display as error "`1' invalid subcommand"
            }
            else {
                net `1' `2', `all' `replace' from(`from')
            }
            qui:net from http://www.stata.com/
        end
        fra install fra, replace
        fra install csdid2
        ssc install coefplot

        Comment


        • #5
          Hi Fernando

          I am trying to install csdid2 using net install csdid2, from("https://friosavila.github.io/stpackages") as you suggested above. It dosent complain when doing this and says all files are up to date. But when using the command firstly I cannot open a helpfile at all. It dosent recognize any helpfile for csdid2.

          When running a simple csdid2 lemp, ivar(countyreal) tvar(year) gvar(first) it starts producing the regression, but haults without any error message, see screen shot.

          Have you run into this problem? Any thoughts?
          Attached Files

          Comment


          • #6
            Hi Julie
            That is not an error
            I just havent written a helpfile for csdid2. Most of it works just like csdid, and the repository has extra notes on how to add other restrictions when doing aggregations.
            One of my "soft goals" this year is to write its helpfile, add an extra extension (more efficient use of memory). But its still on the to-do list.
            F

            Comment


            • #7
              Fernando haven't written a helpfile for cidid2, maybe you can use csdid.sthlp temporarily.

              Originally posted by Julie Brun Bjorkheim View Post
              When running a simple csdid2 lemp, ivar(countyreal) tvar(year) gvar(first) it starts producing the regression, but haults without any error message, see screen shot.
              Have you run into this problem? Any thoughts?
              After running csdid2, you can just use estat to produce outcomes you want

              Code:
              estat event

              Comment


              • #8
                Hello Fernando.
                I am using csdid2 that I find very efficient. The only problem is that I cannot manage to save the plot as I used to do with csdid. Can you help me with that? Thank you Paola

                Comment


                • #9
                  Need more detailed question

                  Comment


                  • #10
                    Hi Fernando,

                    Thank you very much for creating csdid2 command, which saves me tons of time. I have a question regarding the difference with csdid command, though. To illustrate my question, I'm using the example data from the help file of csdid.

                    Code:
                    use https://friosavila.github.io/playingwithstata/drdid/mpdta.dta, clear
                    I tried to run the same specification using csdid and csdid2:

                    Code:
                    csdid  lemp lpop , ivar(countyreal) time(year) gvar(first_treat) method(dripw) agg(simple) notyet
                    estat event
                    Code:
                    csdid2  lemp lpop , ivar(countyreal) time(year) gvar(first_treat) method(dripw) agg(simple) notyet
                    estat event
                    Although the simple ATT estimates and post average estimates are the same across two commands, the pre average estimates and the estimates for pre-shock periods are different. I'm attaching the results below.
                    Code:
                    . use https://friosavila.github.io/playingwithstata/drdid/mpdta.dta, clear
                    (Written by R.              )
                    
                    . csdid  lemp lpop , ivar(countyreal) time(year) gvar(first_treat) method(dripw) agg(simple) notyet
                    ............
                    Difference-in-difference with Multiple Time Periods
                    
                                                                             Number of obs = 2,500
                    Outcome model  : least squares
                    Treatment model: inverse probability
                    ------------------------------------------------------------------------------
                                 | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
                    -------------+----------------------------------------------------------------
                             ATT |  -.0413516   .0114278    -3.62   0.000    -.0637498   -.0189535
                    ------------------------------------------------------------------------------
                    Control: Not yet Treated
                    
                    See Callaway and Sant'Anna (2021) for details
                    
                    . estat event
                    ATT by Periods Before and After treatment
                    Event Study:Dynamic effects
                    ------------------------------------------------------------------------------
                                 | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
                    -------------+----------------------------------------------------------------
                         Pre_avg |  -.0004609   .0072816    -0.06   0.950    -.0147326    .0138108
                        Post_avg |  -.0799926    .018494    -4.33   0.000    -.1162402    -.043745
                             Tm3 |   .0267278   .0140657     1.90   0.057    -.0008404     .054296
                             Tm2 |  -.0052499   .0130015    -0.40   0.686    -.0307325    .0202326
                             Tm1 |  -.0228606   .0146118    -1.56   0.118    -.0514991     .005778
                             Tp0 |  -.0201445   .0116323    -1.73   0.083    -.0429433    .0026544
                             Tp1 |  -.0547303      .0164    -3.34   0.001    -.0868738   -.0225869
                             Tp2 |  -.1381918    .034228    -4.04   0.000    -.2052775   -.0711061
                             Tp3 |  -.1069039   .0328865    -3.25   0.001    -.1713602   -.0424476
                    ------------------------------------------------------------------------------
                    
                    . csdid2  lemp lpop , ivar(countyreal) time(year) gvar(first_treat) method(dripw) agg(simple) notyet
                    Producing Long Gaps by default
                    Using method dripw
                    ----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5 
                    ............
                    Difference-in-difference with Multiple Time Periods
                    Outcome model  : least squares
                    Treatment model: inverse probability
                    ------------------------------------------------------------------------------
                                 |               Robust
                                 | Coefficient  std. err.      z    P>|z|     [95% conf. interval]
                    -------------+----------------------------------------------------------------
                       SimpleATT |  -.0413516   .0114278    -3.62   0.000    -.0637498   -.0189535
                    ------------------------------------------------------------------------------
                    
                    . estat event
                    ------------------------------------------------------------------------------
                                 | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
                    -------------+----------------------------------------------------------------
                         Pre_avg |   .0190891   .0169212     1.13   0.259    -.0140758    .0522541
                        Post_avg |  -.0799926    .018494    -4.33   0.000    -.1162402    -.043745
                             tm4 |   .0062963   .0245367     0.26   0.797    -.0417948    .0543873
                             tm3 |   .0281105   .0176754     1.59   0.112    -.0065326    .0627536
                             tm2 |   .0228606   .0146118     1.56   0.118     -.005778    .0514991
                             tp0 |  -.0201445   .0116323    -1.73   0.083    -.0429433    .0026544
                             tp1 |  -.0547303      .0164    -3.34   0.001    -.0868738   -.0225869
                             tp2 |  -.1381918    .034228    -4.04   0.000    -.2052775   -.0711061
                             tp3 |  -.1069039   .0328865    -3.25   0.001    -.1713602   -.0424476
                    ------------------------------------------------------------------------------
                    Could you kindly share some insights on how I should interpret the difference between them? Thanks a lot in advance!
                    Last edited by Jiancong Liu; 31 Mar 2025, 06:52.

                    Comment


                    • #11
                      For thy to match you need to use the long2 option in csdid
                      that is the default with csdid2

                      Comment

                      Working...
                      X