Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# st: RE: AW: RE: xtivreg2 and interaction terms

 From "Schaffer, Mark E" To Subject st: RE: AW: RE: xtivreg2 and interaction terms Date Thu, 16 Sep 2010 16:53:51 +0100

```Michael,

> -----Original Message-----
> From: owner-statalist@hsphsun2.harvard.edu
> [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of
> Klien, Michael
> Sent: 16 September 2010 13:21
> To: 'statalist@hsphsun2.harvard.edu'
> Subject: st: AW: RE: xtivreg2 and interaction terms
>
> Dear Mark,
>
> Thanks for your comments. Just to be a little more specific,
> the matlab routine I used demeans all X,Y data except the
> dummy d, then interacts the demeaned spatial lag with d and
> then estimates. Is such an approach incorrect or how does the
> interpretation of the coefficients change compared to a
> typical xt,fe commands in stata, where I supply
> dummy-interacted variables?

What your matlab routine does is nonstandard and confusing, at least to me.  And I'm not really sure what it's estimating.

The FE estimator is pretty standard.  It gives you exactly the same results as including an intercept dummy for each observational unit.  There are various ways to conceptualize the FE estimator.  Maybe the most helpful in this context is te "error components" interpretation - the FE estimator models the error structure in the estimating equation as having two components, u_i and e_it, each with its own variance.

The reason this may be helpful here is that it makes clear that the FE estimator is about modelling the behaviour of the error term.  The within transformation is a shortcut to obtaining the FE coefficient estimates, but that perhaps confuses things, because it conflates the calculation technique (the within transformation) with the modelling (agents respond to deviations from their means and not to levels).  My reading of your matlab routine is that it is doing the latter, i.e., building responses to deviations into the model.  I am not sure what it is you want your model to do, but I suspect you probably didn't intend this.

There's a useful related discussion in the Stata manual entry for xtreg - check out the discussion of the equation that has one beta for between-changes (cross-section) another beta for within-changes.

Cheers,
Mark

>
> Best Wishes
> Michael
>
> -----Ursprüngliche Nachricht-----
> Von: owner-statalist@hsphsun2.harvard.edu
> [mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von
> Schaffer, Mark E
> Gesendet: Mittwoch, 15. September 2010 23:00
> An: statalist@hsphsun2.harvard.edu
> Betreff: st: RE: xtivreg2 and interaction terms
>
> Michael,
>
> > -----Original Message-----
> > From: owner-statalist@hsphsun2.harvard.edu
> > [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Klien,
> > Michael
> > Sent: 15 September 2010 16:14
> > To: 'statalist@hsphsun2.harvard.edu'
> > Subject: st: xtivreg2 and interaction terms
> >
> > Dear statalist users,
> >
> > I am estimating a spatial lag model with fixed effects by
> IV/GMM using
> > xtivreg2:
> > xtivreg2 y x (wy = wx),fe
> > This estimation is fine. The problem occurs when I estimate the
> > spatial lag with a dummy interaction (d):
> > xtivreg2 y x (wy_d0 wy_d1 = wx_d0 wx_d1),fe The resulting
> coefficient
> > estimates for wy_d0 and wy_d1 are almost the same, which is very
> > different from my ML results in matlab. I found out that the
> > difference between the two is that the matlab routine first demeans
> > all data and then generates the interaction terms. With
> xtivreg2 and
> > similar commands I need to input the interacted variable, which is
> > only demeaned afterwards. If I demean my data manually in stata and
> > use
> > ivreg2 the IV results are much closer to the ML results.
> > So my question is, what is the correct approach? First
> demean the data
> > and then interact or the other way round? I was unable to find a
> > reference for such a case.
>
> If you want to use the "fixed effects" estimation, then as a
> matter of definition you have to group-demean all your
> variables, whether or not they are standard variables or interactions.
>
> That said, how you define your interaction terms is up to
> you.  It's common practice, for example, to define
> interactions around sample means, i.e., you demean the
> variables before multiplying them together to get the
> interaction term.
>
> HTH,
> Mark
>
> >
> > Thanks very much in advance!
> > Michael
> >
> > *
> > *   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/
> >
>
>
> --
> Heriot-Watt University is a Scottish charity registered under
> charity number SC000278.
>
>
> *
> *   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/
>
> *
> *   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/
>

--
Heriot-Watt University is a Scottish charity
registered under charity number SC000278.

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