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

 From "Yandi.SHEN" To statalist@hsphsun2.harvard.edu Subject Re: st: What to do if interactive fixed effects are huge? Date Wed, 29 Apr 2009 18:36:05 +0200

```Thanks very much for Clive's advice.

But I am afraid the product dimension is too huge. I even cannot
create a set of dummies for product fixed effects by xi: i.product,
after setting up the maximum memory and matsize. Does this mean I have
no choice but  choose to de-mean the variables?

Another problem is that in my case (triple-difference approach, DDD),
there is only one explanatory variable, i.e. the triple interaction
term of three dummy variables. Will de-meaning still make sense?

Yandi

On Tue, Apr 28, 2009 at 8:09 PM, Clive Nicholas
> 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
> 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
> <clivenicholas@hotmail.com>. 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/
>

--
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/
```