Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down at the end of May, and its replacement, **statalist.org** is already up and running.

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

From |
Maarten Buis <maartenlbuis@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: graphing interaction when direct effect is curvilinear |

Date |
Wed, 12 Sep 2012 10:47:51 +0200 |

On Wed, Sep 12, 2012 at 9:48 AM, L.M.A. Mulotte wrote: > I would like to graph interaction effects for an OLS when the direct effect is curvilinear. > > Specifically, I would like to graph the impact of Z on the curvilinear relationship between Y and X, for Z being held at means plus 1 one SD and at means minus 1 SD, and all other variables being held constant. I would be very grateful for any advice. <snip> > The graph I would like to draw has the following characteristics > - Vertical axis is ln_wage > - Horizontal axis is age > - one inverted-U shaped curve for birth_yr held at means plus one SD, keeping other variables constant. > - one inverted-U shaped curve curve for birth_yr held at means minus one SD, keeping other variables constant. Here is an alternative graph you could consider: *-------------------- begin example ----------------- sysuse nlsw88, clear //estimate the model glm wage c.ttl_exp##c.ttl_exp##c.grade##c.grade /// i.race south hours union, /// link(log) vce(robust) // predict wage tempfile marg qui margins, at(ttl_exp==(.1 .5 1 2(2)28) /// grade==(0(2)18) /// race==1 south==0 /// hours==40 union==1) _marg_save, saving(`marg') clear use `marg' // graph wage twoway contour _marg _at1 _at2, /// ccuts(0(1)14) xlab(0(5)15) ylab(0(5)25) /// plotregion(margin(zero)) name(pred, replace) // that graph looks pretty, but beware: // it contains quite a few extrapolations to // areas where there is no data sysuse nlsw88 scatter ttl_exp grade, xlab(0(5)15) ylab(0(5)25) /// name(scatter, replace) *--------------------- end example ------------------ (For more on examples I sent to the Statalist see: http://www.maartenbuis.nl/example_faq ) I learned this from Bill R. (<http://econpapers.repec.org/paper/bocchic11/19.htm>) Notice that you are not using an OLS but a linear regression model; the former is the algorithm used to compute the coefficients, the later is the model. Also notice that it is usually a bad idea to use linear regression on a log transformed dependent variable. Much better to use -glm- with the -link(log)- option or -poisson-, both with -vce(robust)-. See: Nicholas J. Cox, Jeff Warburton, Alona Armstrong, Victoria J. Holliday (2007) "Fitting concentration and load rating curves with generalized linear models" Earth Surface Processes and Landforms, 33(1):25--39. <dx.doi.org/10.1002/esp.1523> or: <http://blog.stata.com/2011/08/22/use-poisson-rather-than-regress-tell-a-friend/> Hope this helps, Maarten --------------------------------- 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/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**References**:**st: graphing interaction when direct effect is curvilinear***From:*"L.M.A. Mulotte" <L.Mulotte@uvt.nl>

- Prev by Date:
**st: Calculate average elements matrix (below the diagonal )** - Next by Date:
**Re: st: Different likelihood estimates from -mixlpred- and own calculations using -mixlbeta-** - Previous by thread:
**Re: st: graphing interaction when direct effect is curvilinear** - Next by thread:
**st: Calculate average elements matrix (below the diagonal )** - Index(es):