Announcement

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

  • Unfortunately not. I didnt really like that design, so I changed it to something different.

    Comment


    • Originally posted by FernandoRios View Post
      Hi Samuel
      you have a very good question. And, to be honest, I had similar questions before I started digging deeper into the method (and of course writing the command).

      So 1) why are the results different?
      because by adding "countryreal" as explicit control, you are violating the overlapping assumption.

      2) how can you add lpop in the model?
      Because drdid and csdid are essentially adding lpop interacted with a time variable. Which is not colinear with individual FE

      Specifically, for panel data, you are modelling
      DY = b0 + b1 x+ e at T=0

      This basically imposes the assumption that the change in the outcome should depend only on "base period/earlier period" characteristics. Not characteristics that COULD have been after by the treatment (post period)

      HTH
      F






      Dear @FernandoRios , do you mean when I add time-invariant covariate X_i, it actually enters the estimation as X_i*time, or does it enter the estimation as X_i# !.time ?

      Comment


      • It’s something like that
        doesn really add the interactions as controls
        instead estimates the attgts using small subsamples.
        So instead of doing something like
        reg y x##i.time
        it would do
        reg y x if time==x
        Last edited by FernandoRios; 13 Jul 2023, 07:04.

        Comment


        • I am unable to find a way to get coefficients for control variables in csdid. We only get treatment effects in the standard csdid command. How are other control variables impacting y variable is not known.

          Comment


          • Hello,
            Hope all is well.

            I am currently using 'DRDID' in Stata 18. Every time I run the code, it gives me different results. I have household level data and the treatment is at the household level.

            I would very much appreciate any recommendation on how to solve this and I apologize if this is not the correct way to post a question (this is my first time).

            Thanks in advance!

            The code I am running:

            set seed 1234

            drdid mcs age east educ income, ivar(id) time(post) tr(treated) reg cluster(hid)

            **output from running the code first time

            Click image for larger version

Name:	DrDiD1.png
Views:	1
Size:	159.4 KB
ID:	1721924



            **output from running the code second time


            Click image for larger version

