*32*

AÂ **Sobel test**Â is a method of testing the significance of aÂ mediationÂ effect.

According to Wikipedia:

In mediation, the relationship between the independent variable and the dependent variable is hypothesized to be an indirect effect that exists due to the influence of a third variable (the mediator). As a result when the mediator is included in aÂ regression analysisÂ model with the independent variable, the effect of the independent variable is reduced and the effect of the mediator remains significant.

Â

The

Sobel testis basically a specializedÂ t testÂ that provides a method to determine whether the reduction in the effect of the independent variable, after including the mediator in the model, is a significant reduction and therefore whether the mediation effect is statistically significant.

This tutorial explains how to conduct a sobel test in R.

**Conducting a Sobel Test in R**

To conduct a sobel test in R, we can use theÂ *bdaÂ *library.

#install bda package if not already installed install.packages('bda') #load bda package library(bda)

The basic syntax to conduct a sobel test is the following:

**mediation.test(mv,iv,dv)**

whereÂ **mvÂ **is the mediator variable,Â **ivÂ **is the independent variable, andÂ **dvÂ **is the dependent variable.

The following code conducts a sobel test using a list of 50 normal random variables for the mediator variable, independent variable, and dependent variable:

mv

This code produces the following output:

In this case, we are interested primarily in the values in theÂ *SobelÂ *column. The z value is -1.047 and the corresponding p-value is 0.295.

Since this p-value is greater than the alpha level of 0.05, we would fail to reject the null hypothesis that there is no mediation effect.

Thus, the mediation effect is not statistically significant.

* Note:Â *You may use a different alpha level in your own test. Common choices for alpha include 0.01, 0.05, and 0.10.

Â