3

I have some balanced panel data and want to include trend variable into my regression. However, I have 60 districts in 7 year time period and I am not sure how to include trend variable. Year variable is repetitive as expected and for 2005-2011. I am thinking about the following;

    gen t = . 
    replace t = 1 if year==2005
    replace t = 2 if year==2006

up to year 2011 and it gives me t variable from 1 to 7, for 180 different panels in the data.

My question: is it OK to include trend variable as I described above or should I directly throw year variable into regression?

smci
  • 32,567
  • 20
  • 113
  • 146
user2624528
  • 31
  • 1
  • 1
  • 2

2 Answers2

2

Your variable t is just

 gen t = year - 2004 

and can be obtained in one line as above. Your variable t has one small advantage over year: if you regress a variable on t the intercept refers to values in 2003, which is a gain on referring to values in year 0, which is way outside the range of the data.

Nick Cox
  • 35,529
  • 6
  • 31
  • 47
1

In panel data analysis we call that a time effect. If you include only dummy variables for individual districts then they are called individual effects (in your case district effects). So, including either individual effects or time effect in the panel data is called one way fixed effects whereas including both is called two way fixed effects. In Stata you do the following:

use http://dss.princeton.edu/training/Panel101.dta
reg y x1 i.year # for time effect
reg y x1 i.country # for country effect (in your case district effect)
reg y x1 i.year i.country #two way fixed effect

For details see tutorial from UCLA.

Nick Cox
  • 35,529
  • 6
  • 31
  • 47
Metrics
  • 15,172
  • 7
  • 54
  • 83