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: Followup to: simple slopes between continuous variable and dichotomous moderator
From
Richard Williams <[email protected]>
To
[email protected], [email protected]
Subject
Re: st: Followup to: simple slopes between continuous variable and dichotomous moderator
Date
Wed, 19 Jun 2013 23:07:10 -0500
I'm not seeing the problem. I get identical
results with both approaches. Are you getting
something different, or am I misunderstanding the problem? Here is what I get.
. reg price c.mpg#i.foreign
Source | SS df MS Number of obs = 74
-------------+------------------------------ F( 2, 71) = 14.42
Model | 183435109 2 91717554.6 Prob > F = 0.0000
Residual | 451630287 71 6360989.96 R-squared = 0.2888
-------------+------------------------------ Adj R-squared = 0.2688
Total | 635065396 73 8699525.97 Root MSE = 2522.1
-------------------------------------------------------------------------------
price | Coef. Std.
Err. t P>|t| [95% Conf. Interval]
--------------+----------------------------------------------------------------
foreign#c.mpg |
0 | -329.0368 61.46843 -5.35
0.000 -451.6014 -206.4723
1 | -250.7077 51.21966 -4.89
0.000 -352.8368 -148.5786
|
_cons
| 12595.97 1235.936 10.19 0.000 10131.58 15060.35
-------------------------------------------------------------------------------
. margins i.foreign, dydx(mpg)
Average marginal effects Number of obs = 74
Model VCE : OLS
Expression : Linear prediction, predict()
dy/dx w.r.t. : mpg
------------------------------------------------------------------------------
| Delta-method
| dy/dx Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
mpg |
foreign |
0 | -329.0368 61.46843 -5.35 0.000 -449.5127 -208.5609
1 | -250.7077 51.21966 -4.89 0.000 -351.0964 -150.319
------------------------------------------------------------------------------
At 09:53 PM 6/19/2013, David de Jong wrote:
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/
-------------------------------------------
Richard Williams, Notre Dame Dept of Sociology
OFFICE: (574)631-6668, (574)631-6463
HOME: (574)289-5227
EMAIL: [email protected]
WWW: http://www.nd.edu/~rwilliam
*
* 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/