Announcement

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

  • #31
    I'm still looking for answers to my 2 questions above. If anyone can help me figure it out that, it will be highly appreciated.
    Thanks.

    Comment


    • #32
      1. Do you mean whether the treatment is endogenous? Do you have some reason to believe receiving the treatment is based in some way on the outcomes?

      2. After eventdd, you are supposed to be able to -estat lags- to test all the lag coefficients (or -estat leads- for the leads). I can't get it to work. Instead, you can run the reghdfe command (using keepdummies from eventdd) and test the lags (testparm lag*, or testparm lead* for parallel paths).

      Code:
      clear all
      use http://www.damianclarke.net/stata/bacon_example.dta, clear
      gen t2treat = year - _nfd
      save junk, replace
      eventdd asmrs pcinc asmrh cases , timevar(t2treat) method(hdfe, absorb(stfips year) cluster(stfips)) keepdummies
      
      reghdfe asmrs pcinc asmrh cases  lead* lag*,absorb(stfips year) cluster(stfips) 
      testparm lag*
      global L lag0
      forv i = 1/27 {
          global L $L + lag`i'
      }
      lincom ($L)/28

      Comment


      • #33
        Originally posted by George Ford View Post
        1. Do you mean whether the treatment is endogenous? Do you have some reason to believe receiving the treatment is based in some way on the outcomes?

        2. After eventdd, you are supposed to be able to -estat lags- to test all the lag coefficients (or -estat leads- for the leads). I can't get it to work. Instead, you can run the reghdfe command (using keepdummies from eventdd) and test the lags (testparm lag*, or testparm lead* for parallel paths).

        Code:
        clear all
        use http://www.damianclarke.net/stata/bacon_example.dta, clear
        gen t2treat = year - _nfd
        save junk, replace
        eventdd asmrs pcinc asmrh cases , timevar(t2treat) method(hdfe, absorb(stfips year) cluster(stfips)) keepdummies
        
        reghdfe asmrs pcinc asmrh cases lead* lag*,absorb(stfips year) cluster(stfips)
        testparm lag*
        global L lag0
        forv i = 1/27 {
        global L $L + lag`i'
        }
        lincom ($L)/28
        Thank you.

        1) Yes, I mean checking whether the treatment is endogenous. I don't necessraily have a particular reason, I just want to check it formally. How can I get any indication, if at all?

        2) I can run estat lags after eventdd and it works, but I wanted to know how I can find the ATT, not whether the lag coeffficients are significant.

        Comment


        • #34
          1. I don't think there's a test in this framework.
          2. The code provide in #33 will get you the average effect after treatment and test it.

          Comment


          • #35
            Originally posted by George Ford View Post
            1. I don't think there's a test in this framework.
            2. The code provide in #33 will get you the average effect after treatment and test it.
            2. Thank you! I got a significant ATT coefficient, although pvalue is 0.027 (not very significant but acceptable).
            Last edited by Luca Toni; 14 Aug 2024, 16:35.

            Comment


            • #36
              Originally posted by George Ford View Post
              1. I don't think there's a test in this framework.
              2. The code provide in #33 will get you the average effect after treatment and test it.
              Hey George Ford,

              I would like to plot the control group pre-post trends along with the treatment group. Is there any built-in command for that? what's the most effective way to code it in the staggered DiD approach?

              Comment


              • #37
                Code:
                clear all
                use http://www.damianclarke.net/stata/bacon_example.dta, clear
                gen t2treat = year - _nfd
                g treated = !mi(t2treat)
                eventdd asmrs pcinc asmrh cases , timevar(t2treat) method(hdfe, absorb(stfips year) cluster(stfips)) 
                
                lgraph asmrs year, by(treated)

                Comment


                • #38
                  Originally posted by George Ford View Post
                  Code:
                  clear all
                  use http://www.damianclarke.net/stata/bacon_example.dta, clear
                  gen t2treat = year - _nfd
                  g treated = !mi(t2treat)
                  eventdd asmrs pcinc asmrh cases , timevar(t2treat) method(hdfe, absorb(stfips year) cluster(stfips))
                  
                  lgraph asmrs year, by(treated)
                  Thanks.

                  I'm not satisfied with the plot when I use year variable. My dependent variable is volatile so that's the reason I guess:
                  Attached Files
                  Last edited by Luca Toni; 15 Aug 2024, 09:44.

                  Comment


                  • #39
                    Year makes no sense, does it. You have a lot of different "treatment" groups.

                    Look over this.

                    HTML Code:
                    https://causalinf.substack.com/p/step-3-in-pedros-diff-in-diff-checklist
                    I recommend subscribing to Scott's substack.

                    Comment


                    • #40
                      Originally posted by George Ford View Post
                      Year makes no sense, does it. You have a lot of different "treatment" groups.

                      Look over this.

                      HTML Code:
                      https://causalinf.substack.com/p/step-3-in-pedros-diff-in-diff-checklist
                      I recommend subscribing to Scott's substack.
                      I tried registering for the free trial but still can't access to this.
                      I agree that year doesn't make sense, but can I use the period? t2t gets missing values for untreated, so not sure if it's correct to plot it with the period. Or maybe I'm completely wrong and there is another approach that I'm missing out.
                      By the way, if there is another source regarding this issue, I would like to read.

                      Comment


                      • #41
                        Code:
                        clear all
                        use http://www.damianclarke.net/stata/bacon_example.dta, clear
                        gen t2treat = year - _nfd
                        g treat = t2treat>0
                        save junk, replace
                        eventdd asmrs pcinc asmrh cases , timevar(t2treat) method(hdfe, absorb(stfips year) cluster(stfips)) keepdummies
                        
                        collapse (mean) asmrs , by(_nfd year)
                        xtset _nfd year
                        xtline asmrs , ov

                        Comment


                        • #42
                          Originally posted by George Ford View Post
                          Code:
                          clear all
                          use http://www.damianclarke.net/stata/bacon_example.dta, clear
                          gen t2treat = year - _nfd
                          g treat = t2treat>0
                          save junk, replace
                          eventdd asmrs pcinc asmrh cases , timevar(t2treat) method(hdfe, absorb(stfips year) cluster(stfips)) keepdummies
                          
                          collapse (mean) asmrs , by(_nfd year)
                          xtset _nfd year
                          xtline asmrs , ov
                          After running it, I got this plot:
                          Click image for larger version

