Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | David de Jong <davidcdejong@gmail.com> |
To | statalist@hsphsun2.harvard.edu |
Subject | st: Followup to: simple slopes between continuous variable and dichotomous moderator |
Date | Wed, 19 Jun 2013 22:53:18 -0400 |
Dear STATA folks, I’m trying to figure out how to plot simple slopes to unpack an interaction between a continuous and categorical variable in a regression analysis. Let’s say I want to look at the simple slopes for price on mpg, for both foreign and domestic cars. In my searches, I came across this exchange from a few years ago: --- On Tue, 1/2/11, Rodrigo Isidor wrote: > Has anyone written a program to calculate simple slopes for > interactions between a continuous variable and dichotomous > moderator in linear regression analysis? To my knowledge, > sslope from Jeffrey Simons is just for continuous > variables. There is no need to write a program for that. You can use Stata's factor variable notation for it. In the example below the first slope for mpg is for domestic cars and the second is for foreign cars. *------------ begin example -------------- sysuse auto, clear reg price c.mpg#i.foreign *------------- end example --------------- Hope this helps, Maarten [end previous exchange] I tried that approach, as well as using -margins-, with the following: margins i.foreign, dydx(mpg) These two approaches produced very different results. The –margins- approach gives me results more consistent with results from simply splitting the file by foreign and looking at the correlation between price and mpg. I’m sure that I’m missing something. Can anyone advise as to why these procedures are giving me such different results, and if I’m doing either incorrectly? Thank you, David de Jong ~ Department of Clinical and Social Sciences in Psychology University of Rochester 498c Meliora Hall Rochester, NY 14627 * * 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/