Time Trend Variable in Balanced Panel Data, Stata

user2624528 picture user2624528 · Jul 27, 2013 · Viewed 14.3k times · Source

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?

Answer

Nick Cox picture Nick Cox · Jul 27, 2013

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.