Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: What to do if interactive fixed effects are huge?


From   Clive Nicholas <[email protected]>
To   [email protected]
Subject   Re: st: What to do if interactive fixed effects are huge?
Date   Tue, 28 Apr 2009 14:09:37 -0400

Yandi Shen wrote:

> I am dealing with a triple-dimension dataset (country, product and
> year). It is China's imports from countries worldwide at 8-digit
> level. To control for unobservable characteristics, I want to include
> three sets of interactive fixed effects - country/product,
> country/year and product/year - by using command xi: i.var1 * i.var2.
> The problem is the number of product is huge, nearly 5000. I once let
> Stata keep running for a whole night, but still nothing happened.
>
> Is there any more efficient way to create double-interaction terms of
> fixed effects?

You shouldn't need all three interaction terms, since X1*X2 and X1*X3
ought to encompass X2*X3, so you could start by creating just two of
the three interaction terms and see if that's quicker.

> If not, can I do the regression by simply de-meaning variables
> relative to each fixed effects instead of including all these dummies?
> Are following codes correct?
>
> .foreach var of varlist y x {
>       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 my mx, robust

Yes you can, but you could do all of that in one by using Ben Jann's
-center- command, downloadable from SSC. Do note, however, that
de-meaning your variables will purge some of their variation, and
consequently your models will explain less. However, if you have
singleton dummies that drop out of your model and you wished to
include them, you might not have a lot of choice.

-- 
Clive Nicholas

[Please DO NOT mail me personally here, but at
<[email protected]>. Please respond to contributions I make in
a list thread here. Thanks!]

"My colleagues in the social sciences talk a great deal about
methodology. I prefer to call it style." -- Freeman J. Dyson.
*
*   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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index