indirectmed2_moda: Indirect Effect for Serial Mediation and Moderator on Path A

View source: R/indirectmed2_moda.R

indirectmed2_modaR Documentation

Indirect Effect for Serial Mediation and Moderator on Path A

Description

This function runs a serial mediation model with two mediators to calculate the indirect effect, which will be used for bootstrapping the confidence interval of the indirect effect. This function is used in conjunction with the boot function and is formatted to work as a bootstrapped effect. This mediation model includes a moderator on path A1.

Usage

indirectmed2_moda(formula2, formula3, formula4, x, m1, m2, mod, df, random)

Arguments

formula2

The formula for mediation for the a1 path, usually m1 ~ x. Can also include covariates and will be eq2 if the createformula() function is used. This effect will also have a moderator for this model.

formula3

The formula for mediation for the a2 and d21 paths, usually m2 ~ x + m1. Can also include covariates and will be eq3 if the createformula() function is used.

formula4

The formula for mediation for the b1 and b2 paths, usually y ~ x + m1 + m2. Can also include covariates and will be eq4 if the createformula() function is used.

x

The column name for x in the data frame.

m1

The column name for mediator 1 in the data frame.

m2

The column name for mediator 2 in the data frame.

mod

The column name for the moderator in the data frame.

random

This variable is used to denote the data frame will be randomize by row, as part of the boot library.

data

The dataframe where the columns from the formula can be found.

Examples

indirectmed2("Q31 ~ Q151*Q121", "Q41 ~ Q151 + Q31",
             "Q11 ~ Q151 + Q31 + Q41", mtcars)

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