indirectmed: Indirect Effect for Mediation

View source: R/indirectmed.R

indirectmedR Documentation

Indirect Effect for Mediation

Description

This function runs a simple mediation model 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.

Usage

indirectmed(formula2, formula3, x, med.var, df, random)

Arguments

formula2

The formula for mediation for the a path, usually m ~ x. Can also include covariates and will be eq2 if the createformula() function is used.

formula3

The formula for mediation for the b path, usually y ~ x + m. Can also include covariates and will be eq3 if the createformula() function is used.

x

The column name for x in the data frame.

med.var

The column name for m in the data frame.

df

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

random

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

Examples

indirectmed("disp ~ mpg", "cyl ~ mpg + disp", mtcars)

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