draw.med: Simple Mediation Diagrams

View source: R/draw.med.R

draw.medR Documentation

Simple Mediation Diagrams

Description

This function returns the code to create a simple mediation triangle, as well as the basic diagram using the diagram library.

Usage

draw.med(model1, model2, model3, y, x, m, df)

Arguments

model1

The saved regression model of y~x model where X predicts Y.

model2

The saved regression model of m~x model where X predicts M.

model3

The saved regression model of y~x+m model where X and M predict Y.

y

The dependent variable from your mediation.

x

The x variable from your mediation.

m

The mediator from your mediation.

df

The dataframe containing the y, x, m columns.

Examples

draw.med(saved$model1, saved$model2, saved$model3)
Note in this example saved is the name of the model saved from mediation1.
You can include any form of model names that you have saved from \code{lm()}.
You can also type \code{draw.med} in your console to get this code and edit
the diagram parameters to your liking.

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