Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# st: 3-way continuous interaction - comparing simple slopes

 From Roman Wörner To statalist@hsphsun2.harvard.edu Subject st: 3-way continuous interaction - comparing simple slopes Date Tue, 21 May 2013 20:58:43 +0200

```Dear Statalister,

```
I am a student and in my current research project I have to deal with a three-way continuous interaction. I found some material on the website of UCLA (http://www.ats.ucla.edu/stat/stata/faq/con3wayb.htm) where they explain how to use the -lincom- command to calculate simple slopes. Furthermore, they show how to use -lincom- to compare two simple slopes (I attached the code at the end of the message). This material was extremely helpful to me (how to put Aiken/West 1991 and Cohen et al. 2003 into practice).
```

My question is as follows: to my understanding

*lincom (\$HzHw)-(\$HzLw)*

```
tests whether the two slopes are different. What I actually want to test is not whether the two slopes are different but whether one slope is "steeper" than the other (my hypothesis is that two variables complement each other; with an increase in the third variable the complementarity effect becomes weaker). I would be very grateful for any advice on how to adapt the procedure as described down below or any other technique which does the trick.
```
```
I am fairly new to STATA and statistics in general - so my appologies if this question sounds very basic to most of you.
```
Thanks in advance and kind regards,

Roman

--

use http://www.ats.ucla.edu/stat/stata/notes/hsb2, clear

rename write y
rename math w
rename science z
rename socst v1
rename ses v2

generate xz  = x*z
generate xw  = x*w
generate zw  = z*w
generate xzw = x*z*w

regress y x z w xz xw zw xzw v1 v2

quietly sum x
global hi=r(max)
global lo=r(min)
quietly sum w
global Hw=r(mean)+r(sd)
global Lw=r(mean)-r(sd)
quietly sum z
global Hz=r(mean)+r(sd)
global Lz=r(mean)-r(sd)
quietly sum v1
global m1=r(mean)
quietly sum v2
global m2=r(mean)

global HzHw "x + (\$Hz)*xz + (\$Hw)*xw + (\$Hz)*(\$Hw)*xzw"
global HzLw "x + (\$Hz)*xz + (\$Lw)*xw + (\$Hz)*(\$Lw)*xzw"
global LzHw "x + (\$Lz)*xz + (\$Hw)*xw + (\$Lz)*(\$Hw)*xzw"
global LzLw "x + (\$Lz)*xz + (\$Lw)*xw + (\$Lz)*(\$Lw)*xzw"

/* simple slopes */
lincom \$HzHw /* slope 1 */
global b1 = r(estimate)
lincom \$HzLw /* slope 2 */
global b2 = r(estimate)
lincom \$LzHw /* slope 3 */
global b3 = r(estimate)
lincom \$LzLw /* slope 4 */
global b4 = r(estimate)

/* differences in simple slopes */
lincom (\$HzHw)-(\$HzLw)  /* a) HzHw vs HzLw */
lincom (\$HzHw)-(\$LzHw)  /* b) HzHw vs LzHw */
lincom (\$HzLw)-(\$LzLw)  /* c) HzLw vs LzLw */
lincom (\$LzHw)-(\$LzLw)  /* d) LzHw vs LzLw */
lincom (\$HzHw)-(\$LzLw)  /* e) HzHw vs LzLw */
lincom (\$HzLw)-(\$LzHw)  /* f) HzLw vs LzHw */*

*
*   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/
```