Skip to content

Data Science Tutorials

For Data Science Learners

  • Quantiles by Group calculation in R
    Quantiles by Group calculation in R with examples R
  • How to deal with text in R
    How to deal with text in R R
  • How to Add a title to ggplot2 Plots in R
    How to Add a caption to ggplot2 Plots in R? R
  • Select variables of data frame in R R
  • Run a specific code block in R R
  • Data Analytics Online Courses for Beginners
    Data Analytics Online Courses for Beginners Course
  • How to change the column positions in R?
    How to change the column positions in R? R
  • Data Science for Business: Unraveling the Fundamentals of Analysis Machine Learning
How to test the significance of a mediation effect

How to test the significance of a mediation effect

Posted on December 4December 4 By Admin 1 Comment on How to test the significance of a mediation effect

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.

Check your inbox or spam folder to confirm your subscription.

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

R

Post navigation

Previous Post: Hypothesis Testing in R
Next Post: How To Become a Business Intelligence Analyst

Related Posts

  • Error attempt to apply non function in r
    Error attempt to apply non function in r R
  • Convert multiple columns into a single column
    Convert multiple columns into a single column-tidyr Part4 R
  • best books about data analytics
    Best Books to learn Tensorflow Course
  • How to Change X-Axis Labels of Barplot In R
    How to Change X-Axis Labels of Barplot In R R
  • Multiple regression model in R R
  • Extract columns of data frame in R R

Comment (1) on “How to test the significance of a mediation effect”

  1. StatistikinDD says:
    December 16 at 8:43 pm

    Nice! Wasn’t aware of this function.

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

  • Best Prompt Engineering Books
  • Understanding Machine Learning and Data Science
  • Best Git Books
  • Top 5 Books to Learn Data Engineering
  • Mastering R Programming for Data Science: Tips and Tricks
  • About Us
  • Contact
  • Disclaimer
  • Privacy Policy

https://www.r-bloggers.com

  • YouTube
  • Twitter
  • Facebook
  • Course
  • Excel
  • Machine Learning
  • Opensesame
  • R
  • Statistics

Check your inbox or spam folder to confirm your subscription.

  • How to do Pairwise Comparisons in R?
    How to do Pairwise Comparisons in R? R
  • Wald Test in R With Examples
    Wald Test in R With Examples R
  • How to Join Data Frames for different column names in R
    How to Join Data Frames for different column names in R R
  • Best Books to Learn R Programming
    Best Books to Learn R Programming Course
  • Convert Multiple Columns to Numeric in R
    Convert Multiple Columns to Numeric in R R
  • How to add columns to a data frame in R
    How to add columns to a data frame in R R
  • How to Prepare a Machine Learning Interview
    How to Prepare a Machine Learning Interview? Machine Learning
  • How to Calculate Ratios in R
    How to Calculate Ratios in R R

Privacy Policy

Copyright © 2025 Data Science Tutorials.

Powered by PressBook News WordPress theme