How to Conduct a Sobel Test in R
In this article, we will learn How to Conduct a Sobel Test in R?
Sobel test
This test is a method of testing the significance of a mediation effect. This test is a type of t-test that determines after including the mediator in the model, whether the reduction in the effect of the independent variable is a significant reduction . It also determined whether the mediation effect is statistically significant.
The sobel test is performed using mediation.test() function from bda library
Syntax
mediation.test(mv,iv,dv)
where-
- mv – mediator variable
- iv – Independent variable
- dv – Dependent variable.
Example: Conduction a Sobel Test
Step 1: Package Installation
install.packages('bda')
library(bda)
Step 2: Create Normal variables
mv <- rnorm(50)
iv <- rnorm(50)
dv <- rnorm(50)
Step 3: Perform Sobel test
mediation.test(mv,iv,dv)
Code
#Step 1: Package Installation
install.packages('bda')
library(bda)
#Step 2: Create Normal variables
mv <- rnorm(50)
iv <- rnorm(50)
dv <- rnorm(50)
#Step 3: Perform Sobel test
mediation.test(mv,iv,dv)
Output
Sobel Aroian Goodman
z.value -1.0470053 -0.9705404 -1.1449549
p.value 0.2950971 0.3317772 0.2522279
Explanation:
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 accept the null hypothesis that there is no mediation effect.
Conclusion
In this article, we learnt about How to Conduct a Sobel Test in R. This test is a method of testing the significance of a mediation effect. This test is a type of t-test that determines after including the mediator in the model, whether the reduction in the effect of the independent variable is a significant reduction . It also determined whether the mediation effect is statistically significant.