Announcement

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

  • Using DID on an effect of a variable

    Hi all,

    I have a question regarding DID analysis.

    My original research involved a relatively simple multiple regression to see the effect of the distance to a landfill on nearby property prices.
    However, I have been suggested to perform a DID analysis as during the time period of my research, a policy change occurred.

    Thus now, I am looking to change my research question to see if the treatment (policy change) causes a change to the effect of the distance to a landfill on property prices.
    If my current data includes various characteristics of the apartment including distance to the landfill (distance), property prices (price), how would I incorporate this into my DID regression? As in, what would be my outcome variable?

    After looking at the didregress manual, I have a hunch that I should use something like

    didregress (price distance) (treatment), group (neighbourhood) time(year)

    However, I am worried that my hunch is completely off, and was hoping to get some guidance or confirmation that I am heading towards the right direction.



    Thank you in advance for any help on this matter!

  • #2
    Type in
    Code:
    dataex, count(300)
    And post back what Stata gives you. Welcome to Statalist.

    Comment


    • #3
      Hi Jared,

      Thank you for welcoming me! These are my results.

      Code:
      * Example generated by -dataex-. For more info, type help dataex
      clear
      input double area1 byte floor float(building brand total rooms parkingper park school subway totalfloors royal hospital mart entrance supportq price year group distance treatment)
        84.554 13 13 0  743 4  1.2 671  289 3500 15 1 4200 3200 1  36000 22000 2019 10  3677.007 1
        84.945 14 13 0  743 3  1.2 671  289 3500 15 1 4200 3200 1  36000 20700 2019 10  3677.007 1
        84.554 10 13 0  743 4  1.2 671  289 3500 15 0 4200 3200 1  36000 22000 2019 10  3677.007 1
        84.813  3 13 0  743 3  1.2 671  289 3500 15 0 4200 3200 1  36000 25000 2019 10  3677.007 1
        84.945 11 13 0  743 3  1.2 671  289 3500 15 0 4200 3200 1  36000 20000 2019 10  3677.007 1
        84.607  7 13 0  743 3  1.2 671  289 3500 15 0 4200 3200 1  36000 22200 2019 10  3677.007 1
        84.753 11 13 0  743 3  1.2 671  289 3500 15 0 4200 3200 1  36000 21000 2019 10  3677.007 1
        84.813  2 13 0  743 3  1.2 671  289 3500 15 0 4200 3200 1  36000 19800 2019 10  3677.007 1
        84.554  5 13 0  743 4  1.2 671  289 3500 15 0 4200 3200 1  36000 21000 2019 10  3677.007 1
        84.813  6 13 0  743 3  1.2 671  289 3500 15 0 4200 3200 1  36000 23000 2019 10  3677.007 1
        84.753  7 13 0  743 3  1.2 671  289 3500 15 0 4200 3200 1  36000 21800 2019 10  3677.007 1
        84.813  4 13 0  743 3  1.2 671  289 3500 15 0 4200 3200 1  36000 20500 2019 10  3677.007 1
        84.607 14 13 0  743 3  1.2 671  289 3500 15 1 4200 3200 1  36000 22500 2019 10  3677.007 1
        84.554  5 13 0  743 4  1.2 671  289 3500 15 0 4200 3200 1  36000 22200 2019 10  3677.007 1
        84.753 14 13 0  743 3  1.2 671  289 3500 15 1 4200 3200 1  36000 20800 2019 10  3677.007 1
        84.945 13 13 0  743 3  1.2 671  289 3500 15 1 4200 3200 1  36000 20400 2019 10  3677.007 1
        84.813  9 13 0  743 3  1.2 671  289 3500 15 0 4200 3200 1  36000 21700 2019 10  3677.007 1
        84.607  9 13 0  743 3  1.2 671  289 3500 15 0 4200 3200 1  36000 21750 2019 10  3677.007 1
        84.753  8 13 0  743 3  1.2 671  289 3500 15 0 4200 3200 1  36000 21000 2019 10  3677.007 1
        84.554 14 13 0  743 4  1.2 671  289 3500 15 1 4200 3200 1  36000 21500 2019 10  3677.007 1
        84.945 14 13 0  743 3  1.2 671  289 3500 15 1 4200 3200 1  36000 21200 2019 10  3677.007 1
        84.554  4 13 0  743 4  1.2 671  289 3500 15 0 4200 3200 1  36000 20800 2019 10  3677.007 1
        84.945  6 13 0  743 3  1.2 671  289 3500 15 0 4200 3200 1  36000 22000 2019 10  3677.007 1
        84.753  4 13 0  743 3  1.2 671  289 3500 15 0 4200 3200 1  36000 19900 2019 10  3677.007 1
        84.554 10 13 0  743 4  1.2 671  289 3500 15 0 4200 3200 1  36000 22000 2019 10  3677.007 1
        84.753  9 13 0  743 3  1.2 671  289 3500 15 0 4200 3200 1  36000 21000 2019 10  3677.007 1
        84.607  2 13 0  743 3  1.2 671  289 3500 15 0 4200 3200 1  36000 19800 2019 10  3677.007 1
        84.554 15 13 0  743 4  1.2 671  289 3500 15 1 4200 3200 1  36000 25000 2019 10  3677.007 1
        84.753  7 13 0  743 3  1.2 671  289 3500 15 0 4200 3200 1  36000 20900 2019 10  3677.007 1
        84.753  8 13 0  743 3  1.2 671  289 3500 15 0 4200 3200 1  36000 20800 2019 10  3677.007 1
        84.813 10 13 0  743 3  1.2 671  289 3500 15 0 4200 3200 1  36000 22700 2019 10  3677.007 1
        84.813  3 13 0  743 3  1.2 671  289 3500 15 0 4200 3200 1  36000 20500 2019 10  3677.007 1
        84.945  9 13 0  743 3  1.2 671  289 3500 15 0 4200 3200 1  36000 20000 2019 10  3677.007 1
        84.945 12 13 0  743 3  1.2 671  289 3500 15 1 4200 3200 1  36000 22000 2019 10  3677.007 1
        84.945  5 13 0  743 3  1.2 671  289 3500 15 0 4200 3200 1  36000 20300 2019 10  3677.007 1
        84.813  3 13 0  743 3  1.2 671  289 3500 15 0 4200 3200 1  36000 21000 2019 10  3677.007 1
        84.607 10 13 0  743 3  1.2 671  289 3500 15 0 4200 3200 1  36000 21600 2019 10  3677.007 1
        84.813 12 13 0  743 3  1.2 671  289 3500 15 1 4200 3200 1  36000 21500 2019 10  3677.007 1
        84.945  7 13 0  743 3  1.2 671  289 3500 15 0 4200 3200 1  36000 20200 2019 10  3677.007 1
        84.753 12 13 0  743 3  1.2 671  289 3500 15 1 4200 3200 1 142700 22300 2018 10  3677.007 0
        84.753 10 13 0  743 3  1.2 671  289 3500 15 0 4200 3200 1 142700 22000 2018 10  3677.007 0
        84.753  7 13 0  743 3  1.2 671  289 3500 15 0 4200 3200 1 142700 22500 2018 10  3677.007 0
        84.813 10 13 0  743 3  1.2 671  289 3500 15 0 4200 3200 1 142700 23500 2018 10  3677.007 0
        84.945  1 13 0  743 3  1.2 671  289 3500 15 0 4200 3200 1 142700 20800 2018 10  3677.007 0
        84.813  3 13 0  743 3  1.2 671  289 3500 15 0 4200 3200 1 142700 23500 2018 10  3677.007 0
        84.753 12 13 0  743 3  1.2 671  289 3500 15 1 4200 3200 1 142700 22900 2018 10  3677.007 0
        84.607 11 13 0  743 3  1.2 671  289 3500 15 0 4200 3200 1 142700 22600 2018 10  3677.007 0
        84.813 14 13 0  743 3  1.2 671  289 3500 15 1 4200 3200 1 142700 22000 2018 10  3677.007 0
        84.753  5 13 0  743 3  1.2 671  289 3500 15 0 4200 3200 1 142700 22000 2018 10  3677.007 0
        84.753 14 13 0  743 3  1.2 671  289 3500 15 1 4200 3200 1 142700 22000 2018 10  3677.007 0
        84.813 12 13 0  743 3  1.2 671  289 3500 15 1 4200 3200 1 142700 22500 2018 10  3677.007 0
        84.813  6 13 0  743 3  1.2 671  289 3500 15 0 4200 3200 1 142700 22300 2018 10  3677.007 0
        84.554  6 13 0  743 4  1.2 671  289 3500 15 0 4200 3200 1 142700 22700 2018 10  3677.007 0
        84.813  4 13 0  743 3  1.2 671  289 3500 15 0 4200 3200 1 142700 23000 2018 10  3677.007 0
        84.753  4 13 0  743 3  1.2 671  289 3500 15 0 4200 3200 1 142700 22500 2018 10  3677.007 0
        84.813 11 13 0  743 3  1.2 671  289 3500 15 0 4200 3200 1 142700 21000 2018 10  3677.007 0
        84.753  5 13 0  743 3  1.2 671  289 3500 15 0 4200 3200 1 142700 21900 2018 10  3677.007 0
        84.753  8 13 0  743 3  1.2 671  289 3500 15 0 4200 3200 1 142700 21100 2018 10  3677.007 0
        84.554 11 13 0  743 4  1.2 671  289 3500 15 0 4200 3200 1 142700 23000 2018 10  3677.007 0
        84.813  1 13 0  743 3  1.2 671  289 3500 15 0 4200 3200 1 142700 21500 2018 10  3677.007 0
        84.753 13 13 0  743 3  1.2 671  289 3500 15 1 4200 3200 1 142700 21000 2018 10  3677.007 0
        84.607  4 13 0  743 3  1.2 671  289 3500 15 0 4200 3200 1 142700 21000 2018 10  3677.007 0
        84.554  9 13 0  743 4  1.2 671  289 3500 15 0 4200 3200 1 142700 22300 2018 10  3677.007 0
        84.607 12 13 0  743 3  1.2 671  289 3500 15 1 4200 3200 1 142700 23000 2018 10  3677.007 0
        84.607  9 13 0  743 3  1.2 671  289 3500 15 0 4200 3200 1 142700 21000 2018 10  3677.007 0
        84.945  8 13 0  743 3  1.2 671  289 3500 15 0 4200 3200 1 142700 21200 2018 10  3677.007 0
        84.945 10 13 0  743 3  1.2 671  289 3500 15 0 4200 3200 1 142700 21300 2018 10  3677.007 0
        84.607 12 13 0  743 3  1.2 671  289 3500 15 1 4200 3200 1 142700 21900 2018 10  3677.007 0
        84.813  8 13 0  743 3  1.2 671  289 3500 15 0 4200 3200 1 142700 22800 2018 10  3677.007 0
        84.813  3 13 0  743 3  1.2 671  289 3500 15 0 4200 3200 1 142700 20000 2018 10  3677.007 0
        84.554 15 13 0  743 4  1.2 671  289 3500 15 1 4200 3200 1 142700 24050 2018 10  3677.007 0
        84.753 15 13 0  743 3  1.2 671  289 3500 15 1 4200 3200 1 142700 24600 2018 10  3677.007 0
        84.813  8 13 0  743 3  1.2 671  289 3500 15 0 4200 3200 1 142700 21500 2018 10  3677.007 0
        84.554  9 13 0  743 4  1.2 671  289 3500 15 0 4200 3200 1 142700 21600 2018 10  3677.007 0
        84.753  3 13 0  743 3  1.2 671  289 3500 15 0 4200 3200 1 142700 20000 2018 10  3677.007 0
        84.607  9 13 0  743 3  1.2 671  289 3500 15 0 4200 3200 1 142700 22700 2018 10  3677.007 0
        84.753  7 13 0  743 3  1.2 671  289 3500 15 0 4200 3200 1 142700 20600 2018 10  3677.007 0
        84.813  7 13 0  743 3  1.2 671  289 3500 15 0 4200 3200 1 142700 22000 2018 10  3677.007 0
        84.554  3 13 0  743 4  1.2 671  289 3500 15 0 4200 3200 1 142700 20000 2018 10  3677.007 0
        84.813  9 13 0  743 3  1.2 671  289 3500 15 0 4200 3200 1 142700 21500 2018 10  3677.007 0
        84.753 15 13 0  743 3  1.2 671  289 3500 15 1 4200 3200 1 142700 23800 2018 10  3677.007 0
        84.753  8 13 0  743 3  1.2 671  289 3500 15 0 4200 3200 1 142700 22250 2018 10  3677.007 0
        84.753  5 13 0  743 3  1.2 671  289 3500 15 0 4200 3200 1 142700 21700 2018 10  3677.007 0
        84.554  8 13 0  743 4  1.2 671  289 3500 15 0 4200 3200 1 142700 22500 2018 10  3677.007 0
        84.945 13 13 0  743 3  1.2 671  289 3500 15 1 4200 3200 1 142700 21000 2018 10  3677.007 0
        84.813  8 13 0  743 3  1.2 671  289 3500 15 0 4200 3200 1 142700 21500 2018 10  3677.007 0
        84.554 11 13 0  743 4  1.2 671  289 3500 15 0 4200 3200 1 142700 21500 2018 10  3677.007 0
       84.9831  2  5 1  348 3 1.37 494  280  864 20 0 2100  391 1 347600 25000 2018  7 2222.7983 0
      136.1121  4  5 1  348 4 1.37 494  280  864 20 0 2100  391 1 347600 31600 2018  7 2222.7983 0
       84.9831 12  5 1  348 3 1.37 494  280  864 20 0 2100  391 1 347600 27500 2018  7 2222.7983 0
       105.472 18  5 1  348 3 1.37 494  280  864 20 1 2100  391 1 347600 29000 2018  7 2222.7983 0
      136.1121  2  5 1  348 4 1.37 494  280  864 20 0 2100  391 1 347600 31000 2018  7 2222.7983 0
       84.9831  3  5 1  348 3 1.37 494  280  864 20 0 2100  391 1 347600 26500 2018  7 2222.7983 0
      104.7238 18  5 1  348 3 1.37 494  280  864 20 1 2100  391 1 347600 28900 2018  7 2222.7983 0
      104.7238 10  5 1  348 3 1.37 494  280  864 20 0 2100  391 1 347600 27500 2018  7 2222.7983 0
      135.6362 18  5 1  348 4 1.37 494  280  864 20 1 2100  391 1 347600 32000 2018  7 2222.7983 0
      136.1121 19  5 1  348 4 1.37 494  280  864 20 1 2100  391 1 347600 33000 2018  7 2222.7983 0
      135.6362 14  5 1  348 4 1.37 494  280  864 20 0 2100  391 1 347600 33500 2018  7 2222.7983 0
      104.7238  7  5 1  348 3 1.37 494  280  864 20 0 2100  391 1 347600 28300 2018  7 2222.7983 0
      104.7238 12  5 1  348 3 1.37 494  280  864 20 0 2100  391 1 347600 28900 2018  7 2222.7983 0
      136.1121 13  5 1  348 4 1.37 494  280  864 20 0 2100  391 1 347600 36000 2018  7 2222.7983 0
       84.9098 11  5 1  348 3 1.37 494  280  864 20 0 2100  391 1 347600 27300 2018  7 2222.7983 0
       105.472 17  5 1  348 3 1.37 494  280  864 20 1 2100  391 1 347600 29500 2018  7 2222.7983 0
      135.6362  4  5 1  348 4 1.37 494  280  864 20 0 2100  391 1 347600 32800 2018  7 2222.7983 0
       84.8531  4  5 1  348 3 1.37 494  280  864 20 0 2100  391 1 347600 25700 2018  7 2222.7983 0
       84.9831  8  4 1  303 3 1.54 494  280  864 20 0 2100  391 1 347600 28500 2018  7 2180.9153 0
       84.9831 18  4 1  303 3 1.54 494  280  864 20 1 2100  391 1 347600 27500 2018  7 2180.9153 0
       105.472  3  4 1  303 3 1.54 494  280  864 20 0 2100  391 1 347600 27700 2018  7 2180.9153 0
       84.9831 20  4 1  303 3 1.54 494  280  864 20 1 2100  391 1 347600 27000 2018  7 2180.9153 0
      104.7238  4  4 1  303 3 1.54 494  280  864 20 0 2100  391 1 347600 27600 2018  7 2180.9153 0
       84.9831  8  4 1  303 3 1.54 494  280  864 20 0 2100  391 1 347600 23000 2018  7 2180.9153 0
      104.7238 16  4 1  303 3 1.54 494  280  864 20 1 2100  391 1 347600 29000 2018  7 2180.9153 0
       84.9098 12  4 1  303 3 1.54 494  280  864 20 0 2100  391 1 347600 27000 2018  7 2180.9153 0
       84.9831 12  4 1  303 3 1.54 494  280  864 20 0 2100  391 1 347600 26800 2018  7 2180.9153 0
      136.1121 20  4 1  303 4 1.54 494  280  864 20 1 2100  391 1 347600 35000 2018  7 2180.9153 0
       84.9831 16  4 1  303 3 1.54 494  280  864 20 1 2100  391 1 347600 27100 2018  7 2180.9153 0
       105.472 14  4 1  303 3 1.54 494  280  864 20 0 2100  391 1 347600 29800 2018  7 2180.9153 0
      104.7238 14  4 1  303 3 1.54 494  280  864 20 0 2100  391 1 347600 29400 2018  7 2180.9153 0
         84.62  5  3 0  207 3 1.09 376  380 1200 20 0 2200  624 1 347600 21000 2018  7 2289.9854 0
          84.6  9  3 0  207 3 1.09 376  380 1200 20 0 2200  624 1 347600 21700 2018  7 2289.9854 0
          84.6 16  3 0  207 3 1.09 376  380 1200 20 1 2200  624 1 347600 23000 2018  7 2289.9854 0
         84.62 14  3 0  207 3 1.09 376  380 1200 20 0 2200  624 1 347600 22400 2018  7 2289.9854 0
         84.62  5  3 0  207 3 1.09 376  380 1200 20 0 2200  624 1 347600 22000 2018  7 2289.9854 0
         84.62  9  3 0  207 3 1.09 376  380 1200 20 0 2200  624 1 347600 23100 2018  7 2289.9854 0
         84.98  6  3 0  207 3 1.09 376  380 1200 20 0 2200  624 1 347600 21000 2018  7 2289.9854 0
         84.98  5  3 0  207 3 1.09 376  380 1200 20 0 2200  624 1 347600 21450 2018  7 2289.9854 0
          84.6 13  3 0  207 3 1.09 376  380 1200 20 0 2200  624 1 347600 21700 2018  7 2289.9854 0
          84.6 14  3 0  207 3 1.09 376  380 1200 20 0 2200  624 1 347600 21500 2018  7 2289.9854 0
         84.98  3  3 0  207 3 1.09 376  380 1200 20 0 2200  624 1 347600 23000 2018  7 2289.9854 0
        84.809  9  6 1  418 3  1.3 375  184  562 15 0 1900  210 1 308200 27000 2018  9 1924.0406 0
       123.541  7  6 1  418 4  1.3 375  184  562 15 0 1900  210 1 308200 34500 2018  9 1924.0406 0
        84.341 11  6 1  418 3  1.3 375  184  562 15 0 1900  210 1 308200 26850 2018  9 1924.0406 0
        84.743  5  6 1  418 3  1.3 375  184  562 15 0 1900  210 1 308200 25900 2018  9 1924.0406 0
        84.743 10  6 1  418 3  1.3 375  184  562 15 0 1900  210 1 308200 26950 2018  9 1924.0406 0
        84.341  2  6 1  418 3  1.3 375  184  562 15 0 1900  210 1 308200 25500 2018  9 1924.0406 0
        84.743 11  6 1  418 3  1.3 375  184  562 15 0 1900  210 1 308200 27100 2018  9 1924.0406 0
        84.341 14  6 1  418 3  1.3 375  184  562 15 1 1900  210 1 308200 27800 2018  9 1924.0406 0
        84.341  1  6 1  418 3  1.3 375  184  562 15 0 1900  210 1 308200 25800 2018  9 1924.0406 0
       123.512 14  6 1  418 4  1.3 375  184  562 15 1 1900  210 1 308200 35000 2018  9 1924.0406 0
        84.743  6  6 1  418 3  1.3 375  184  562 15 0 1900  210 1 308200 26000 2018  9 1924.0406 0
        84.341 12  6 1  418 3  1.3 375  184  562 15 1 1900  210 1 308200 25000 2018  9 1924.0406 0
        84.743 12  6 1  418 3  1.3 375  184  562 15 1 1900  210 1 308200 25900 2018  9 1924.0406 0
        84.341 11  6 1  418 3  1.3 375  184  562 15 0 1900  210 1 308200 26700 2018  9 1924.0406 0
        84.341  4  6 1  418 3  1.3 375  184  562 15 0 1900  210 1 308200 25000 2018  9 1924.0406 0
        84.743  4  6 1  418 3  1.3 375  184  562 15 0 1900  210 1 308200 26000 2018  9 1924.0406 0
        84.341 15  6 1  418 3  1.3 375  184  562 15 1 1900  210 1 308200 31200 2018  9 1924.0406 0
        84.809 11  6 1  418 3  1.3 375  184  562 15 0 1900  210 1 308200 26800 2018  9 1924.0406 0
       123.541 12  6 1  418 4  1.3 375  184  562 15 1 1900  210 1 308200 33700 2018  9 1924.0406 0
       123.541  4  6 1  418 4  1.3 375  184  562 15 0 1900  210 1 308200 33000 2018  9 1924.0406 0
        84.341 10  6 1  418 3  1.3 375  184  562 15 0 1900  210 1 308200 26500 2018  9 1924.0406 0
        84.341  6  6 1  418 3  1.3 375  184  562 15 0 1900  210 1 308200 26700 2018  9 1924.0406 0
        84.809 10  6 1  418 3  1.3 375  184  562 15 0 1900  210 1 308200 27800 2018  9 1924.0406 0
       123.541  1  6 1  418 4  1.3 375  184  562 15 0 1900  210 1 308200 32700 2018  9 1924.0406 0
        84.809  3  6 1  418 3  1.3 375  184  562 15 0 1900  210 1 308200 25500 2018  9 1924.0406 0
        84.809  2  6 1  418 3  1.3 375  184  562 15 0 1900  210 1 308200 23600 2018  9 1924.0406 0
        84.743  1  6 1  418 3  1.3 375  184  562 15 0 1900  210 1 308200 24850 2018  9 1924.0406 0
        84.341  8  6 1  418 3  1.3 375  184  562 15 0 1900  210 1 308200 27000 2018  9 1924.0406 0
        84.809 10  7 1  413 3  1.3 267  467  347 15 0 1800  333 1 308200 26300 2018  9 2042.7905 0
        84.809  8  7 1  413 3  1.3 267  467  347 15 0 1800  333 1 308200 26250 2018  9 2042.7905 0
        84.743  5  7 1  413 3  1.3 267  467  347 15 0 1800  333 1 308200 25000 2018  9 2042.7905 0
        123.19  4  7 1  413 4  1.3 267  467  347 15 0 1800  333 1 308200 37000 2018  9 2042.7905 0
        84.743 12  7 1  413 3  1.3 267  467  347 15 1 1800  333 1 308200 27400 2018  9 2042.7905 0
       123.541  2  7 1  413 4  1.3 267  467  347 15 0 1800  333 1 308200 33000 2018  9 2042.7905 0
        84.743  5  7 1  413 3  1.3 267  467  347 15 0 1800  333 1 308200 24800 2018  9 2042.7905 0
        84.341 12  7 1  413 3  1.3 267  467  347 15 1 1800  333 1 308200 26300 2018  9 2042.7905 0
        84.809 14  7 1  413 3  1.3 267  467  347 15 1 1800  333 1 308200 27000 2018  9 2042.7905 0
        123.19  4  7 1  413 4  1.3 267  467  347 15 0 1800  333 1 308200 32800 2018  9 2042.7905 0
        84.809  7  7 1  413 3  1.3 267  467  347 15 0 1800  333 1 308200 25500 2018  9 2042.7905 0
        84.743  1  7 1  413 3  1.3 267  467  347 15 0 1800  333 1 308200 24300 2018  9 2042.7905 0
        84.743 14  7 1  413 3  1.3 267  467  347 15 1 1800  333 1 308200 26100 2018  9 2042.7905 0
       123.541 10  7 1  413 4  1.3 267  467  347 15 0 1800  333 1 308200 33000 2018  9 2042.7905 0
        84.743  5  7 1  413 3  1.3 267  467  347 15 0 1800  333 1 308200 24400 2018  9 2042.7905 0
        84.809 14  7 1  413 3  1.3 267  467  347 15 1 1800  333 1 308200 27000 2018  9 2042.7905 0
        84.743 11  7 1  413 3  1.3 267  467  347 15 0 1800  333 1 308200 20600 2018  9 2042.7905 0
        84.809  5  7 1  413 3  1.3 267  467  347 15 0 1800  333 1 308200 25800 2018  9 2042.7905 0
        84.935  3  4 0  318 3    1 465  187  786 15 0  619  466 1 308200 20500 2018  9  3056.756 0
        84.935  8  4 0  318 3    1 465  187  786 15 0  619  466 1 308200 21850 2018  9  3056.756 0
        84.935 12  4 0  318 3    1 465  187  786 15 1  619  466 1 308200 22500 2018  9  3056.756 0
        84.935 12  4 0  318 3    1 465  187  786 15 1  619  466 1 308200 20500 2018  9  3056.756 0
        84.935  3  4 0  318 3    1 465  187  786 15 0  619  466 1 308200 21000 2018  9  3056.756 0
       59.7024  7  4 0  318 3    1 465  187  786 15 0  619  466 1 308200 19250 2018  9  3056.756 0
        84.935  6  4 0  318 3    1 465  187  786 15 0  619  466 1 308200 22200 2018  9  3056.756 0
        84.935 10  4 0  318 3    1 465  187  786 15 0  619  466 1 308200 20000 2018  9  3056.756 0
       59.7024  7  4 0  318 3    1 465  187  786 15 0  619  466 1 308200 19400 2018  9  3056.756 0
        84.935 15  4 0  318 3    1 465  187  786 15 1  619  466 1 308200 20000 2018  9  3056.756 0
        84.935  9  4 0  318 3    1 465  187  786 15 0  619  466 1 308200 21000 2018  9  3056.756 0
        84.935  6  4 0  318 3    1 465  187  786 15 0  619  466 1 308200 20200 2018  9  3056.756 0
        84.935 10  4 0  318 3    1 465  187  786 15 0  619  466 1 308200 19800 2018  9  3056.756 0
        84.935  5  4 0  318 3    1 465  187  786 15 0  619  466 1 308200 20700 2018  9  3056.756 0
        84.935  3  4 0  318 3    1 465  187  786 15 0  619  466 1 308200 19950 2018  9  3056.756 0
        84.935 10  4 0  318 3    1 465  187  786 15 0  619  466 1 308200 20500 2018  9  3056.756 0
        84.935  4  4 0  318 3    1 465  187  786 15 0  619  466 1 308200 21800 2018  9  3056.756 0
         84.91  6 19 1 1003 3  1.5 409 1000  169 15 0  467  511 1 308200 26000 2018  9  3426.936 0
         84.91  5 19 1 1003 3  1.5 409 1000  169 15 0  467  511 1 308200 26200 2018  9  3426.936 0
         84.91  4 19 1 1003 3  1.5 409 1000  169 15 0  467  511 1 308200 27400 2018  9  3426.936 0
         84.91 10 19 1 1003 3  1.5 409 1000  169 15 0  467  511 1 308200 29000 2018  9  3426.936 0
       153.684  1 19 1 1003 4  1.5 409 1000  169 15 0  467  511 1 308200 37200 2018  9  3426.936 0
       120.069  7 19 1 1003 4  1.5 409 1000  169 15 0  467  511 1 308200 35700 2018  9  3426.936 0
       153.684  8 19 1 1003 4  1.5 409 1000  169 15 0  467  511 1 308200 40700 2018  9  3426.936 0
         84.91 12 19 1 1003 3  1.5 409 1000  169 15 1  467  511 1 308200 29000 2018  9  3426.936 0
       120.069  7 19 1 1003 4  1.5 409 1000  169 15 0  467  511 1 308200 33000 2018  9  3426.936 0
         84.91  8 19 1 1003 3  1.5 409 1000  169 15 0  467  511 1 308200 28000 2018  9  3426.936 0
         84.91  4 19 1 1003 3  1.5 409 1000  169 15 0  467  511 1 308200 25000 2018  9  3426.936 0
       132.668  9 19 1 1003 4  1.5 409 1000  169 15 0  467  511 1 308200 37000 2018  9  3426.936 0
         84.91 13 19 1 1003 3  1.5 409 1000  169 15 1  467  511 1 308200 28000 2018  9  3426.936 0
         84.91  1 19 1 1003 3  1.5 409 1000  169 15 0  467  511 1 308200 24300 2018  9  3426.936 0
       132.668  6 19 1 1003 4  1.5 409 1000  169 15 0  467  511 1 308200 34500 2018  9  3426.936 0
         84.91 11 19 1 1003 3  1.5 409 1000  169 15 0  467  511 1 308200 27100 2018  9  3426.936 0
         84.91  2 19 1 1003 3  1.5 409 1000  169 15 0  467  511 1 308200 24750 2018  9  3426.936 0
         84.91  8 19 1 1003 3  1.5 409 1000  169 15 0  467  511 1 308200 28000 2018  9  3426.936 0
         84.91  9 19 1 1003 3  1.5 409 1000  169 15 0  467  511 1 308200 26500 2018  9  3426.936 0
       153.684  2 19 1 1003 4  1.5 409 1000  169 15 0  467  511 1 308200 37000 2018  9  3426.936 0
       120.069  5 19 1 1003 4  1.5 409 1000  169 15 0  467  511 1 308200 33500 2018  9  3426.936 0
         84.91  6 19 1 1003 3  1.5 409 1000  169 15 0  467  511 1 308200 25100 2018  9  3426.936 0
         84.91 14 19 1 1003 3  1.5 409 1000  169 15 1  467  511 1 308200 27800 2018  9  3426.936 0
         84.91  7 19 1 1003 3  1.5 409 1000  169 15 0  467  511 1 308200 27350 2018  9  3426.936 0
         84.91  5 19 1 1003 3  1.5 409 1000  169 15 0  467  511 1 308200 26300 2018  9  3426.936 0
         84.91  4 19 1 1003 3  1.5 409 1000  169 15 0  467  511 1 308200 26500 2018  9  3426.936 0
         84.91 12 19 1 1003 3  1.5 409 1000  169 15 1  467  511 1 308200 27600 2018  9  3426.936 0
       132.668  5 19 1 1003 4  1.5 409 1000  169 15 0  467  511 1 308200 36500 2018  9  3426.936 0
       120.069  7 19 1 1003 4  1.5 409 1000  169 15 0  467  511 1 308200 34000 2018  9  3426.936 0
         84.91 13 19 1 1003 3  1.5 409 1000  169 15 1  467  511 1 308200 28000 2018  9  3426.936 0
       120.069 10 19 1 1003 4  1.5 409 1000  169 15 0  467  511 1 308200 33000 2018  9  3426.936 0
         84.91 12 19 1 1003 3  1.5 409 1000  169 15 1  467  511 1 308200 28800 2018  9  3426.936 0
         84.91  2 19 1 1003 3  1.5 409 1000  169 15 0  467  511 1 308200 24000 2018  9  3426.936 0
         84.91  7 19 1 1003 3  1.5 409 1000  169 15 0  467  511 1 308200 26500 2018  9  3426.936 0
         84.91 14 19 1 1003 3  1.5 409 1000  169 15 1  467  511 1 308200 26500 2018  9  3426.936 0
         84.91 10 19 1 1003 3  1.5 409 1000  169 15 0  467  511 1 308200 26900 2018  9  3426.936 0
         84.91  4 19 1 1003 3  1.5 409 1000  169 15 0  467  511 1 308200 26450 2018  9  3426.936 0
         84.91  4 19 1 1003 3  1.5 409 1000  169 15 0  467  511 1 308200 26100 2018  9  3426.936 0
         84.91 12 19 1 1003 3  1.5 409 1000  169 15 1  467  511 1 308200 28000 2018  9  3426.936 0
         84.91  5 19 1 1003 3  1.5 409 1000  169 15 0  467  511 1 308200 26300 2018  9  3426.936 0
         84.91 11 19 1 1003 3  1.5 409 1000  169 15 0  467  511 1 308200 28000 2018  9  3426.936 0
         84.91  1 19 1 1003 3  1.5 409 1000  169 15 0  467  511 1 308200 24000 2018  9  3426.936 0
         84.91  5 19 1 1003 3  1.5 409 1000  169 15 0  467  511 1 308200 27700 2018  9  3426.936 0
         84.91  4 19 1 1003 3  1.5 409 1000  169 15 0  467  511 1 308200 27000 2018  9  3426.936 0
       120.069  2 19 1 1003 4  1.5 409 1000  169 15 0  467  511 1 308200 27000 2018  9  3426.936 0
         84.91 11 19 1 1003 3  1.5 409 1000  169 15 0  467  511 1 308200 26000 2018  9  3426.936 0
         84.91 11 19 1 1003 3  1.5 409 1000  169 15 0  467  511 1 308200 26800 2018  9  3426.936 0
         84.91  3 19 1 1003 3  1.5 409 1000  169 15 0  467  511 1 308200 27000 2018  9  3426.936 0
         84.91  1 19 1 1003 3  1.5 409 1000  169 15 0  467  511 1 308200 24500 2018  9  3426.936 0
         84.91 12 19 1 1003 3  1.5 409 1000  169 15 1  467  511 1 308200 26500 2018  9  3426.936 0
       84.9651  2  6 0  308 3 1.03 342   87  639 15 0  472  516 1 308200 23600 2018  9  3205.415 0
       84.9651  1  6 0  308 3 1.03 342   87  639 15 0  472  516 1 308200 23500 2018  9  3205.415 0
       84.9651  6  6 0  308 3 1.03 342   87  639 15 0  472  516 1 308200 23750 2018  9  3205.415 0
       84.9651  7  6 0  308 3 1.03 342   87  639 15 0  472  516 1 308200 25000 2018  9  3205.415 0
       84.9651  9  6 0  308 3 1.03 342   87  639 15 0  472  516 1 308200 23400 2018  9  3205.415 0
       84.9651  8  6 0  308 3 1.03 342   87  639 15 0  472  516 1 308200 23000 2018  9  3205.415 0
       84.9651  2  6 0  308 3 1.03 342   87  639 15 0  472  516 1 308200 22400 2018  9  3205.415 0
       84.9651 15  6 0  308 3 1.03 342   87  639 15 1  472  516 1 308200 23000 2018  9  3205.415 0
       84.9651 12  6 0  308 3 1.03 342   87  639 15 1  472  516 1 308200 24000 2018  9  3205.415 0
       84.9651 13  6 0  308 3 1.03 342   87  639 15 1  472  516 1 308200 22000 2018  9  3205.415 0
       84.9651 11  6 0  308 3 1.03 342   87  639 15 0  472  516 1 308200 23700 2018  9  3205.415 0
      131.2683  8 12 0 1005 3 1.37 477  517  597 15 0 2000  432 1 308200 33000 2018  9  1797.592 0
       84.9025  4 12 0 1005 3 1.37 477  517  597 15 0 2000  432 1 308200 24500 2018  9  1797.592 0
      131.2683  2 12 0 1005 3 1.37 477  517  597 15 0 2000  432 1 308200 31800 2018  9  1797.592 0
      101.9975 10 12 0 1005 3 1.37 477  517  597 15 0 2000  432 1 308200 28800 2018  9  1797.592 0
       84.9025 12 12 0 1005 3 1.37 477  517  597 15 1 2000  432 1 308200 25700 2018  9  1797.592 0
       84.9025  2 12 0 1005 3 1.37 477  517  597 15 0 2000  432 1 308200 23900 2018  9  1797.592 0
       84.9025 12 12 0 1005 3 1.37 477  517  597 15 1 2000  432 1 308200 26200 2018  9  1797.592 0
       84.9438  2 12 0 1005 3 1.37 477  517  597 15 0 2000  432 1 308200 25000 2018  9  1797.592 0
       84.9438  3 12 0 1005 3 1.37 477  517  597 15 0 2000  432 1 308200 24200 2018  9  1797.592 0
       84.9025  8 12 0 1005 3 1.37 477  517  597 15 0 2000  432 1 308200 25450 2018  9  1797.592 0
       84.9438  6 12 0 1005 3 1.37 477  517  597 15 0 2000  432 1 308200 25200 2018  9  1797.592 0
      131.2683  1 12 0 1005 3 1.37 477  517  597 15 0 2000  432 1 308200 31000 2018  9  1797.592 0
       84.9025  3 12 0 1005 3 1.37 477  517  597 15 0 2000  432 1 308200 23500 2018  9  1797.592 0
       84.9025 14 12 0 1005 3 1.37 477  517  597 15 1 2000  432 1 308200 25500 2018  9  1797.592 0
       84.9438  3 12 0 1005 3 1.37 477  517  597 15 0 2000  432 1 308200 23400 2018  9  1797.592 0
      131.2683  9 12 0 1005 3 1.37 477  517  597 15 0 2000  432 1 308200 33000 2018  9  1797.592 0
       84.9025 13 12 0 1005 3 1.37 477  517  597 15 1 2000  432 1 308200 25500 2018  9  1797.592 0
      101.9975 15 12 0 1005 3 1.37 477  517  597 15 1 2000  432 1 308200 27800 2018  9  1797.592 0
       84.9025 14 12 0 1005 3 1.37 477  517  597 15 1 2000  432 1 308200 24400 2018  9  1797.592 0
       84.9025 15 12 0 1005 3 1.37 477  517  597 15 1 2000  432 1 308200 25000 2018  9  1797.592 0
      101.9874  6 12 0 1005 3 1.37 477  517  597 15 0 2000  432 1 308200 28000 2018  9  1797.592 0
       84.9025  9 12 0 1005 3 1.37 477  517  597 15 0 2000  432 1 308200 24900 2018  9  1797.592 0
      101.9975 11 12 0 1005 3 1.37 477  517  597 15 0 2000  432 1 308200 31000 2018  9  1797.592 0
       84.9025 10 12 0 1005 3 1.37 477  517  597 15 0 2000  432 1 308200 25000 2018  9  1797.592 0
      131.2683  6 12 0 1005 3 1.37 477  517  597 15 0 2000  432 1 308200 30500 2018  9  1797.592 0
      101.9975 13 12 0 1005 3 1.37 477  517  597 15 1 2000  432 1 308200 28400 2018  9  1797.592 0
       84.9025 11 12 0 1005 3 1.37 477  517  597 15 0 2000  432 1 308200 24900 2018  9  1797.592 0
      131.1515 11 12 0 1005 3 1.37 477  517  597 15 0 2000  432 1 308200 30000 2018  9  1797.592 0
      101.9975  7 12 0 1005 3 1.37 477  517  597 15 0 2000  432 1 308200 27800 2018  9  1797.592 0
      101.9975  7 12 0 1005 3 1.37 477  517  597 15 0 2000  432 1 308200 27300 2018  9  1797.592 0
       84.9025  5 12 0 1005 3 1.37 477  517  597 15 0 2000  432 1 308200 26000 2018  9  1797.592 0
      131.2683  3 12 0 1005 3 1.37 477  517  597 15 0 2000  432 1 308200 30450 2018  9  1797.592 0
      101.9975  4 12 0 1005 3 1.37 477  517  597 15 0 2000  432 1 308200 26250 2018  9  1797.592 0
       84.9025  8 12 0 1005 3 1.37 477  517  597 15 0 2000  432 1 308200 25000 2018  9  1797.592 0
      131.2683  6 12 0 1005 3 1.37 477  517  597 15 0 2000  432 1 308200 33000 2018  9  1797.592 0
      131.2683 14 12 0 1005 3 1.37 477  517  597 15 1 2000  432 1 308200 31500 2018  9  1797.592 0
      101.9874  9 12 0 1005 3 1.37 477  517  597 15 0 2000  432 1 308200 27500 2018  9  1797.592 0
       84.9025  1 12 0 1005 3 1.37 477  517  597 15 0 2000  432 1 308200 24000 2018  9  1797.592 0
      101.9874 13 12 0 1005 3 1.37 477  517  597 15 1 2000  432 1 308200 30000 2018  9  1797.592 0
      101.9874  2 12 0 1005 3 1.37 477  517  597 15 0 2000  432 1 308200 26500 2018  9  1797.592 0
       84.9025  3 12 0 1005 3 1.37 477  517  597 15 0 2000  432 1 308200 24000 2018  9  1797.592 0
      101.9975  5 12 0 1005 3 1.37 477  517  597 15 0 2000  432 1 308200 27000 2018  9  1797.592 0
      131.2683 13 12 0 1005 3 1.37 477  517  597 15 1 2000  432 1 308200 30700 2018  9  1797.592 0
       84.9314 15  4 0  203 3 1.07 122  377  248 15 1 1500  289 1 308200 28000 2018  9 2155.3225 0
       84.8372  9  4 0  203 3 1.07 122  377  248 15 0 1500  289 1 308200 26700 2018  9 2155.3225 0
       84.8372 10  4 0  203 3 1.07 122  377  248 15 0 1500  289 1 308200 25000 2018  9 2155.3225 0
       84.9314  1  4 0  203 3 1.07 122  377  248 15 0 1500  289 1 308200 22900 2018  9 2155.3225 0
      end

      Comment


      • #4
        So I'm not understanding. Your DD code
        Code:
        didregress (price distance) (treatment), group (neighbourhood) time(year)
        suggests that neighborhood is your panel variable, but it isn't in your data example. Why not?

        also, how many treated units are there? Just one, or... something different?
        Last edited by Jared Greathouse; 22 Nov 2022, 11:30.

        Comment


        • #5
          I'm so sorry, I should have clarified this - I was trying to explain using more intuitive variable names in my original post. Neighbourhood is actually group in my data.

          So the DD code would actually be

          didregress (price distance area floor total rooms park school subway mart royal brand) (treatment), group(group) time(year)

          If by treated units you mean the number of observations that undergo treatment, it would be 424. There are 4 different "groups" out of 10, which are actually neighbourhoods that are treated in my data.
          It's a bit confusing since my data involves transaction data of apartment units, but the data doesn't come with a specific "id" for the apartment unit being sold. It is sorted by apartment complexes rather than individual units and the area, and floor of the unit is given.

          Comment


          • #6
            Okay so the reason why I asked this is because this is where the problems begin. DD's treatment effect cannot be identified here- why? Well, we don't have panel data. More precisely, we have repeated time observations within our sample. This is to say
            Code:
                 group   year   price   distance   treatm~t  
              1.       7   2018   27500   2180.915          0  
              2.       7   2018   21000   2289.985          0  
              3.       7   2018   21000   2289.985          0  
              4.       7   2018   33000   2222.798          0  
              5.       7   2018   32800   2222.798          0  
              6.       7   2018   29500   2222.798          0  
              7.       7   2018   29000   2180.915          0  
              8.       7   2018   31600   2222.798          0  
              9.       7   2018   27500   2222.798          0  
             10.       7   2018   21450   2289.985          0
            can't be a thing, because group 7 has more than one price and distance associated with each year. Thus, your treatment is exactly collinear and can't be identified. DD requires that you observe your units before and after an intervention, and if your unit is group, well, mechanically this won't work. My point here, is that you'll need panel data like this
            Code:
            clear *
            
            u "https://github.com/scunning1975/mixtape/blob/master/smoking.dta?raw=true", clear
            where every unit (state) has one year associated with it. But to your original question, yes, you can readily implement covariates within your DD design like this
            Code:
            clear *
            
            u "https://github.com/scunning1975/mixtape/blob/master/smoking.dta?raw=true", clear
            
            xtset state year, y
            loc int_time = 1989
            
            local lbl: value label `r(panelvar)'
            
            
            loc unit ="California":`lbl'
            
            g treat = cond(`r(panelvar)'==`unit' & `r(timevar)' >=`int_time',1,0)
            
            lab var treat "Prop 99"
            cls
            
            xtdidregress (cig ret) (treat), group(state) time(year)
            I should note that didregress is for repeated cross section data. That is like a survery or something where the exact sample people aren't being surveyed every single year, but a new cohort of that group are- what you have is repeated cross section, repeated time series data, and that won't work here for DD

            Comment


            • #7
              Thank you for being patient with me and explaining this so clearly. Now I understand why I have been having a hard time trying to apply DD to my research.

              Just to make sure I've completely understood, would this mean that if my data looked something like this

              Code:
              group year price distance treat
              1 2018 27500 2180.915 0
              1 2019 21000 2180.915 1
              2 2018 31000 2289.985 0
              2 2019 29000 2289.985 0
              3 2018 33000 2222.798 0
              3 2019 30000 2222.798 1
              4 2018 40000 2422.555 0
              4 2019 41000 2422.555 0
              I would be able to use DD?

              Comment


              • #8
                Yep yep!!!!!! And here's how:
                Code:
                * Example generated by -dataex-. For more info, type help dataex
                clear
                input group year price distance treat
                
                1 2018 27500 2180.915 0
                1 2019 21000 2180.915 1
                2 2018 31000 2289.985 0
                2 2019 29000 2289.985 0
                3 2018 33000 2222.798 0
                3 2019 30000 2222.798 1
                4 2018 40000 2422.555 0
                4 2019 41000 2422.555 0
                end
                
                xtset group year, y
                
                cls
                
                xtdidregress (price) (treat), group(`r(panelvar)') time(`r(timevar)')
                
                bys group: egen treat2 = max(cond(treat==1,1,0))
                
                g post = cond(year==2019,1,0)
                
                reg price i.treat2##i.post
                Notice how the two-way fixed effects apporach implemented by xtdidregress produces an identical point estimate to the manual regression way I do below. I would use the xtdidregress approach since you don't need to generate 2 additional predictors, but just so you know, these methods are equivalent under the hood. The reason is because of the way the math works- the group and time dummies implicit in xtdidregress have the effect have the practical effect of calculating the average of the pre and post treated units, where our predictor treat denotes before and after. In other words, it calculates the difference of the differences between the pre and post group, respectively. I don't know how many econometrics courses you've taken yet, but it's always good to know the buts and bolts of the toolkit you use.

                Comment


                • #9
                  From the sample data you gave, it looks like the policy change affected all units in 2019, so there is no control group. It doesn't matter so much that it's not panel data, but you don't have a control group in 2019. Or, if you do, none are listed in your output. But you can see if the effect of distance has changed across the years by doing the following:

                  Code:
                  reg price i.year c.distance i.year#c.distance other control variables, vce(robust)
                  Actually, I would use log(price) and log(distance) so that you estimate elasticities. If you have access to my introductory econometrics book, you can find a similar example in Section 13.2. It looks at the effect of locating a garbage incinerator on housing prices. But a key difference in my example is that prices for houses were observed before the incinerator was even rumored to be built, so it is more of a pure diff-in-diffs (with a continuous treatment). Was the landfill located recently? What was the policy change between 2018 and 2019?

                  Comment


                  • #10
                    it looks like the policy change affected all units in 2019
                    How can you tell? Aren't there untreated units in 2019? Like group 9?

                    Comment


                    • #11
                      Dear Jared and Jeff,

                      Many thanks to both of you for helping me!

                      I actually do have a control group, but I don't think it is showing up above since I only copied 300 lines of my data.
                      The landfill in my research was actually built in 1992, but the policy change I am trying to look at is the discontinuation of a branch of the resident support fund that directly gave households cash compensation.
                      So the control group is the group of apartments that did not get any compensation in the first place, and the treatment group is the group that has been getting compensation but is cut off in 2019.

                      However, having read the relevant section in Jeff's book, I realised it is very similar to what I'm trying to do, so I am planning to read it more carefully. I am thinking that my research may be more relevant if I change my base year to the year the cutoff was announced.
                      I was actually looking for a textbook to help me understand the concept, so thank you again!

                      Comment

                      Working...
                      X