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.
How to Conduct a Sobel Test in R
In this article, we will learn How to Conduct a Sobel Test in R?