Bookmark and Share

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: Analyzing multiple mediators


From   Maarten Buis <[email protected]>
To   [email protected]
Subject   Re: st: Analyzing multiple mediators
Date   Thu, 29 Nov 2012 17:18:55 +0100

The trick is always to simplify the program till it works, and than
move up again. So I would start with creating a program like that to
compute bca confidence intervals for just a regular regression
coefficient in a linear regression, no sureg, no indirect effects.
That way you can focus on what -bootstrap- needs to create bca
confidence intervals. Get that program to work. Than start with a two
equation -sureg- and just a simple regression coefficient. That way
you can see if -sureg- is a problem. Get that program to work. Than a
two equation sureg and a single indirect effect. etc. etc.

Hope this helps,
Maarten

On Thu, Nov 29, 2012 at 5:07 PM, Kim, Isok <[email protected]> wrote:
> Thanks for your suggestion for the fix.  Unfortunately, it doesn't seem to have worked.  I get the same error message saying, "insufficient observations to compute jackknife standard errors. no results will be saved."  Below is revised syntax reflecting your suggested fix.  Please let me know if there's anything that I fail to incorporate in the commands below.
>
> Thanks,
> isok
>
> //Calculate the SE and CI using bootstrapping method.
> capture program drop bootmm
> program bootmm, rclass
>         syntax [if] [in]
>         marksample touse
>         sureg (GC3E PRD i.SEX AGE EDU i.UNEMP i.MARSTS i.NATIVITY) ///
>           (GC3D PRD i.SEX AGE EDU i.UNEMP i.MARSTS i.NATIVITY) ///
>               (RC3E PRD i.SEX AGE EDU i.UNEMP i.MARSTS i.NATIVITY) ///
>               (RC3D PRD i.SEX AGE EDU i.UNEMP i.MARSTS i.NATIVITY) ///
>               (CESD GC3E GC3D RC3E RC3D PRD i.SEX AGE EDU i.UNEMP i.MARSTS i.NATIVITY) if 'touse'
>         return scalar indGC3E = [GC3E]_b[PRD]*[CESD]_b[GC3E]
>         return scalar indGC3D = [GC3D]_b[PRD]*[CESD]_b[GC3D]
>         return scalar indRC3E = [RC3E]_b[PRD]*[CESD]_b[RC3E]
>         return scalar indRC3D = [RC3D]_b[PRD]*[CESD]_b[RC3D]
>         return scalar indtotal = [GC3E]_b[PRD]*[CESD]_b[GC3E]+[GC3D]_b[PRD]*[CESD]_b[GC3D] ///
>                             +[RC3E]_b[PRD]*[CESD]_b[RC3E]+[RC3D]_b[PRD]*[CESD]_b[RC3D]
> end
>
> bootstrap r(indGC3E) r(indGC3D) r(indRC3E) r(indRC3D) r(indtotal), bca reps(1000) nodots: bootmm if NMV2==1
> estat boot, percentile bc bca
>
> -----Original Message-----
> From: [email protected] [mailto:[email protected]] On Behalf Of Steve Samuels
> Sent: Sunday, November 25, 2012 11:28 AM
> To: [email protected]
> Subject: Re: st: Analyzing multiple mediators
>
>
> Kim:
>
> To answer your original question:  The error arose because you applied the -if- expression only to -sureg- , not to the -bootmm- command.
> -jackknife-, called by the "bca" option, assumed that every observation was in the estimation sample.
>
> The fix:
>   1. After the -syntax- statement in your program,
>      add the statement:  "marksample touse".
>   2. In place of "if NMV==1", substitute "if `touse'".
>   3. In the -bootstrap- statement, after "bootmm", add "if NMV==1".
>
> I agree with Ariel that -khb- offers a more comprehensive approach.
> The -mediation- package by Hicks and Tingley (at SSC) is also worth considering, because it does a sensitivity analysis of an important assumption.
>
>
> Reference:
> Hicks, R., and D. Tingley. 2011. Causal mediation analysis. Stata Journal 11, no. 4: 605. A preprint is as http://scholar.harvard.edu/dtingley/software/mediation-stata.
>
> (You can often find preprints with Google Scholar).
>
>
> Steve
>
> On Nov 22, 2012, at 9:46 AM, Ariel Linden, DrPH wrote:
>
> Kim, a much better approach for you to consider is -khb- ( a user-written program : -findit khb-). You should read the accompanying Stata Journal article since it gives nice examples of a multi-mediator scenario:
>
> http://www.stata-journal.com/article.html?article=st0236
>
> Ariel
>
> Date: Wed, 21 Nov 2012 09:50:15 -0500
> From: "Kim, Isok" <[email protected]>
> Subject: st: Analyzing multiple mediators
>
> Hi,
>
> I'm trying to analyze a model with multiple mediators, as described in ULCA stata FAQ site (http://www.ats.ucla.edu/stat/stata/faq/mulmediation.htm).
> The analyses are based on Preacher & Hayes (2008) method and uses combination of -sureg- and -nlcom- commands to get the coefficients and indirect effects coefficients, respectively. Then to get the standard errors, it demonstrates use of ado-program called 'bootmm' and subsequent bootstrap post-estimation command.
>
> Where I'm having trouble with this combination of analyses is at the last stage with bootstrap command. The error msg reads, "insufficient observations to compute jackknife standard errors; no results will be saved"
> r(2000).
>
> There are 397 observations included in the analyses and -sureg- command runs fine.  I'm not sure where the error is coming from.  Below is the syntax I used. Any suggestion or insight into resolving this problem would be greatly appreciated!
>
> Thanks,
> isok
>
> *---------------------------------------------------------------------------
> */
> /* H2a: Mediation Test IVs(PRD) MV(GC3E GC3D RC3E RC3D) DV(CESD) CV(controls)*/
> /* surge (mv1 iv cv)(mv2 iv2 cv)(dv mv1 mv2 iv cv) */
> /* nlcom [mv1]_b[iv]*[dv]_b[mv1]
> */
> /*--------------------------------------------------------------------------
> -*/
>
> /*-sureg-&-nlcom- methods*/
>
> sureg (GC3E PRD i.SEX AGE EDU i.UNEMP i.MARSTS i.NATIVITY) ///
>      (GC3D PRD i.SEX AGE EDU i.UNEMP i.MARSTS i.NATIVITY) ///
>           (RC3E PRD i.SEX AGE EDU i.UNEMP i.MARSTS i.NATIVITY) ///
>           (RC3D PRD i.SEX AGE EDU i.UNEMP i.MARSTS i.NATIVITY) ///
>           (CESD GC3E GC3D RC3E RC3D PRD i.SEX AGE EDU i.UNEMP i.MARSTS
> i.NATIVITY) if NMV==1
>
> //Indirect via GC3E
> nlcom [GC3E]_b[PRD]*[CESD]_b[GC3E]
> //Indirect via GC3D
> nlcom [GC3D]_b[PRD]*[CESD]_b[GC3D]
> //Indirect via GC3E
> nlcom [RC3E]_b[PRD]*[CESD]_b[RC3E]
> //Indirect via GC3D
> nlcom [RC3D]_b[PRD]*[CESD]_b[RC3D]
>
> //Total indirect
> nlcom [GC3E]_b[PRD]*[CESD]_b[GC3E]+[GC3D]_b[PRD]*[CESD]_b[GC3D] ///
>     +[RC3E]_b[PRD]*[CESD]_b[RC3E]+[RC3D]_b[PRD]*[CESD]_b[RC3D]
>
> capture program drop bootmm
> program bootmm, rclass
>         syntax [if] [in]
>         sureg (GC3E PRD i.SEX AGE EDU i.UNEMP i.MARSTS i.NATIVITY) ///
>          (GC3D PRD i.SEX AGE EDU i.UNEMP i.MARSTS i.NATIVITY) ///
>               (RC3E PRD i.SEX AGE EDU i.UNEMP i.MARSTS i.NATIVITY) ///
>               (RC3D PRD i.SEX AGE EDU i.UNEMP i.MARSTS i.NATIVITY) ///
>               (CESD GC3E GC3D RC3E RC3D PRD i.SEX AGE EDU i.UNEMP i.MARSTS
> i.NATIVITY) if NMV==1
>         return scalar indGC3E = [GC3E]_b[PRD]*[CESD]_b[GC3E]
>         return scalar indGC3D = [GC3D]_b[PRD]*[CESD]_b[GC3D]
>         return scalar indRC3E = [RC3E]_b[PRD]*[CESD]_b[RC3E]
>         return scalar indRC3D = [RC3D]_b[PRD]*[CESD]_b[RC3D]
>         return scalar indtotal =
> [GC3E]_b[PRD]*[CESD]_b[GC3E]+[GC3D]_b[PRD]*[CESD]_b[GC3D] ///
>
> +[RC3E]_b[PRD]*[CESD]_b[RC3E]+[RC3D]_b[PRD]*[CESD]_b[RC3D]
> end
>
> bootstrap r(indGC3E) r(indGC3D) r(indRC3E) r(indRC3D) r(indtotal), bca
> reps(1000) nodots: bootmm
> estat boot, percentile bc bca
>
>
> *
>
>
> *
> *   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/
>
> *
> *   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/



-- 
---------------------------------
Maarten L. Buis
WZB
Reichpietschufer 50
10785 Berlin
Germany

http://www.maartenbuis.nl
---------------------------------

*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index