Dear Statalist,

I have a question regarding the identification of a treatment effect in a large panel dataset (800.000 observations), spanning many time periods (monthly values for each pixel for 17 years, 2000-2017). The data is on a land management project, and the objective is to identify whether the project has had an observable effect on vegetation as measured by satellite data. Treatment happened in different treatment areas at different times between 2009 and 2015, so there is no “clean” pre-treatment and post-treatment period.

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input long id float(yrmo year month critws_implemstart ndvi ndvi_mean ndvi_an treatmentyear)
10869164 624 2012 1 . 1.2073 1.2279375 -1.6806648 0
10869164 672 2016 1 . 1.2025 1.2279375  -2.071561 0
10869164 636 2013 1 .   1.21 1.2279375 -1.4607764 0
10869164 480 2000 1 .      . 1.2279375          . 0
10869164 528 2004 1 . 1.2136 1.2279375 -1.1676018 0
10869164 660 2015 1 .  1.232 1.2279375  .33084205 0
10869164 588 2009 1 . 1.1974 1.2279375  -2.486893 0
10869164 576 2008 1 .  1.252 1.2279375   1.959588 0
10869164 504 2002 1 . 1.2442 1.2279375  1.3243778 0
10869164 612 2011 1 . 1.2146 1.2279375 -1.0861704 0
10869164 600 2010 1 . 1.1985 1.2279375 -2.3973064 0
10869164 492 2001 1 . 1.2364 1.2279375   .6891677 0
10869164 684 2017 1 .  1.204 1.2279375  -1.949404 0
10869164 516 2003 1 . 1.2128 1.2279375 -1.2327528 0
10869164 540 2005 1 . 1.2132 1.2279375 -1.2001822 0
10869164 564 2007 1 . 1.2301 1.2279375   .1761145 0
10869164 648 2014 1 . 1.2241 1.2279375  -.3125132 0
10869164 552 2006 1 . 1.2212 1.2279375  -.5486819 0
10869165 492 2001 1 . 1.2211 1.2083875  1.0520201 0
10869165 624 2012 1 . 1.1841 1.2083875 -2.0099068 0
10869165 516 2003 1 .  1.193 1.2083875  -1.273394 0
10869165 684 2017 1 . 1.2126 1.2083875  .34860495 0
10869165 528 2004 1 . 1.1913 1.2083875 -1.4140712 0
10869165 540 2005 1 . 1.1849 1.2083875 -1.9437017 0
10869165 588 2009 1 . 1.1823 1.2083875 -2.1588707 0
10869165 636 2013 1 . 1.1968 1.2083875  -.9589226 0
10869165 648 2014 1 . 1.2069 1.2083875  -.1230974 0
10869165 480 2000 1 .      . 1.2083875          . 0
10869165 672 2016 1 . 1.2016 1.2083875 -.56170213 0
10869165 612 2011 1 . 1.1981 1.2083875  -.8513431 0
10869165 564 2007 1 .  1.213 1.2083875   .3817124 0
10869165 504 2002 1 . 1.2263 1.2083875   1.482348 0
10869165 600 2010 1 . 1.1814 1.2083875 -2.2333524 0
10869165 576 2008 1 . 1.2369 1.2083875  2.3595476 0
10869165 660 2015 1 . 1.2336 1.2083875  2.0864604 0
10869165 552 2006 1 . 1.2006 1.2083875  -.6444511 0
10869166 480 2000 1 .      . 1.2400625          . 0
10869166 648 2014 1 . 1.2619 1.2400625  1.7609978 0
10869166 684 2017 1 . 1.2456 1.2400625   .4465509 0
10869166 528 2004 1 . 1.2176 1.2400625 -1.8113997 0
10869166 540 2005 1 . 1.2199 1.2400625  -1.625923 0
10869166 564 2007 1 . 1.2531 1.2400625  1.0513633 0
10869166 552 2006 1 . 1.2385 1.2400625  -.1259998 0
10869166 492 2001 1 . 1.2311 1.2400625  -.7227468 0
10869166 600 2010 1 . 1.2223 1.2400625 -1.4323813 0
10869166 624 2012 1 .  1.198 1.2400625  -3.391968 0
10869166 516 2003 1 . 1.2231 1.2400625  -1.367877 0
10869166 672 2016 1 . 1.2359 1.2400625   -.335663 0
10869166 504 2002 1 . 1.2566 1.2400625   1.333606 0
10869166 576 2008 1 . 1.2806 1.2400625   3.268987 0
10869166 660 2015 1 . 1.3035 1.2400625   5.115676 0
10869166 636 2013 1 . 1.2509 1.2400625   .8739523 0
10869166 588 2009 1 . 1.2284 1.2400625  -.9404755 0
10869166 612 2011 1 . 1.2305 1.2400625  -.7711299 0
10869167 516 2003 1 . 1.2405 1.2541875 -1.0913434 0
10869167 684 2017 1 . 1.2396 1.2541875 -1.1631054 0
10869167 492 2001 1 .  1.244 1.2541875  -.8122794 0
10869167 552 2006 1 . 1.2647 1.2541875   .8381993 0
10869167 480 2000 1 .      . 1.2541875          . 0
10869167 588 2009 1 . 1.2456 1.2541875  -.6847046 0
10869167 624 2012 1 . 1.2141 1.2541875 -3.1962895 0
10869167 648 2014 1 . 1.2474 1.2541875  -.5411806 0
10869167 540 2005 1 . 1.2301 1.2541875 -1.9205605 0
10869167 504 2002 1 . 1.2826 1.2541875  2.2654173 0
10869167 660 2015 1 . 1.2837 1.2541875  2.3531191 0
10869167 576 2008 1 . 1.2796 1.2541875   2.026217 0
10869167 612 2011 1 . 1.2445 1.2541875  -.7724063 0
10869167 636 2013 1 . 1.2521 1.2541875 -.16644034 0
10869167 564 2007 1 . 1.2523 1.2541875  -.1504911 0
10869167 672 2016 1 . 1.2464 1.2541875  -.6209172 0
10869167 528 2004 1 . 1.2397 1.2541875 -1.1551307 0
10869167 600 2010 1 .  1.229 1.2541875 -2.0082717 0
10869185 684 2017 1 . 1.2134  1.227675 -1.1627634 0
10869185 564 2007 1 . 1.2184  1.227675  -.7554898 0
10869185 552 2006 1 . 1.1851  1.227675  -3.467938 0
10869185 540 2005 1 . 1.2016  1.227675  -2.123934 0
10869185 600 2010 1 . 1.1986  1.227675 -2.3682904 0
10869185 612 2011 1 . 1.2374  1.227675   .7921554 0
10869185 648 2014 1 . 1.2048  1.227675 -1.8632742 0
10869185 624 2012 1 . 1.2223  1.227675   -.437812 0
10869185 528 2004 1 . 1.2314  1.227675   .3034233 0
10869185 516 2003 1 . 1.2204  1.227675 -.59258235 0
10869185 660 2015 1 . 1.2069  1.227675   -1.69222 0
10869185 576 2008 1 . 1.2483  1.227675  1.6800046 0
10869185 480 2000 1 .      .  1.227675          . 0
10869185 672 2016 1 . 1.1799  1.227675  -3.891495 0
10869185 636 2013 1 . 1.2167  1.227675  -.8939666 0
10869185 492 2001 1 .  1.219  1.227675  -.7066185 0
10869185 588 2009 1 . 1.1958  1.227675 -2.5963724 0
10869185 504 2002 1 . 1.2972  1.227675   5.663144 0
10869188 576 2008 1 . 1.2204  1.212275   .6702231 0
10869188 528 2004 1 . 1.2308  1.212275   1.528119 0
10869188 636 2013 1 . 1.2004  1.212275   -.979566 0
10869188 600 2010 1 . 1.1956  1.212275 -1.3755126 0
10869188 660 2015 1 . 1.2162  1.212275   .3237686 0
10869188 516 2003 1 . 1.2004  1.212275   -.979566 0
10869188 672 2016 1 .  1.196  1.212275  -1.342521 0
10869188 684 2017 1 . 1.2042  1.212275  -.6661029 0
10869188 612 2011 1 . 1.2205  1.212275   .6784735 0
10869188 504 2002 1 .  1.239  1.212275  2.2045274 0
end
format %tm yrmo

At the moment I am employing a very simple type of difference-in-difference style estimation looking like this:

Code:
reg ndvi_an treatmentyear i.year i.month, r
The dependent variable (ndvi_an) is the percentage deviation of vegetation from the 2000-2008 monthly mean of a specific pixel, and the treatment variable (treatmentyear) is the number of years since project implementation started. The i.year and i.month are dummies controlling for between year effects and seasonality.

Now, excuse me if the question is broad, but I simply wonder: isn’t there a better way to test for the treatment effect in this case? Ideally I would want to see if treatment areas deviate from their pre-treatment trend in a different way than control areas (and by doing so also somehow testing the parallel trends assumption), but I am simply a bit out of my econometrical/coding depth here. I’ve played around with xtset and xtreg for a few days, but I can’t really figure out if and how that would help.

As always thankful for any assistance,
Lars