Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Graphing curvilinear lines with moderators or interaction


From   "Douglas Thomas" <Thomas@mgt.unm.edu>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: Graphing curvilinear lines with moderators or interaction
Date   Wed, 9 Mar 2005 17:06:04 -0700

Dear Stata user:
I am running the following regression: dependent variable is firm
performance (roa) and am interested in how gender diveristy (cengendiv)
moderates (gendivintl=cengendiv*expsal) the curvilinear relationship
between international diversification (expsal and expsal2) and firm
performance

regress roa perstec equitfo tmttot distance lsales grupo3 grupo4
cengendiv expsal expsal2 gendivintl intl2gendiv sector1-sector16
year1-year7 if grupo==2 | grupo==3 | grupo==4, robust

I am using the following to try and graph 3 different lines to show the
moderating effect with international diversification on the x axis, firm
performance on the y axis and one line on the graph representing low
levels of gender diversity (mean-1sd), average levels (mean), and high
levels (mean+1sd) - all I am graphing now is the linear effect - not the
curvilinear effect - what do I need to change in the program below to
get the desired effect?


*get mean and sd for computing 1sd below mean, mean, 1sd above mean
summarize cengendiv
local mcengendiv  = r(mean)
local sdcengendiv = r(sd)

*create "yhat1", predicted values at 1sd below mean
local cengendiv_at = `mcengendiv'-`sdcengendiv'
replace gendivintl = expsal*`cengendiv_at'
postgr3 expsal, x(cengendiv=`cengendiv_at') asis(expsal gendivintl)
gen(yhat1)
label variable yhat1 "Low Gender Diversity"

*create "yhat2", predicted values at mean
local cengendiv_at = `mcengendiv'
replace gendivintl = expsal*`cengendiv_at'
postgr3 expsal, x(cengendiv=`cengendiv_at') asis(expsal gendivintl)
gen(yhat2)
label variable yhat2 "Average Gender Diversity"

*create "yhat3", predicted values at 1sd above mean
local cengendiv_at = `mcengendiv'+`sdcengendiv'
replace gendivintl = expsal*`cengendiv_at'
postgr3 expsal, x(cengendiv=`cengendiv_at') asis(expsal gendivintl)
gen(yhat3)
label variable yhat3 "High Gender Diversity"

* show graph of 3 regression lines
line yhat1 yhat2 yhat3 expsal, clcolor(black black black) clwidth(vvthin
medthick vthick)

* show that slopes are right, compare to original regression
* and manually compute

*slope for expsal - 9.47*slope for gendivintl
regress yhat1 expsal

* slope for expsal 
regress yhat2 expsal

* slope for expsal + 9.47*slope for gendivintl
regress yhat3 expsal


Sincerely,

Doug Thomas
Assistant Professor
Anderson Schools of Management
University of New Mexico
MSC05 3090
1924 Las Lomas NE
Albuquerque NM 87131-0001
Phone: (505) 277-8892
Fax: (505) 277-7108
thomas@mgt.unm.edu

 

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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