Learn R Programming

QuantPsyc (version 1.6)

moderate.lm: Simple Moderated Regression Model

Description

This function creates an object of class lm() specific to a moderated multiple regression involving 3 variables.

Usage

moderate.lm(x, z, y, data, mc = FALSE)

Arguments

x

focal explanatory variable

z

moderating variable

y

outcome variable

data

data.frame containing the variables

mc

Logical specifying wheter the data are already mean centered

Value

An object of class lm(). One can use summary(), coef() or any other function useful to lm(). This model is used by other moderator tools - see below.

Warning

This is a very simplistic model. If x or z are categorical, the results will not be accurate. The function can be modified by the user to deal with complications such as covariates, non-continuous variables, etc.

Details

This model takes x and z and creates the interaction term x*z. If the data are not already mean centered, then x and z are mean centered by subtracting out the means. This is necessary for interpretation and to reduce multicolinearity. The lm() is then computed thusly: Y ~ X + Z + XZ.

References

Aiken, L. S., & West, S. G. (1991). Multiple regression: Testing and interpreting interactions. Newbury Park: Sage Publications.

Cohen, J., Cohen, P., West, S. G., & Aiken, L. S. (2003). Applied multiple regression/correlation analysis for the behavioral sciences, 3rd ed. Mahwah, NJ: Lawrence Erlbaum Associates.

See Also

sim.slopes, graph.mod

Examples

Run this code
# NOT RUN {
data(tra)
lm.mod1 <- moderate.lm(beliefs, values, attitudes, tra)
summary(lm.mod1)
# }

Run the code above in your browser using DataLab