moderation1: Two Way Moderation

View source: R/moderation1.R

moderation1R Documentation

Two Way Moderation

Description

This function runs a complete two way moderation analysis with one moderator, similiar to model 1 in PROCESS by A. Hayes (2013). As part of the output, you will find data screening, the overall model, and the simple slopes for X at each level of the moderator. X and M variables will be mean centered after data screening and before analysis to control for multicollinearity unless they are categorical.

Usage

moderation1(y, x, m, cvs = NULL, df, with_out = T)

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 moderator for your model, as this model only includes one moderator.

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.

Examples

states = as.data.frame(state.x77)
moderation1(y = "Income", x = "Illiteracy", m = "Murder",
          cvs = c("Population", "Area"), df = states)

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