moderation2: Double Two-Way Moderation

View source: R/moderation2.R

moderation2R Documentation

Double Two-Way Moderation

Description

This function runs a complete double two-way moderation analysis with two moderators, similiar to model 2 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

moderation2(y, x, m1, m2, 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.

m1

The first moderator for your model.

m2

The second moderator for your model.

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)
moderation2(y = "Income", x = "Illiteracy", m1 = "Murder",
          m2 = "Population", df = states)

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