# st: Within-spell or de-meaning for three-way fixed effects model

 From "Yandi.SHEN" To statalist@hsphsun2.harvard.edu Subject st: Within-spell or de-meaning for three-way fixed effects model Date Wed, 22 Apr 2009 17:27:53 +0200

```Hi Statalist,

I am trying to examine the effect of a import tariff-free policy
granted to some products of African LCDs. Basically, I am using a
triple-difference approach with a three-dimensional panel dataset
paper - Practical Fixed-Effects Estimation Methods for the Three-Way
Error-Components Model, and I think the within-spell fixed effects
estimate is the most suitable method. So, I tried to run the
regression with following commands:

.egen s=group(country, product)
.xi: xtreg lnimp cptdummy i.year, fe i(s)
(where, lnimp is the log of import, and cptdummy,  triple-interaction
of three dummy variables, is the unique explanatory variable)

And, following prof. Frazer's advice, I also tried another way of
introducing three sets of double-interactive fixed effects
(country-product, country-year and product-year) and simply de-meaning
relative to each fixed effects.

.foreach var of varlist lnimp cptdummy {
bysort pcode ccode: egen m1`var' = mean(`var')
bysort year ccode: egen m2`var' = mean(`var')
bysort year pcode: egen m3`var' = mean(`var')
gen m`var' = `var' - m1`var' - m2`var' -m3`var'
}
.reg mlnimp mcptdummy, robust

The problem is these two methods produce very different output (even
with opposite signs). Could someone tell me why? Is there something
wrong in my codes? If not, which method is preferred?

And the R-square in both case are very small. Is this only because
some other important variables, such as standard gravity variables,
are missed, or something else?

I hope someone could help me. Thanks in advance.

Yandi

--
Yours.
Ms. Yandi SHEN
Mobiel: +39-3891519209
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```