Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Graphical Representation of the Mediated Effect

    Hello,

    I am running a bootstrap segmentation and would like to know how I can graphically represent the mediated effect?

    Please note that I have a multi-level data (multiple yearly observations nested within countries).

    Appreciate your help, thank you

  • #2
    You need to tell us more about your model. Mediation is a preserved term in statistics that comes from simultaneous regressions (Barron & Kenny, 1986) while assessing direct effect of x on y and indirect effect of x on y via z. Bootstrap segmentation doesn't sound like a model (or probably I do not know). If you are looking for Baarron & Kenny's mediation effect, you need to tell us more about fitted model and how you fitted them. Please read the FAQ section thoroughly on how to make a meaningful post so that others can help you.

    One way to show the mediation effect is to plot the slope for the total effect and overlay the slope of the indirect effect. If mediation exists, the slopes will clearly have a difference and that demonstrates the amount of mediation.
    Last edited by Roman Mostazir; 19 Nov 2016, 17:15. Reason: Corrected spelling
    Roman

    Comment


    • #3
      Thanks Roman for your prompt response

      Im performing Sobel test following Preacher and Hayes (2004).

      Apologies for not clarifying my post but I am still new to the mediation analysis and stata.

      Thanks

      Comment


      • #4
        It is not the problem that you are new to mediation analyses. The problem is you are telling us nothing about how you fitted the model. People can undertake various ways for mediation analysis. Here is an example using structural equation model (sem). After running the model, you need to test the non-linear path for mediation hypothesis and write a small programme to bootstrap that non-linear estimation. The test of the non-linear term is equivalent to Sobel's test:

        Code:
        Example begins:
        
        //Creating  artificial data:
        clear
        set seed 56784
        matrix m=(2, 3, 4)
        matrix sd=(.5 , 2, 3.3)
        drawnorm x y z, n(1000) means(m) sds(sd)
        
        *******************************
        li x y z in 1/5
                  x          y          z  
            2.318248   5.083603   3.615169  
            2.268301   3.639907   3.775557  
            2.119449   3.331355    7.41976  
            2.031995    2.35605   7.054258  
            2.588996   3.257638   .6182325  
        
        
        // Run the model: Output omitted.
        // You could ignore this step for bootstrapping as you need to run them again. This is just to show you the steps
        
        sem (z<-x) (y<-z x), cov(e.z*e.y)
        
        //Test the non-linear path for mediation //This step can be omitted too.
        
               _nl_1:  _b[z:x]*_b[y:z]
        
        ------------------------------------------------------------------------------
                     |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
        -------------+----------------------------------------------------------------
               _nl_1 |   .0078799   25.43634     0.00   1.000    -49.84643    49.86219
        ------------------------------------------------------------------------------
        
        
        //Boot strap the non-linear path:
        
        capture program drop boots // Running the model again to have the estimates in r-class
        program boots, rclass
                sem (z<-x) (y<-z x), cov(e.z*e.y)
        return scalar est1 = _b[z:x]*_b[y:z]
        end
        
        bootstrap r(est1), reps(2): boots  //Bootstrap 2 times
        
        (running boots on estimation sample)
        
        Bootstrap replications (2)
        1 ---+--- 2 ---+--- 3 ---+-    -    4 ---    --- 5
        I had to quit before the replication finished as I have some models to run over night. I have replicated 2 times for demonstration purpose. Ideally you need to do it many times i.e. 500, 1000 or more. Please do read the FAQ section as suggested in #2, before posting. This will help everyone to help you.

        Regards,
        Roman

        Comment


        • #5
          Hi Roman,

          Thanks again for your response

          I run a multilevel model using xtmixed as follows:

          xtmixed dep var indep var year || Country: year, cov(independent)

          and then I run the Sobel test using bootstrapping as follows:

          bootstrap r(ind_eff) r(dir_eff), reps(1000): sgmediation dependent var, iv(independent var) mv(mediator var).

          I get all the coefficients incl the sober coefficient and that the mediation effect is significant, what I am trying to do is to know how I can graphically represent the mediated effect.

          Hope this helps

          Thank once again

          Moustafa

          Comment


          • #6
            I don't see any mediation taking place in your multi-level model. You are just assessing the effect of x-variables on your outcome variable. No mediation is here. I recommend you to consult a book on this first before undertaking analysis.

            Again I do not understand how bootstrapping command finds the scalar r(ind_eff) and others after mixed effect model. Mixed does not store results like this. Are you showing us the right commands you used? Please note you are expected to show us the exact command you have used for your analysis and exact output you have received from Stata as outlined in the FAQ section..

            Further, my apologies that I do not know what sgmediation is which you are expected to explain as outlined in the FAQ section which apparently you are expected to read. I am not sure how sgmediation stores the results or what post estimation commands it supports. Neither I think that this command will be suitable for carrying out mediation analysis on multi-level data.
            Roman

            Comment


            • #7
              After further reading, I found that due to the multi-level nature of my data, the ml_mediation command is recommended. My data consists of several independent variable is at level 2, dependent at level 1 and the mediator variable is at level 2. In addition, I have several control variables with some at level 1 and others at level 2. My data consist of multiple yearly observation of the dependent variable (some control variables as well) nested within countries. So I set the data by country using: xtset Country. Then I run the following command:

              ml_mediation, dv(Y) mv(M) iv(X) l2id(Country) cv(control variables) mle. Then in order to get the confidence intervals and standard error, I bootstrap the results as follows:

              bootstrap r(ind_eff), strata (Country) reps(1000): ml_mediation, dv(Y) iv(X) mv(M) l2id(Country) cv(control variables).

              Results show that mediation exist. As such, how can I now illustrated the mediated effect?

              Appreciate your ideas.

              Thank you very much in advance

              Best Regards,

              Moustafa

              Comment

              Working...
              X