Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: Modelling of categorical-continuous variable interaction
From
Maarten Buis <[email protected]>
To
[email protected]
Subject
Re: st: Modelling of categorical-continuous variable interaction
Date
Mon, 1 Jul 2013 15:44:27 +0200
If you want to use one #, then it is up to you to include at least one
main effect. I would choose i.l. Then the two models give different
numbers, but the results are equivalent. The first will give the
effects of the xs in groups 1, 2, and 3, while the second gives you
the effect in group 1 and by how much that effect differs from group 1
in groups 2 and 3. You could also use 1 # and both main effects, then
the the first and second models are completely the same. It is not
recommended to use 1 # without any of the main effects.
*------------------ begin example ------------------
sysuse nlsw88, clear
gen byte occat = cond(occupation < 3 , 1, ///
cond(inlist(occupation, 5, 6, 8, 13), 2, 3)) ///
if occupation < .
label variable occat "occupation in categories"
label define occat 1 "high" ///
2 "middle" ///
3 "low"
label value occat occat
reg wage i.occat i.occat#c.grade
reg wage i.occat##c.grade
lincom grade + 2.occat#c.grade
lincom grade + 3.occat#c.grade
reg wage i.occat grade i.occat#c.grade
*------------------- end example -------------------
* (For more on examples I sent to the Statalist see:
* http://www.maartenbuis.nl/example_faq )
Hope this helps,
Maarten
On Mon, Jul 1, 2013 at 3:10 PM, Daniel Yue <[email protected]> wrote:
> Dear Statalisters,
>
> I would love your advice my model of the following specifications:
>
> y = i + t + (I*x1) + (I*x2) + (I*x3)
>
> where i and t are firm- and time-fixed effects, respectively, “I” is an indicator variable with values 0-2 and x1-x3 are the three IVs. “I” are supposed to illustrate three “categories” the firms are put into, depending on firm performance relative to two reference points: I==1 if performance of the firm is below a both reference points, I==2 if it is in between, I==3 if it is above. What I want to find out is whether y’s reaction to x1 x2 x3 differs in strength, i.e. if the slope of the coefficients for x1-x3 are different, depending on the “category” of the firm (hence the indicators),
> The data is in panel format. I – xtset – the dataset and ran the following in Stata 12:
>
> xtreg y I#c.x1 I#c.x2 I#c.x3, fe
>
> My questions:
>
> 1.Do the coefficients for I#x1 I#x2 I#x3 really measure what I want them to, as described above?
>
> 2.If I instead run
>
> xtreg y I##c.x1 I##c.x2 I##c.x3, fe
>
> the results seem to differ by a lot, although I had expected them to be the same. What is wrong?
>
> 3. I also ran
>
> by I: xtreg y x1 x2 x3, fe
>
> because I thought the results there should be the same as with the original equation. Again, there are not. Why not? What am I missing?
>
> Thanks for your consideration!
>
> Daniel
> *
> * For searches and help try:
> * http://www.stata.com/help.cgi?search
> * http://www.stata.com/support/faqs/resources/statalist-faq/
> * http://www.ats.ucla.edu/stat/stata/
--
---------------------------------
Maarten L. Buis
WZB
Reichpietschufer 50
10785 Berlin
Germany
http://www.maartenbuis.nl
---------------------------------
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/