Bookmark and Share

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

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

st: Moderated mediation analyses

From   "Kim, Isok" <>
To   "''" <>
Subject   st: Moderated mediation analyses
Date   Mon, 3 Dec 2012 22:14:44 -0500


I am trying to replicate moderated mediation method (Preacher, Rucker & Hayes, 2007) using the UCLA Stata FAQ, (  Similar to my previous inquiry about writing stata codes for mediation analysis, it involves -sureg- and -nlcom-. This time, I'm having trouble calculating conditional indirect effect.  Below is my stata code:

//RENAME vars for simplification
rename CESD y /* dependent variable */
rename PRD x1  /* independent variable */
rename GC3E m1 /* mediator variable 1 */
rename ES w /* moderator variable */

/*-sureg-&-nlcom- methods*/
set more off
summarize w
global m=r(mean)
global s=r(sd)
capture generate wx1=w*x1 /* moderator(ES) by IV(PRD) */
capture generate m1w=m1*w /* Mediator 1(GC3E) by Mod(ES) */

set more off
sureg (m1 x1 w i.SEX AGE EDU i.UNEMP i.MARSTS i.NATIVITY) ///
	  (y x1 w wx1 m1 m1w i.SEX AGE EDU i.UNEMP i.MARSTS i.NATIVITY) if NMV5==1

//Conditional indirect effect via m1 with w
nlcom ([m1]_b[x1]+($m-$s)*[m1]_b[wx1])*([y]_b[m1]+($m-$s)*[y]_b[m1w])  /*mean - 1sd*/

Everything appears to run without an error until the last -nlcom- command. The error message reads, "[wx1] not found."  r(111).  Any suggestion or insight into resolving this would again be greatly appreciated!


*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index