Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.

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

 From Austin Nichols To statalist@hsphsun2.harvard.edu Subject Re: st: RE: AW: RE: xtivreg2 and interaction terms Date Thu, 16 Sep 2010 14:51:03 -0400

Michael,

I think Mark refers to [XT] p 447:
"
All this would seem to leave the between estimator of (2) with no role
(except for a minor,
technical part it plays in helping to estimate [the variance of the u_i] and
[the variance of the e_it], which are used in the calculation of theta
[a component of
weights placed on within and between estimates in RE], on
which the random-effects estimates depend). Let’s, however, consider a
variation on (1):
y_it =  a + \bar{x_i} b1 + ( x_it - \bar{x_i} )b2 + u_i + e_it
In this model, we postulate that changes in the average value of x for
an individual have a different
effect from temporary departures from the average. In an economic
situation, y might be purchases
of some item and x income; a change in average income should have more
effect than a transitory
change. In a clinical situation, y might be a physical response and x
the level of a chemical in the
brain; the model allows a different response to permanent rather than
transitory changes.
"
But if you are estimating a spatial lag model, you may want to read:
http://www.stata.com/meeting/snasug08/drukker_spatial.pdf
esp. page 21 on.

On Thu, Sep 16, 2010 at 11:53 AM, Schaffer, Mark E
<M.E.Schaffer@hw.ac.uk> wrote:
> 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
>>

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