Name:	DrDiD2.png
Views:	1
Size:	172.6 KB
ID:	1721925

            Comment


            • could you share the data?
              I havent encounter that problem before, so perhaps something is going on behind
              F

              Comment


              • Hi Fernando

                How do I choose a reference period other than the period immediately before the treatment?

                Following the paper's notation, I would like to choose a positive \delta in my setting

                Thank you

                Comment


                • Hello @FernandoRios. Thank you for you quick response. I only saw it now. I am using restricted data, so I added below the output from 'dataex' for some variables. I am not sure if it is enough.



                  ----------------------- copy starting from the next line -----------------------
                  [CODE]
                  * Example generated by -dataex-. For more info, type help dataex
                  clear
                  input byte mcs float(age east educ income post treated)
                  7 51 0 0 13.2 0 0
                  7 52 0 0 21.6 0 0
                  8 53 0 0 20.4 0 0
                  7 54 0 0 20.4 1 0
                  8 55 0 0 20.4 1 0
                  5 57 0 1 30 0 0
                  9 58 0 1 31.2 0 0
                  7 59 0 1 31.2 0 0
                  6 60 0 1 31.2 1 0
                  7 61 0 1 31.2 1 0
                  7 49 0 1 4.8 0 1
                  8 50 0 1 4.8 0 1
                  8 51 0 1 5.04 0 1
                  8 52 0 1 5.04 1 1
                  9 53 0 1 5.04 1 1
                  8 49 0 1 19.836 0 0
                  9 50 0 1 20.928 0 0
                  8 51 0 1 26.4 0 0
                  9 52 0 1 26.4 1 0
                  8 53 0 1 26.4 1 0
                  8 55 0 0 31.2 0 0
                  8 56 0 0 31.2 0 0
                  8 57 0 0 32.88 0 0
                  8 58 0 0 32.88 1 0
                  8 59 0 0 32.88 1 0
                  6 59 0 0 42.744 0 0
                  7 60 0 0 43.332 0 0
                  7 61 0 0 42.408 0 0
                  7 62 0 0 42.408 1 0
                  8 63 0 0 42.408 1 0
                  5 50 0 0 20.352 0 0
                  3 51 0 0 22.596 0 0
                  4 52 0 0 10.056 0 0
                  6 53 0 0 10.056 1 0
                  7 54 0 0 10.056 1 0
                  7 57 0 1 42 0 0
                  7 58 0 1 42 0 0
                  7 59 0 1 42 0 0
                  8 60 0 1 42 1 0
                  8 61 0 1 42 1 0
                  5 52 0 0 52.2 0 0
                  8 53 0 0 52.2 0 0
                  10 54 0 0 52.2 0 0
                  2 55 0 0 52.2 1 0
                  2 56 0 0 52.2 1 0
                  8 56 0 1 3.6 0 1
                  7 57 0 1 3 0 1
                  8 58 0 1 3.84 0 1
                  8 59 0 1 3.84 1 1
                  9 60 0 1 3.84 1 1
                  6 54 0 1 29.76 0 0
                  6 55 0 1 30.792 0 0
                  8 56 0 1 29.76 0 0
                  5 57 0 1 29.76 1 0
                  6 58 0 1 29.76 1 0
                  9 51 0 1 42 0 0
                  9 52 0 1 43.2 0 0
                  8 53 0 1 43.8 0 0
                  7 54 0 1 43.8 1 0
                  9 55 0 1 43.8 1 0
                  7 60 0 1 37.08 0 0
                  8 61 0 1 34.8 0 0
                  7 62 0 1 40.2 0 0
                  7 63 0 1 40.2 1 0
                  7 64 0 1 40.2 1 0
                  6 55 0 0 4.788 0 1
                  4 56 0 0 4.788 0 1
                  6 57 0 0 4.8 0 1
                  8 58 0 0 4.8 1 1
                  7 59 0 0 4.8 1 1
                  10 62 0 0 24 0 0
                  9 63 0 0 24 0 0
                  9 64 0 0 29.4 0 0
                  9 65 0 0 29.4 1 0
                  9 66 0 0 29.4 1 0
                  8 45 0 1 21.6 0 0
                  8 46 0 1 19.2 0 0
                  8 47 0 1 25.2 0 0
                  8 48 0 1 25.2 1 0
                  8 49 0 1 25.2 1 0
                  7 50 0 1 4.8 0 1
                  8 51 0 1 4.8 0 1
                  8 52 0 1 4.8 0 1
                  9 53 0 1 4.8 1 1
                  9 54 0 1 4.8 1 1
                  6 53 0 1 6 0 0
                  6 54 0 1 6.24 0 0
                  8 55 0 1 6.24 0 0
                  7 56 0 1 6.24 1 0
                  7 57 0 1 6.24 1 0
                  9 53 0 1 21.6 0 1
                  8 54 0 1 16.2 0 1
                  8 55 0 1 16.32 0 1
                  8 56 0 1 16.32 1 1
                  8 57 0 1 16.32 1 1
                  7 54 0 1 12.936 0 0
                  8 55 0 1 12.636 0 0
                  8 56 0 1 12.936 0 0
                  8 57 0 1 12.936 1 0
                  8 58 0 1 12.936 1 0
                  end

                  ------------------ copy up to and including the previous line ------------------

                  Comment


                  • Is there anyway you could get a mock copy of your data
                    for example I do t need the outcome just a random variable will suffice
                    what I do need are the ivar (you can recode it) your cluster var (also recoded) and your treatment and time variable
                    Without that I can’t really do much to understand the problem.

                    another basic point tho. Do you have the latest version of drdid?
                    thank you

                    Comment


                    • Hello FernandoRios. When I ask stata which drdid, I get "*! Ver 1.71 bug with weights". Also, when i try ssc install drdid, I get that all files already exist and are up to date. I should mention that I have a strongly balanced panel data with 5,405 observations in total.


                      I get the below when I type dataex for the ivar (id), cluster var (hid) and treatment (treated) and time variable(post). Thank you again so much!


                      ----------------------- copy starting from the next line -----------------------
                      Code:
                      * Example generated by -dataex-. For more info, type help dataex
                      clear
                      input long(id hid) float(treated post)
                       1  12 0 0
                       1  12 0 0
                       1  12 0 0
                       1  12 0 1
                       1  12 0 1
                       2  21 0 0
                       2  21 0 0
                       2  21 0 0
                       2  21 0 1
                       2  21 0 1
                       3  31 1 0
                       3  31 1 0
                       3  31 1 0
                       3  31 1 1
                       3  31 1 1
                       4  41 0 0
                       4  41 0 0
                       4  41 0 0
                       4  41 0 1
                       4  41 0 1
                       5  51 0 0
                       5  51 0 0
                       5  51 0 0
                       5  51 0 1
                       5  51 0 1
                       6  61 0 0
                       6  61 0 0
                       6  61 0 0
                       6  61 0 1
                       6  61 0 1
                       7  71 0 0
                       7  71 0 0
                       7  71 0 0
                       7  71 0 1
                       7  71 0 1
                      
                      end
                      ------------------ copy up to and including the previous line ------------------
                      Last edited by aline zd; 27 Jul 2023, 08:14.

                      Comment


                      • Thank you
                        But this won't be enough to figure out the bug. If you could create a replicable example that reflects the problem, I can look at it and see what may be causing it (its not evident from your description).
                        Also, please send it to [email protected]
                        F

                        Comment


                        • Thank you aline zd
                          For anyone curious. Aline found a bug.
                          DRDID should deal with cases where there are only two periods and two groups. Thus all units should be observed only 2 times.
                          In the design and data, each id was observed 5 times (panel data over 5 periods) which was affecting how the data was transfer to Mata, thus affecting the results.
                          I will add a clause to avoid this problem in a future update.
                          Thank you

                          Comment


                          • Thanks again for your help FernandoRios .

                            Comment


                            • Dear FernandoRios , First of all heartiest thanks for creating such a useful code especially for a novice researcher like me. However, I am unable to use the code. It may be primarily due to mistake in setting up the data properly. I have attached the data for your reference. My main outcome/dependent variable is DepVar. Key independent variable is IndVar and COV1, COV2 are other independent variables/controls. Main time variable id is Date and the firm level id is GVKey. The dummy variable SCAP takes the value of '1' if a State has implemented a certain law (treatment), else it takes a value of '0' if it never implemented such a law in the sample time-period. The variable SCAP_Date shows the dates on which the law was implemented by a particular State (different dates for different states), else it takes the value of '0' if the law was never implemented. I have another dummy variable POST_SCAP which takes the value of '1' only after a state has implemented the law else it remains 0.

                              My objective is to understand if the relation between the DepVar and IndVar holds only for the firms which are headquartered in the States after they have adopted the law (i.e. only when the POSTSCAP = 1).

                              I am using the below code -

                              " csdid DepVar IndVar COV1 COV2, ivar(GVKey) time(Date) gvar(SCAP_Date) notyet method(ipw) "


                              But getting the attached output. Could you please help me out in setting up the variable and running this code properly? It would be of immense help to me.
                              Attached Files
                              Last edited by Saurabh Trivedi; 08 Aug 2023, 00:39.

                              Comment


                              • Did you make sure you also installed drdid?
                                if so
                                can you show a tab between time and gvar?
                                thanks

                                Comment

                                Working...
                                X