Goodmorning everyone,
It's my first time posting on statalist, so please forgive me for any possible mistakes. I'm trying to carry out a DiD analysis with homogeneous treatment using the command xtdidregress on Stata17. All the states in the considered treatment group receive the treatment in 1996, therefore I created the dummy variable "treatment" as the interaction of a dummy for participating countries and a dummy >= 1996. Therefore, it takes value = 1 for participating countries >= 1996. I want to observe the impact of having received the treatment on the y variable revenues.
This is an example of the data I'm using:
However, when I use xtdidregress (after xtset id year, yearly), I obtain the following results:
As you can observe from the table, treatment assignment seems to vary. In fact, when I try to observe parallel trends, I get this message:
However, my treatment timing shouldn't vary, since all the countries in the treatment group receive the treatment in 1996. I already checked by whole dataset, and the treatment dummy is always 1 for years >= 1996, only for treated countries, and 0 otherwise. What am I getting wrong? I tried searching for previous questions but didn't find an answer.
Thank you all incredibly!
It's my first time posting on statalist, so please forgive me for any possible mistakes. I'm trying to carry out a DiD analysis with homogeneous treatment using the command xtdidregress on Stata17. All the states in the considered treatment group receive the treatment in 1996, therefore I created the dummy variable "treatment" as the interaction of a dummy for participating countries and a dummy >= 1996. Therefore, it takes value = 1 for participating countries >= 1996. I want to observe the impact of having received the treatment on the y variable revenues.
This is an example of the data I'm using:
Code:
* Example generated by -dataex-. For more info, type help dataex clear input str34 country float id int year float treatment double revenues "Angola" 3 1980 0 . "Angola" 3 1981 0 . "Angola" 3 1982 0 . "Angola" 3 1983 0 . "Angola" 3 1984 0 . "Angola" 3 1985 0 38.5590223893859 "Angola" 3 1986 0 37.440774273166085 "Angola" 3 1987 0 28.15715496592235 "Angola" 3 1988 0 26.318105068155557 "Angola" 3 1989 0 26.678764600008403 "Angola" 3 1990 0 25.603858087712762 "Angola" 3 1991 0 18.286622438623453 "Angola" 3 1992 0 35.59674673728012 "Angola" 3 1993 0 38.97868309765103 "Angola" 3 1994 0 26.1 "Angola" 3 1995 0 24.211764705882352 "Angola" 3 1996 0 36.816046966731896 "Angola" 3 1997 0 29.767382174521696 "Angola" 3 1998 0 28.79078694817658 "Angola" 3 1999 0 41.42462044091039 "Angola" 3 2000 0 42.812036507072904 "Angola" 3 2001 0 38.823995894445176 "Angola" 3 2002 0 28.66809284136252 "Angola" 3 2003 0 29.71193899979683 "Angola" 3 2004 0 30.98746169132483 "Angola" 3 2005 0 33.695143292354956 "Angola" 3 2006 0 . "Angola" 3 2007 0 . "Angola" 3 2008 0 . "Angola" 3 2009 0 36.82759164763131 "Angola" 3 2010 0 41.79623846838015 "Angola" 3 2011 0 44.62457646648777 "Angola" 3 2012 0 40.46642317555491 "Angola" 3 2013 0 35.83175445244411 "Angola" 3 2014 0 30.131542754536834 "Angola" 3 2015 0 23.053284196959346 "Angola" 3 2016 0 16.56236385597934 "Angola" 3 2017 0 16.666419902972514 "Angola" 3 2018 0 21.159166826250452 "Angola" 3 2019 0 19.024422476166702 "Angola" 3 2020 0 17.32964490984264 "Burundi" 13 1980 0 17.222313141467748 "Burundi" 13 1981 0 17.256408528228977 "Burundi" 13 1982 0 18.760568772799303 "Burundi" 13 1983 0 16.115698460401287 "Burundi" 13 1984 0 18.119885348730943 "Burundi" 13 1985 0 16.3402857426051 "Burundi" 13 1986 0 19.070355686291226 "Burundi" 13 1987 0 17.08156779661017 "Burundi" 13 1988 0 17.34970353015092 "Burundi" 13 1989 0 24.4175677182031 "Burundi" 13 1990 0 23.510032943995206 "Burundi" 13 1991 0 25.00837860929247 "Burundi" 13 1992 0 25.5501488207453 "Burundi" 13 1993 0 26.565614873231517 "Burundi" 13 1994 0 20.50917560821052 "Burundi" 13 1995 0 21.30667595829979 "Burundi" 13 1996 1 18.410532041553026 "Burundi" 13 1997 1 16.58190820395747 "Burundi" 13 1998 1 18.00535659358659 "Burundi" 13 1999 1 17.442813806673772 "Burundi" 13 2000 1 18.206108452289474 "Burundi" 13 2001 1 16.69040871582759 "Burundi" 13 2002 1 18.694387127430367 "Burundi" 13 2003 1 21.721675288621608 "Burundi" 13 2004 1 24.278108411778952 "Burundi" 13 2005 1 19.176590158941405 "Burundi" 13 2006 1 26.55164516375296 "Burundi" 13 2007 1 . "Burundi" 13 2008 1 . "Burundi" 13 2009 1 32.817532645019156 "Burundi" 13 2010 1 37.20981652883773 "Burundi" 13 2011 1 33.64481506518453 "Burundi" 13 2012 1 33.777901901771045 "Burundi" 13 2013 1 32.93114754098361 "Burundi" 13 2014 1 30.516129032258064 "Burundi" 13 2015 1 . "Burundi" 13 2016 1 . "Burundi" 13 2017 1 . "Burundi" 13 2018 1 . "Burundi" 13 2019 1 . "Burundi" 13 2020 1 . "Benin" 15 1980 0 8.777399210478057 "Benin" 15 1981 0 15.576651109378387 "Benin" 15 1982 0 16.31812237434467 "Benin" 15 1983 0 12.732701088865472 "Benin" 15 1984 0 11.06599830551901 "Benin" 15 1985 0 11.847020943421677 "Benin" 15 1986 0 10.955432223593863 "Benin" 15 1987 0 11.407167050753774 "Benin" 15 1988 0 11.803766330529346 "Benin" 15 1989 0 9.559569630368483 "Benin" 15 1990 0 8.486426598875077 "Benin" 15 1991 0 9.880866576833485 "Benin" 15 1992 0 11.46952743208144 "Benin" 15 1993 0 11.569943730551936 "Benin" 15 1994 0 12.39768792228859 "Benin" 15 1995 0 12.849657614075152 "Benin" 15 1996 1 13.104247932252141 "Benin" 15 1997 1 13.612375047184594 end
Code:
xtdidregress (revenues) (treatment), group(id) time(year) Number of groups and treatment time Time variable: year Control: treatment = 0 Treatment: treatment = 1 ----------------------------------- | Control Treatment -------------+--------------------- Group | id | 24 24 -------------+--------------------- Time | Minimum | 1980 1996 Maximum | 2013 2000 ----------------------------------- Difference-in-differences regression Number of obs = 1,566 Data type: Longitudinal (Std. err. adjusted for 48 clusters in id) ------------------------------------------------------------------------------ | Robust revenues | Coefficient std. err. t P>|t| [95% conf. interval] -------------+---------------------------------------------------------------- ATET | treatment | (1 vs 0) | 6.413122 1.517473 4.23 0.000 3.36036 9.465884 ------------------------------------------------------------------------------ Note: ATET estimate adjusted for panel effects and time effects.
Code:
estat trendplot
treatment assignment times vary; not allowed with estat trendplots
Thank you all incredibly!
Comment