mediation2_moda: Two Mediations with Moderation on Path A

View source: R/mediation2_moda.R

mediation2_modaR Documentation

Two Mediations with Moderation on Path A

Description

This function runs a serial mediation analysis with two mediators (model 6) with an added moderation on path a (like model 7) using the model numbers from A. Hayes (2013). As part of the output, you will find data screening, all model outputs 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. These are separated by simple slopes for the moderation part of the analysis.

Usage

mediation2_moda(
  y,
  x,
  m1,
  m2,
  mod,
  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.

m1

The first mediator for your model.

m2

The second mediator for your model.

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

mediation2(y = "Q11", x = "Q151", m1 = "Q31", m2 = "Q41", mod = "Q121",
          cvs = NULL, df = mediation2_data, nboot = 1000, with_out = T,
          conf_level = .95)

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