Name:	fig1.PNG
Views:	1
Size:	43.1 KB
ID:	1761675



                          Although my goal was to see how, for a given treatment year/period, the control group behaves compared to the treatment group (both in the same plot).
                          Last edited by Luca Toni; 15 Aug 2024, 13:27.

                          Comment


                          • #43
                            need to get the missings in there (the controls). I'll fiddle with it in a bit.

                            Comment


                            • #44
                              Originally posted by George Ford View Post
                              need to get the missings in there (the controls). I'll fiddle with it in a bit.
                              Ok, thanks. Please let me know if you find out.

                              Comment


                              • #45
                                Here's a sketch of something that may help guide you.

                                I create a control mean of the not-yet-treated (you could also create one of never treated), and then means for each treatment group.

                                Code:
                                clear all
                                use http://www.damianclarke.net/stata/bacon_example.dta, clear
                                gen t2treat = year - _nfd
                                
                                egen controlmean = mean(cond(t2treat<0,asmrs,.)), by(year)
                                tab _nfd
                                foreach t in 1969 1970 1971 1972 1973 1974 1975 1976 1977 1980 1984 1985 {
                                    egen treatmean`t' = mean(cond(_nfd==`t',asmrs,.)), by(year)
                                    g diffmean`t' = treatmean`t' - controlmean
                                }
                                
                                foreach t in 1969 1970 1971 1972 1973 1974 1975 1976 1977 1980 1984 1985 {
                                    twoway connected controlmean year , sort || connected treatmean`t' year , sort xline(`t') name(group`t', replace)
                                    twoway connected diffmean`t' year , sort xline(`t') name(group`t'_diff, replace)
                                }

                                Comment

                                Working...
                                X