Announcement

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

  • HELP needed please in "Difference in Difference research design"

    Hello everyone,

    I am working on my thesis and would like to check if my Diff in Diff code is correct:


    Dependent Variable: I have one dummy and one continuous.
    Independant Variable: dummy variable
    Controls: CONTROL1 and CONTROL2
    Fixed Effect: Country, Industry and Year
    Clustering: at firm level (ID)

    I used the below code for my entire sample, and I am getting non-significant results and result contradicting prior research.
    I would appreciate it if you could tell me if this code is wrong:

    * Generate panel variable
    egen panel = group(COUNTRY INDUSTRY YearEnded)

    * Set panel data structure
    xtset panel

    * Fixed effects regression with reghdfe
    reghdfe DEPVAR_DUMMY i.INDVAR_DUMMY CONTROL1 CONTROL2, absorb(YearEnded INDUSTRY COUNTRY) vce(cluster ID)
    reghdfe DEPVAR_CONT i.INDVAR_DUMMY CONTROL1 CONTROL2, absorb(YearEnded INDUSTRY COUNTRY) vce(cluster ID)

    ----------------------- copy starting from the next line -----------------------
    Code:
    * Example generated by -dataex-. For more info, type help dataex clear input str12 ID str25 COUNTRY int YearEnded float(INDVAR_DUMMY INDUSTRY DEPVAR_DUMMY DEPVAR_CONT CONTROL1 CONTROL2 panel) "AT0000A0E9W5" "AUSTRIA" 2011 1 4 0 .018158501 1.4508354e-06 -.6408805 1 "AT0000A0E9W5" "AUSTRIA" 2012 1 4 0 .010819887 1.6463787e-06 .4787839 2 "AT0000A00XX9" "AUSTRIA" 2013 1 4 0 .05179885 2.9177265e-06 -.015922926 3 "AT0000A0E9W5" "AUSTRIA" 2013 1 4 0 .15087678 3.2949536e-06 -.54731053 3 "AT0000A0E9W5" "AUSTRIA" 2014 1 4 0 .029307505 3.016278e-06 -.13406444 4 "AT0000A0E9W5" "AUSTRIA" 2015 1 4 0 .024541363 2.0785521e-06 .10426443 5 "AT0000A0E9W5" "AUSTRIA" 2016 1 4 0 .5931679 2.8788706e-06 .4271086 6 "AT0000808209" "AUSTRIA" 2016 1 5 0 .04755795 .000011926285 -.08508099 10 "AT0000A0E9W5" "AUSTRIA" 2017 1 4 0 .0381135 1.4186143e-06 .7145636 7 "AT0000946652" "AUSTRIA" 2019 1 4 0 .07355142 9.947606e-07 .03514466 8 "AT0000946652" "AUSTRIA" 2020 1 4 0 .1449236 1.0177748e-06 -.08289425 9 "GRS371113002" "GREECE" 2011 1 4 0 .008094379 4.0178547e-06 -.07783944 11 "CH0198251305" "GREECE" 2012 1 4 1 .0792848 1.0669667e-07 .06715062 12 "GRS470003013" "GREECE" 2014 1 5 1 .02390172 1.8760026e-06 -.0395707 14 "GRS260333000" "GREECE" 2015 1 5 0 .09092028 1.0553861e-07 .0004985356 15 "GRS316003003" "GREECE" 2016 1 5 0 .068146005 2.74039e-06 -.016552616 16 "GRS239003007" "GREECE" 2016 1 6 0 .02118119 3.472284e-06 -.02756531 19 "GRS371113002" "GREECE" 2017 1 4 0 .07979685 6.022467e-06 .1616823 13 "GRS316003003" "GREECE" 2017 1 5 0 .01215596 2.850361e-06 .08140419 17 "GRS239003007" "GREECE" 2017 1 6 1 .0341728 3.277052e-06 .1990406 20 "GRS239003007" "GREECE" 2019 1 6 1 .0488752 2.7273386e-06 -.1038168 21 "GRS495003006" "GREECE" 2021 1 5 0 .13253261 5.6650543e-07 .1369414 18 "AT0000A18XM4" "AUSTRIA" 2011 0 4 0 .1162596 2.56354e-06 .14337115 1 "AT0000764626" "AUSTRIA" 2012 0 4 0 .13983518 2.9506366e-06 .06047976 2 "AT0000762406" "AUSTRIA" 2013 0 4 0 .09486791 2.2260608e-06 -.16968694 3 "AT0000922554" "AUSTRIA" 2013 0 4 1 .13533801 1.7568974e-06 .24266697 3 "AT0000A00XX9" "AUSTRIA" 2014 0 4 1 .023363186 2.655334e-06 -.23707242 4 "AT0000762406" "AUSTRIA" 2015 0 4 0 .02863175 2.2083325e-06 .41082165 5 "AT0000762406" "AUSTRIA" 2016 0 4 1 .06054421 2.295456e-06 -.09278757 6 "AT00000VIE62" "AUSTRIA" 2016 0 5 1 .07729094 4.8099065e-07 .021511994 10 "AT0000785555" "AUSTRIA" 2017 0 4 0 .0987419 9.170525e-07 .14288542 7 "AT0000837307" "AUSTRIA" 2019 0 4 0 .08285154 8.395476e-07 -.1201961 8 "AT0000785555" "AUSTRIA" 2020 0 4 0 .010106214 1.268421e-06 .2317951 9 "GRS300103009" "GREECE" 2011 0 4 0 .1570957 2.975871e-06 .1953435 11 "GRS074083007" "GREECE" 2012 0 4 1 .0589695 2.3579595e-07 .019381227 12 "GRS316003003" "GREECE" 2014 0 5 0 .04671111 1.9960487e-06 -.08188433 14 "GRS496003005" "GREECE" 2015 0 5 0 .05448818 7.223308e-07 .032065466 15 "GRS513003004" "GREECE" 2016 0 5 0 .036939748 2.79546e-06 -.033706553 16 "GRS096003009" "GREECE" 2016 0 6 0 .032032546 2.1950693e-06 -.00739915 19 "GRS074083007" "GREECE" 2017 0 4 0 .07480128 3.400548e-07 .07312657 13 "GRS470003013" "GREECE" 2017 0 5 0 .06763208 2.629779e-06 .08179094 17 "GRS096003009" "GREECE" 2017 0 6 0 .032597233 2.2640754e-06 .1620873 20 "GRS403003007" "GREECE" 2019 0 6 0 .0821615 1.7852096e-06 .02309672 21 "GRS359353000" "GREECE" 2021 0 5 0 .00430444 5.049148e-07 .032421682 18 end
    ------------------ copy up to and including the previous line ------------------

    Listed 44 out of 44 observations

  • #2
    where are the variables for the treatment group and treatment period?

    also, not good to dichotomize a continuous variable unless you've got good reason.

    g

    Comment


    • #3
      Maysam:
      you have already posted this query (with replies) at: Diff in Diff for a matched sample - Statalist.
      If those replies are not helpful (and -xtdidregress- does not help out either), I would think of how to make your question more informative. Thanks.
      Kind regards,
      Carlo
      (Stata 19.0)

      Comment


      • #4
        Dear Carlo and Goerge,

        I hope you can help me with this. My problem is that I need to know how to convert my dataset in a way that I can apply DID method.
        I am giving an example below where I want to assess the impact of Office Change (Dummy Variable) on Accruals (Continuous):
        Company ID OFFICE_CHG Year Industry Accruals Control Variable Country
        ABC 1 2010 Finance 0.1 100 UK
        DEF 1 2011 Finance 0.3 125 UK
        GHI 1 2012 Finance 0.6 900 UK
        XYZ 0 2010 Finance 0.4 265 UK
        PQR 0 2011 Finance 0.5 800 UK
        JKL 0 2012 Finance 0.7 523 UK
        QWE 1 2010 Manufacturing 0.4 973 US
        RTY 1 2011 Manufacturing 0.8 936 US
        UIO 1 2012 Manufacturing 0.5 287 US
        ASD 0 2010 Manufacturing 0.3 342 US
        FGH 0 2011 Manufacturing 0.2 687 US
        JKL 0 2012 Manufacturing 0.8 758 US
        For each instance of office change in a specific year and industry and country, I have matched it with a non office change situation but I am not knowing how to convert the layout of the dataset.



        ----------------------- copy starting from the next line -----------------------
        Code:
        * Example generated by -dataex-. For more info, type help dataex
        clear
        input str3 CompanyID byte OFFICE_CHG int Year str13 Industry double Accruals int ControlVariable str2 Country
        "ABC" 1 2010 "Finance"       .1 100 "UK"
        "DEF" 1 2011 "Finance"       .3 125 "UK"
        "GHI" 1 2012 "Finance"       .6 900 "UK"
        "XYZ" 0 2010 "Finance"       .4 265 "UK"
        "PQR" 0 2011 "Finance"       .5 800 "UK"
        "JKL" 0 2012 "Finance"       .7 523 "UK"
        "QWE" 1 2010 "Manufacturing" .4 973 "US"
        "RTY" 1 2011 "Manufacturing" .8 936 "US"
        "UIO" 1 2012 "Manufacturing" .5 287 "US"
        "ASD" 0 2010 "Manufacturing" .3 342 "US"
        "FGH" 0 2011 "Manufacturing" .2 687 "US"
        "JKL" 0 2012 "Manufacturing" .8 758 "US"
        end
        ------------------ copy up to and including the previous line ------------------

        Listed 12 out of 12 observations


        Thank you in advance

        Comment


        • #5
          For DID, you need a period (periods) where all units are untreated and a period (period) where some units are treated.

          This data looks like a a company is either treated or not, always.

          Comment

          Working...
          X