mediation1: Simple Mediation

View source: R/mediation1.R

mediation1R Documentation

Simple Mediation

Description

This function runs a complete simple mediation analysis with one mediator, similiar to model 4 in PROCESS by A. Hayes (2013). As part of the output, you will find data screening, all three models used in the traditional Baron and Kenny (1986) steps, total/direct/indirect effects, the z-score and p-value for the Aroian Sobel test, and the bootstrapped confidence interval for the indirect effect.

Usage

mediation1(
  y,
  x,
  m,
  cvs = NULL,
  df,
  with_out = T,
  nboot = 1000,
  conf_level = 0.95
)

Arguments

y

The dependent variable column name from your dataframe.

x

The independent variable column name from your dataframe. This column will be treated as X in mediation or moderation models, please see diagrams online for examples.

m

The mediator for your model, as this model only includes one mediator.

cvs

The covariates you would like to include in the model. Use a c() concatenated vector to use multiple covariates.

df

The dataframe where the columns from the formula can be found. Note that only the columns used in the analysis will be data screened.

with_out

A logical value where you want to keep the outliers in model TRUE or exclude them from the model FALSE.

nboot

A numeric value indicating the number of bootstraps you would like to complete.

conf_level

A numeric value indicating the confidence interval width for the boostrapped confidence interval.

Examples

mediation1(y = "cyl", x = "mpg", m = "disp",
          cvs = c("drat", "gear"), df = mtcars)

doomlab/MeMoBootR documentation built on April 5, 2023, 8:27 p.m.