Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

The post How to test the significance of a mediation effect appeared first on Data Science Tutorials

What do you have to lose?. Check out Data Science tutorials here Data Science Tutorials.

How to test the significance of a mediation effect?, To perform a sobel test in R is covered in this lesson.

Using R to run a Sobel test
We can use the bda package to run a sobel test in R.

```install.packages('bda')
library(bda)```

## How to test the significance of a mediation effect

The following is the fundamental syntax for performing a sobel test.

Best Data Science YouTube Tutorials Free to Learn – Data Science Tutorials

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

where iv stands for the independent variable, dv for dependent variable, and mv is for the mediator variable.

Using a list of 50 normal random variables as the mediator variable, independent variable, and dependent variable, the following code performs a Sobel test.

```              Sobel Aroian Goodman
z.value -0.5312235 -0.4533736 -0.6708299
p.value 0.5952639 0.6502797 0.5023289```

In this instance, the values in the Sobel column are what we are most concerned with. The p-value that corresponds to the z-value of -0.5312235 is 0.5952639.

Hypothesis Testing Examples-Quick Overview – Data Science Tutorials

We would be unable to reject the null hypothesis that there is no mediation effect because this p-value is higher than the alpha level of 0.05.

There is therefore no statistically significant mediation effect.

Note: In your own test, you can use a different alpha level. The usual options for alpha are 0.01, 0.05, and 0.10.

How to perform the Kruskal-Wallis test in R? – Data Science Tutorials

The post How to test the significance of a mediation effect appeared first on Data Science Tutorials

Learn how to expert in the Data Science field with Data Science Tutorials.