I have state-by-year panel data, and I'm running a regression where I want to interact year fixed effects with with a continuous treatment variable which is constant within states. I'd like to normalize the 2009 interaction to be equal to zero, but am running into problems. The code below illustrates my two attempts:
This produces the following output, which omits the 2012 interaction instead of the 2009 interaction like I wanted, but I'm not sure why.
Next, I tried the following regression:
which produces
This does almost exactly what I want, except now it includes "xvar" by itself in the regression. I think that this is probably just changing the interpretation of the STFIPS fixed effects, but I'm not quite sure. Is it possible to adjust either attempt 1 to exclude the 2009 interaction or force attempt 2 to not include xvar by itself in the regression?
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input double STFIPS float year byte xvar float yvar 2 2005 91 40.35 2 2006 91 40.5 2 2007 91 40.65 2 2008 91 41.4 2 2009 91 37.5 2 2010 91 39.75 2 2011 91 44.55 2 2012 91 44.7 5 2005 64 15.5847 5 2006 64 24.054644 5 2007 64 22.86885 5 2008 64 18.59153 5 2009 64 21.51366 5 2010 64 22.572403 5 2011 64 16.643442 5 2012 64 15.669398 6 2005 46 25.89734 6 2006 46 24.80797 6 2007 46 23.52053 6 2008 46 23.37198 6 2009 46 20.400965 6 2010 46 19.65821 6 2011 46 28.769323 6 2012 46 29.90821 8 2005 60 22.91542 8 2006 60 20.4602 8 2007 60 23.03234 8 2008 60 27.35821 8 2009 60 26.07214 8 2010 60 26.422886 8 2011 60 27.94279 8 2012 60 31.274876 9 2005 89 42.71393 9 2006 89 48.4602 9 2007 89 36.87189 9 2008 89 52.96144 9 2009 89 41.08582 9 2010 89 39.55348 9 2011 89 35.339554 9 2012 89 38.59577 10 2005 69 49.96875 10 2006 69 49.75521 10 2007 69 32.565105 10 2008 69 38.33073 10 2009 69 41.21354 10 2010 69 36.622395 10 2011 69 30.75 10 2012 69 41.85417 11 2005 47 22.8701 11 2006 47 19.7549 11 2007 47 23.02206 11 2008 47 24.845587 11 2009 47 25.30147 11 2010 47 21.73039 11 2011 47 27.27696 11 2012 47 33.12745 12 2005 62 20.906746 12 2006 62 20.377975 12 2007 62 19.36111 12 2008 62 19.849205 12 2009 62 19.07639 12 2010 62 18.710318 12 2011 62 18.669641 12 2012 62 19.320436 13 2005 54 24.41026 13 2006 54 22.71795 13 2007 54 22.615385 13 2008 54 21.48718 13 2009 54 19.641026 13 2010 54 20 13 2011 54 22.66667 13 2012 54 25.02564 15 2005 55 36.111115 15 2006 55 21.01852 15 2007 55 21.481483 15 2008 55 22.685186 15 2009 55 21.481483 15 2010 55 21.38889 15 2011 55 18.796297 15 2012 55 18.055557 16 2005 58 52.45161 16 2006 58 34.258064 16 2007 58 29.6129 16 2008 58 34.258064 16 2009 58 34.45161 16 2010 58 29.709677 16 2011 58 28.16129 16 2012 58 21.87097 17 2005 36 31.25126 17 2006 36 31.45202 17 2007 36 28.84217 17 2008 36 30.64899 17 2009 36 32.790405 17 2010 36 32.857323 17 2011 36 36.872475 17 2012 36 41.75758 18 2005 63 26.03693 18 2006 63 18.958334 18 2007 63 22.035984 18 2008 63 25.482954 18 2009 63 31.207386 18 2010 63 28.99148 18 2011 63 29.79167 18 2012 63 30.89962 * Attempt 1 reg yvar ib2009.year#c.xvar i.STFIPS i.year, cluster(STFIPS) end
HTML Code:
note: 2012.year#c.xvar omitted because of collinearity Linear regression Number of obs = 104 F(11, 12) = . Prob > F = . R-squared = 0.7987 Root MSE = 4.689 (Std. Err. adjusted for 13 clusters in STFIPS) ------------------------------------------------------------------------------ | Robust yvar | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- year#c.xvar | 2005 | .1098391 .1730562 0.63 0.538 -.2672179 .4868962 2006 | .2446919 .1539233 1.59 0.138 -.0906781 .5800619 2007 | .1050133 .0972725 1.08 0.302 -.1069253 .3169519 2008 | .2513997 .1661789 1.51 0.156 -.1106731 .6134725 2009 | .1133386 .1336829 0.85 0.413 -.1779315 .4046087 2010 | .1335541 .1034933 1.29 0.221 -.0919384 .3590466 2011 | .0121195 .0548488 0.22 0.829 -.1073857 .1316248 2012 | 0 (omitted) | STFIPS | 5 | -18.21407 2.587279 -7.04 0.000 -23.85127 -12.57687 6 | -11.17718 4.312132 -2.59 0.024 -20.57251 -1.781851 8 | -11.73156 2.97058 -3.95 0.002 -18.2039 -5.259225 9 | 1.015249 .1916503 5.30 0.000 .5976793 1.43282 10 | 1.624867 2.108153 0.77 0.456 -2.968404 6.218139 11 | -11.09913 4.216307 -2.63 0.022 -20.28567 -1.912582 12 | -18.12493 2.77893 -6.52 0.000 -24.1797 -12.07016 13 | -14.36844 3.545531 -4.05 0.002 -22.09349 -6.64339 15 | -14.18288 3.449706 -4.11 0.001 -21.69914 -6.666618 16 | -4.077157 3.16223 -1.29 0.222 -10.96706 2.81275 17 | -1.197523 5.270384 -0.23 0.824 -12.6807 10.28566 18 | -11.10461 2.683104 -4.14 0.001 -16.95059 -5.258626 | year | 2005 | 3.270064 5.972014 0.55 0.594 -9.741837 16.28196 2006 | -7.650341 4.488798 -1.70 0.114 -17.43059 2.12991 2007 | -1.434293 5.019483 -0.29 0.780 -12.37081 9.50222 2008 | -7.698874 5.075604 -1.52 0.155 -18.75767 3.359917 2010 | -2.293811 2.640422 -0.87 0.402 -8.046797 3.459174 2011 | 5.758627 8.278618 0.70 0.500 -12.27893 23.79619 2012 | 8.485741 8.335906 1.02 0.329 -9.676639 26.64812 | _cons | 30.33711 10.85311 2.80 0.016 6.690209 53.98401 ------------------------------------------------------------------------------
Code:
* Attempt 2 reg yvar ib2009.year##c.xvar i.STFIPS, cluster(STFIPS)
HTML Code:
reg yvar ib2009.year##c.xvar i.STFIPS, cluster(STFIPS) note: 18.STFIPS omitted because of collinearity Linear regression Number of obs = 104 F(11, 12) = . Prob > F = . R-squared = 0.7987 Root MSE = 4.689 (Std. Err. adjusted for 13 clusters in STFIPS) ------------------------------------------------------------------------------ | Robust yvar | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- year | 2005 | 3.270064 5.972014 0.55 0.594 -9.741837 16.28196 2006 | -7.650341 4.488798 -1.70 0.114 -17.43059 2.12991 2007 | -1.434293 5.019483 -0.29 0.780 -12.37081 9.50222 2008 | -7.698874 5.075604 -1.52 0.155 -18.75767 3.359917 2010 | -2.293811 2.640422 -0.87 0.402 -8.046797 3.459174 2011 | 5.758627 8.278618 0.70 0.500 -12.27893 23.79619 2012 | 8.485741 8.335906 1.02 0.329 -9.676639 26.64812 | xvar | .5099317 .0480172 10.62 0.000 .4053113 .6145522 | year#c.xvar | 2005 | -.0034994 .0750769 -0.05 0.964 -.167078 .1600792 2006 | .1313533 .0691458 1.90 0.082 -.0193025 .2820091 2007 | -.0083253 .0848945 -0.10 0.923 -.1932945 .176644 2008 | .1380611 .0915993 1.51 0.158 -.0615166 .3376388 2010 | .0202155 .0441306 0.46 0.655 -.0759368 .1163678 2011 | -.1012191 .1464932 -0.69 0.503 -.4204003 .2179622 2012 | -.1133386 .1336829 -0.85 0.413 -.4046087 .1779315 | STFIPS | 5 | -7.506054 2.25e-14 -3.3e+14 0.000 -7.506054 -7.506054 6 | 6.669513 3.88e-14 1.7e+14 0.000 6.669513 6.669513 8 | .5628257 2.57e-14 2.2e+13 0.000 .5628257 .5628257 9 | 1.808436 1.93e-14 9.3e+13 0.000 1.808436 1.808436 10 | 10.34992 1.89e-14 5.5e+14 0.000 10.34992 10.34992 11 | 6.350973 3.80e-14 1.7e+14 0.000 6.350973 6.350973 12 | -6.623729 2.41e-14 -2.7e+14 0.000 -6.623729 -6.623729 13 | .3055085 3.11e-14 9.8e+12 0.000 .3055085 .3055085 15 | .0944733 3.01e-14 3.1e+12 0.000 .0944733 .0944733 16 | 9.010417 2.73e-14 3.3e+14 0.000 9.010417 9.010417 17 | 20.6151 4.91e-14 4.2e+14 0.000 20.6151 20.6151 18 | 0 (omitted) | _cons | -5.752869 2.974407 -1.93 0.077 -12.23355 .7278081 ------------------------------------------------------------------------------
Comment