Hello everyone,
I'm currently working on a Gravity Model and I'm quite confused about how to properly set up the fixed effects model.
I have bilateral trade data in the following form:
Now, I would like to add time fixed effects and afterwards country fixed effects in a separate regression.
My understanding is, I have to use xtset and then xtreg instead of reg, because I have time values. So I set up:
For the time fixed effects I then use
For the country fixed effects I use
Now, I noticed the results of these two regressions are exactly the same. Which, after I thought about it, makes sense, as I set up xtset with PairID and Year.
I searched the forum and the internet about how to set up fixed effects in a bilateral model (or gravity model) properly and came across the following code:
This code is from the practical guide to trade policy analysis https://vi.unctad.org/tpa/web/vol1/vol1home.html
I assume the regression above would be for country fixed effects, so then only time fixed effects would be:
I also came across the idea of setting up the country fixed effects like this:
But I thought i.Var1##i.Var2 is interacting these two with each other, so I'm not sure if this code is right at all.
I thought using i.Variable automatically treats the variable as a dummy, so I assume using Year_* instead of i.Year is the same, but Year_* is the "manual" way instead of the "automatic" way. Is this assumption right?
I'm confused which regressions are "right" when using fixed effects for the gravity model and where my errors in my first assumptions are. I hope someone could clarify this.
Any help is much apprechiated, thank you very much in advance!
I'm currently working on a Gravity Model and I'm quite confused about how to properly set up the fixed effects model.
I have bilateral trade data in the following form:
Country_i | Country_j | Year | DepententVar | IndepententVar | PairID |
A | B | 2000 | 1232 | 2736 | AB |
A | B | 2001 | 1234 | 2536 | AB |
A | B | 2002 | 2716 | 2352 | AB |
B | C | 2000 | 3242 | 3435 | BC |
B | C | 2001 | 2342 | 2354 | BC |
B | C | 2002 | 2344 | 3345 | BC |
My understanding is, I have to use xtset and then xtreg instead of reg, because I have time values. So I set up:
Code:
xtset PairID Year, yearly
Code:
xtreg DependentVar IndependentVar i.Year, fe robust
Code:
xtreg DependentVar IndependentVar i.Country_i i.Country_j i.Year, fe robust
I searched the forum and the internet about how to set up fixed effects in a bilateral model (or gravity model) properly and came across the following code:
Code:
tab (Year), gen (Year_) egen expyear = group(Country_i Year) egen impyear = group(Country_j Year) tab(expyear), gen(expyear_) tab(impyear), gen(impyear_) xtreg DependentVar IndependentVar impyear_* expyear_* Year_*, robust
I assume the regression above would be for country fixed effects, so then only time fixed effects would be:
Code:
xtreg DependentVar IndependentVar Year_*, robust
Code:
xtreg DependentVar IndependentVar i.Country_i##i.Country_j i.Year, fe robust
I thought using i.Variable automatically treats the variable as a dummy, so I assume using Year_* instead of i.Year is the same, but Year_* is the "manual" way instead of the "automatic" way. Is this assumption right?
I'm confused which regressions are "right" when using fixed effects for the gravity model and where my errors in my first assumptions are. I hope someone could clarify this.
Any help is much apprechiated, thank you very much in advance!
Comment