# Thread: Question on dummy variables

1. ## Question on dummy variables

Dear all,

I have a question I met in my project.

I have a panel data, including 20 cities and there are 18 years OBS (x and y) for each city. I want to establish a equation with dummy variables for control time-invariant city-specific characteristics and control for time trend.

Thus my equation is:
Y = a1 + a2*X + a3*D_city + a4*D_year (1)
Where, D_city and D_year are dummiy variables for controling variant of city and time. So I have two dummy variables.

But If I do that, is it correct that I actually assumed a common time trend for each city? (question 1)
It maybe not correct since each city has their own time trend features. So I want to give a city-specific time trend.

Thus I have another function form:
Y = a1 + a2*X + a3*D_city + a4*D_city*year (2)
Others are the same with previous function except the last term which I multiple D_city with value of year.
So the equ(2) could change to
Y = a1 + a2*X + D_city(a3 + a4*year) (3)
In the form, can I say I considered city-specific time trend? (question 2)

Finally, I tried the equ(2) in R by inputting:
D_city<-as.factor(data\$city)
result<-lm(Y~X + D_city + D_city*year,data)
But I don't think R gave me the result I need. How can I do this? (question 3)

Thanks!
Regards,
Tianyi

2. Nobody knows?

3. You need 1 less dummy variables for each case. What is your time trend? Every year? every two years? ....

Since you have 20 cities, you need 19 dummy variables to differentiate cities. How ever you break up the years you will need 1 less dummy variable.

4. Originally Posted by dwsmith
You need 1 less dummy variables for each case. What is your time trend? Every year? every two years? ....

Since you have 20 cities, you need 19 dummy variables to differentiate cities. How ever you break up the years you will need 1 less dummy variable.

I know I have to give one less dummy. But my question is people have three ways to control year by setting dummies. I don't know the difference and how to deal with them.
http://people.few.eur.nl/vollebergh/..._EKC%20ERE.pdf
In page 4, G(t) is function for controlling time trend.
In page 9, Note3, there are three functions for G(t); 1) time-fixed effects, 2) general time trend, 3) country-specific trend.
I think what you said is the first one, assuming time-fixed effects (break up years by setting dummies). But how about the second and the third?
To my understanding, for the second specification, ones multiple one set Beta with value of year, and the third one is to multiple country dummies with year for representing the time trend vary with countries. Is it correct?

Regards,
Tianyi

5. Don't know about general but country specific would be just having a country dummy variable.

6. Originally Posted by dwsmith
Don't know about general but country specific would be just having a country dummy variable.
Yes, I think so. Country-specific time trend is country-dummy multiples year value (Beta_i is just the country-dummy in that paper). Maybe general time trend maybe just he year series (Beta would be one??!!No idea).
Another question is what the difference when the three time control function involved in the equation? Do they represent different meaning?

Finally, dwsmith, THANK YOU VERY MUCH!!!!!

7. ## creating country dummies

Originally Posted by zhangty
Yes, I think so. Country-specific time trend is country-dummy multiples year value (Beta_i is just the country-dummy in that paper). Maybe general time trend maybe just he year series (Beta would be one??!!No idea).
Another question is what the difference when the three time control function involved in the equation? Do they represent different meaning?

Finally, dwsmith, THANK YOU VERY MUCH!!!!!

Hello,
I just read this post. So I hope you are also familiar with my question: I'm having a panel data set with different country pairs over 10 years. I know already how to create the year dummies in STATA. However, I was wondering how to create the country pair dummies. Is it jsut the amount of countrypairs I have?