Statalist


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

Re: st: How to graph interactions after regression


From   Maarten buis <maartenbuis@yahoo.co.uk>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: How to graph interactions after regression
Date   Wed, 17 Jun 2009 15:55:00 +0000 (GMT)

--- On Wed, 17/6/09, lschoele@rumms.uni-mannheim.de wrote:
> I included 6 interaction terms in my regression. Two were
> significant so I would like to graph them. This is an
> example for the  graph I would like to generate 
> http://en.wikipedia.org/wiki/File:Interaction_effect.gif

*-------------- begin example ----------------------------
sysuse auto, clear
replace price = price/1000
recode rep78 (1/3=0) (4/5=1) 
gen repXfor = rep78*foreign

reg price rep78 foreign repXfor mpg
adjust mpg, by(rep78 foreign) gen(pricehat)

twoway line pricehat rep78 if foreign == 0, sort || ///
       line pricehat rep78 if foreign == 1, sort    ///
       legend(order(1 "domestic" 2 "foreign"))      ///
       ytitle(predicted price)
*--------------- end example ----------------------------

Hope this helps,
Maarten

-----------------------------------------
Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
Germany

http://home.fsw.vu.nl/m.buis/
-----------------------------------------


      

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index