Moderated Mediation Model 2 in Preacher, et al. (2007)

1,090 views
Skip to first unread message

Jesse Canchola

unread,
Jun 13, 2013, 6:34:40 PM6/13/13
to lav...@googlegroups.com
Greetings,

I would like to compare the lavaan results for Model 2 from Preacher et al. (2007)* and their SPSS/SAS macro results (which I can run with a contrived data set). 

Would you have some sample code similar to your code here:

http://lavaan.ugent.be/tutorial/mediation.html

but for the Model 2, Panel B? 

Assume both X and W are continuous to begin with  and where it is implied that the regressions are (my expression #):

M = a0 + a1 * X + a2 * W + a3 * XW + r
    = a0 + (a1 + a3 * W) * X + a2 * W + r       (1)
 
Y = b0 + c1' * X + c2' * W + c3' * XW + b1 * M + r    
    = b0 + (c1' + c3' * W) * X + c2' * W + b1 * M  r       (2)

where Y and M are measured with error, r and a0, b0, b1, c1', c2' , c3'  are estimated coefficients from (1) and (2).

From (1), it follows that the conditional effect of X on M is:
(a1 + a3 * W)           (3)

and the effect of M on Y, from formula (2) is
b1     (4)

and, therefore, the conditional indirect effect of X on Y is the product of (3) and (4) or:

f(theta|X) = b1 * (a1 + a3 * W)         (5)

and the conditional direct effect of X on Y is from formula (2):

(c1' + c3' * W)     (6)

or Preacher, et al. formula on page 197*.

Thank you,
Jesse

* Preacher, K. J., Rucker, D. D., & Hayes, A. F. (2007). Addressing
moderated mediation hypotheses: Theory, methods, and prescriptions.
Multivariate Behavioral Research, 42, 185-227.

Jesse Canchola

unread,
Jun 19, 2013, 6:12:45 PM6/19/13
to lav...@googlegroups.com
This looks very promising as R gives more flexibility (albeit less description and breakdown).  My first stab at the comparisons shows excellent consistency of estimates.

A description of the uploaded files:
Generic data set used:  
1. Test_Model8.csv  <comma delimited file used in R>
2. Test_Model8.sav  <SPSS system data file>

Results (PDF format)
3.  Preacher_Model2_Hayes_Model8_Lavaan_19Jun2013A.pdf   <lavaan results>
4.  Preacher_Model2_Hayes_Model8_SPSS_19Jun2013A.pdf <SPSS results>

Code used:

# BEGIN R CODE
# Model 2 in Preacher et al. 
# corresponding to Model 8 in Hayes
library(lavaan)
Data4_8 <- read.csv("C:/temp/Test_Model8.csv")
model8 <-  '# Direct effects
             Y ~ c1*X
             Y ~ c2*W
             Y ~ c3*XW
           # Mediator
             M ~ a1*X
             M ~ a2*W
             M ~ a3*XW
             Y ~ b1*M
           # Conditional Effect of X on M
           #  at specified levels of W
             CEXM1 := a1 + a3*1.2642
             CEXM2 := a1 + a3*2.0715
             CEXM3 := a1 + a3*2.8788
           # Conditional Indirect Effect of X on Y 
           #  at specified levels of W
             CIEXY1 := b1*(a1+a3*1.2642)
             CIEXY2 := b1*(a1+a3*2.0715)             
             CIEXY3 := b1*(a1+a3*2.8788)
           # Conditional Direct Effect of X on Y
           #  at specified levels of W
             CDEXY1 := c1 + c3*1.2642
             CDEXY2 := c1 + c3*2.0715
             CDEXY3 := c1 + c3*2.8788
           # Indirect Effect of Highest Order Interaction
             IE_HiOrd_Intxn := a3*b1
         '
fit8 <- sem(model8, data = Data4_8, se = "bootstrap")
summary(fit8)
# END R CODE

* BEGIN SPSS CODE .
* DOWNLOAD HAYES SPSS PROCESS MACRO AT: .
* Run PROCESS macro first .
GET FILE = "C:\temp\Test_Model8.sav" .
DATASET NAME DataSet1 WINDOW=FRONT. 

* mediation moderation model 8 .
PROCESS vars = Y  X  M W
  /y=Y
  /x=X
  /m=M
  /w=W
  /model=8
  /total=1
  /boot=1000 .
EXECUTE .
* END SPSS CODE .

Probably a good idea to produce a table with side-by-side results.

Jesse
Test_Model8.csv
Test_Model8.sav
Preacher_Model2_Hayes_Model8_SPSS_19Jun2013A.pdf
Preacher_Model2_Hayes_Model8_Lavaan_19Jun2013A.pdf

Jesse Canchola

unread,
Jun 19, 2013, 6:17:22 PM6/19/13
to lav...@googlegroups.com
I have attached the actual SPSS output.  The previous output only had the code...(oops!)


On Thursday, June 13, 2013 3:34:40 PM UTC-7, Jesse Canchola wrote:
Preacher_Model2_Hayes_Model8_SPSS_19Jun2013B.pdf

yrosseel

unread,
Jun 20, 2013, 5:05:03 AM6/20/13
to lav...@googlegroups.com
On 06/20/2013 12:12 AM, Jesse Canchola wrote:
> This looks very promising as R gives more flexibility (albeit less
> description and breakdown). My first stab at the comparisons shows
> excellent consistency of estimates.

Thanks for posting this. Just wanted to add that if you request the
parameter estimates:

parameterEstimates(fit8)

you also get bootstrap based confidence intervals (percentile-based by
default, but you can also request boot.ci.type="bca.simple")

Yves.

Jesse Canchola

unread,
Jun 20, 2013, 12:00:30 PM6/20/13
to lav...@googlegroups.com
Great!  Even better to have the (bootstrap) confidence intervals.  I will surely put them to work.  Thanks again.

Jesse

Jesse Canchola

unread,
Jun 20, 2013, 3:48:43 PM6/20/13
to lav...@googlegroups.com
This is fine for M and W as continuous.  

For the next steps it would be nice for me to have examples of the following:  
Mediator (M) as categorical
Moderator (W) as categorical

yrosseel

unread,
Jun 20, 2013, 5:11:52 PM6/20/13
to lav...@googlegroups.com
On 06/20/2013 09:48 PM, Jesse Canchola wrote:
> This is fine for M and W as continuous.
>
> For the next steps it would be nice for me to have examples of the
> following:
> Mediator (M) as categorical
> Moderator (W) as categorical

simply declare them as 'ordered', as in

fit <- sem(myModel, data=myData, ordered=c("M","W"))

Only the bootstrap will not work then. Need to fix this.

Yves.

Jesse Canchola

unread,
Jun 20, 2013, 5:29:57 PM6/20/13
to lav...@googlegroups.com
Beautiful words.  Thank you!




Yves.

--
You received this message because you are subscribed to a topic in the Google Groups "lavaan" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/lavaan/jGSq5C_6n50/unsubscribe.
To unsubscribe from this group and all its topics, send an email to lavaan+unsubscribe@googlegroups.com.
To post to this group, send email to lav...@googlegroups.com.
Visit this group at http://groups.google.com/group/lavaan.
For more options, visit https://groups.google.com/groups/opt_out.





--
___________________________
Jesse A. Canchola
667 Alquire Parkway
Hayward, CA 94544
Cell 415.317.4060

"Everything is possible.  The impossible just takes a little longer."   -Dan BrownDigital Fortress

Heidi Jacobs

unread,
Aug 20, 2016, 7:32:13 PM8/20/16
to lavaan
This has been very educational to me, thank you so much.
I know that I am writing this now 3 year later, but I have a model similar to Hayes model 58 (W moderates XM and MY).
With the example provided, I was able to build my own model in lavaan but have questions on the conditional effects:

Would the conditional indirect effect be this:

#conditional indirect effect of X on Y at specified levels of W

lowIXY1 := (b1+b3* -0.1192936) * (a1+a3* -0.1192936)

midIXY2 := (b1+b3*0) * (a1+a3* 0)

highIXY3 := (b1+b3* 0.1192936) * (a1+a3* 0.1192936)


And the highest order interaction?

#indirect effect of highest order interaction

IE_HighOrder_inter := a3*b3

??
Many thanks!
H

Terrence Jorgensen

unread,
Aug 22, 2016, 7:30:13 AM8/22/16
to lavaan
Would the conditional indirect effect be this:

#conditional indirect effect of X on Y at specified levels of W

lowIXY1 := (b1+b3* -0.1192936) * (a1+a3* -0.1192936)

midIXY2 := (b1+b3*0) * (a1+a3* 0)

highIXY3 := (b1+b3* 0.1192936) * (a1+a3* 0.1192936)

And the highest order interaction?

#indirect effect of highest order interaction

IE_HighOrder_inter := a3*b3


Yes, the syntax looks right, if you labeled your parameters the same as in the original poster's example syntax.

Terrence D. Jorgensen
Postdoctoral Researcher, Methods and Statistics
Research Institute for Child Development and Education, the University of Amsterdam

Reply all
Reply to author
Forward
Message has been deleted
0 new messages