UCLA Academic Technology Services HomeServicesClassesContactJobs
Search

Stata FAQ
How to perform Sobel-Goodman mediation tests in Stata?

The purpose of the Sobel-Goodman tests is to test whether a mediator carries the influence of an IV to a DV.

A variable may be considered a mediator to the extent to which it carries the influence of a given independent variable (IV) to a given dependent variable (DV). Generally speaking, mediation can be said to occur when (1) the IV significantly affects the mediator, (2) the IV significantly affects the DV in the absence of the mediator, (3) the mediator has a significant unique effect on the DV, and (4) the effect of the IV on the DV shrinks upon the addition of the mediator to the model. More formally, the Sobel-Goodman tests are statistically based methods by which mediation may be assessed.

Example

This example uses the hsb2 dataset with write as the dv, ses as the iv and read as the mediator variable. That is, the model says that ses influences read, which in turn influences write. This model may not make much substantive sense but it will allow us to to demonstrate the process of running a Sobel-Goodman test. We will do this using the sgmediation command, you can download this command using findit sgmediation (see How can I use the findit command to search for programs and get additional help? for more information about using findit).

use http://www.ats.ucla.edu/stat/stata/notes/hsb2, clear

sgmediation write, mv(read) iv(ses)

Model with dv regressed on iv

      Source |       SS       df       MS              Number of obs =     200
-------------+------------------------------           F(  1,   198) =    8.91
       Model |  769.750233     1  769.750233           Prob > F      =  0.0032
    Residual |  17109.1248   198   86.409721           R-squared     =  0.0431
-------------+------------------------------           Adj R-squared =  0.0382
       Total |   17878.875   199   89.843593           Root MSE      =  9.2957

------------------------------------------------------------------------------
       write |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         ses |   2.715408   .9097906     2.98   0.003     .9212848    4.509531
       _cons |   47.19484   1.981799    23.81   0.000      43.2867    51.10298
------------------------------------------------------------------------------

Model with mediator regressed on iv

      Source |       SS       df       MS              Number of obs =     200
-------------+------------------------------           F(  1,   198) =   18.64
       Model |  1799.85862     1  1799.85862           Prob > F      =  0.0000
    Residual |  19119.5614   198  96.5634413           R-squared     =  0.0860
-------------+------------------------------           Adj R-squared =  0.0814
       Total |    20919.42   199  105.122714           Root MSE      =  9.8267

------------------------------------------------------------------------------
        read |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         ses |    4.15221   .9617596     4.32   0.000     2.255604    6.048817
       _cons |   43.69721   2.095003    20.86   0.000     39.56583    47.82859
------------------------------------------------------------------------------

Model with dv regressed on mediator and iv

      Source |       SS       df       MS              Number of obs =     200
-------------+------------------------------           F(  2,   197) =   54.76
       Model |  6388.01507     2  3194.00754           Prob > F      =  0.0000
    Residual |  11490.8599   197  58.3292382           R-squared     =  0.3573
-------------+------------------------------           Adj R-squared =  0.3508
       Total |   17878.875   199   89.843593           Root MSE      =  7.6374

------------------------------------------------------------------------------
       write |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
        read |   .5420784   .0552337     9.81   0.000     .4331532    .6510037
         ses |   .4645841   .7818783     0.59   0.553    -1.077342     2.00651
       _cons |   23.50752   2.911437     8.07   0.000     17.76594    29.24911
------------------------------------------------------------------------------

Sobel-Goodman Mediation Tests

            test statistic    2-tail p-value
Sobel          3.952          .00007755
Goodman-1      3.935          .00008328
Goodman-2      3.969          .00007213

Pecent of total effect that is mediated:  82.89 %
Ratio of indirect to direct effect:        4.8448
In this example the mediation effect of read was highly significant with approximately 83% of the total effect (of ses on write) being mediated.

 


How to cite this page

Report an error on this page

UCLA Researchers are invited to our Statistical Consulting Services
We recommend others to our list of Other Resources for Statistical Computing Help
These pages are Copyrighted (c) by UCLA Academic Technology Services


The content of this web site should not be construed as an endorsement of any particular web site, book, or software product by the University of California.