Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

Re: st: Moderated mediation analyses


From   William Buchanan <william@williambuchanan.net>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   Re: st: Moderated mediation analyses
Date   Mon, 3 Dec 2012 21:03:12 -0800

Check your syntax again. You're incorrectly referencing the estimate you're interested in. [y]_b[wx1] is what you might be trying to reference, but that estimate does not exist in the first equation [m1].

HTH

Sent from my iPhone

On Dec 3, 2012, at 19:14, "Kim, Isok" <isokkim@buffalo.edu> wrote:

> Hello,
> 
> I am trying to replicate moderated mediation method (Preacher, Rucker & Hayes, 2007) using the UCLA Stata FAQ, (http://www.ats.ucla.edu/stat/stata/faq/modmed.htm#model5).  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!
> 
> Best,
> isok
> 
> *
> *   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/

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


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index