createformula: Create Regression Formulas

createformulaR Documentation

Create Regression Formulas

Description

This function creates the formulas for lm() to run the regression models necessary for data screening and mediation or moderation models.

Usage

createformula(y, x, m, m2 = NULL, mod = NULL, cvs = NULL, type)

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 first mediator or moderator for your model.

m2

The second mediator or moderator for your model.

mod

A moderator for a moderated mediation model.

cvs

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

Details

The output currently includes a list of equations used for simple mediation, which will updated as moderation is added to the package.

Examples

createformula(y = "cyl", x = "mpg", m = "disp",
             cvs = c("drat", "gear"), type = "moderation1")

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