# How to analyse a moderator effect in hierarchical multiple regression with covariates?

I am trying to find an appropriate method to examine the significant interaction effect in my hierarchial multiple regression analyses. I am looking at moderation analysis but most of of the methods (macros etc) do not take into account the covariates in my regression equations.

I was advised to try out the Stata programme but at the moment, I have no access to it.

• Is there another statistical program that I can perform moderator regression with covariates?
• How can I perform simple slopes analysis with covarites?
• Thank you for the above. I have already done the above with the various blocks etc but am actually looking into simple slope analysis (my next step) for the significant interaction effect from my regression analyses, thus the query on Stata. My previous posting might have been unclear on this, my apologies on this. Would I thus be able to use SPSS for simple slope analysis (for the sig interaction effect), and still take into account the 2 covariates during the process? Thanks again. Sep 15 '11 at 3:24
• I've updated your question to incorporate simple slopes and I've updated my answer to incorporate simple slopes. Sep 15 '11 at 7:12

### Terminology and Overview

In the context of multiple regression:

• a moderator effect is just an interaction between two predictors, typically created by multiplying the two predictors together, often after first centering the predictors.
• a covariate is just a predictor that was not used in the formation of the moderator and that is conceptualised as something that needs to be controlled for.

Thus, you should be able to run a hiearchical regression with moderators and covariates in just about any statistical software that supports multiple regression.

### Typical approach to testing moderator effect after controlling for covariates

• SPSS: If you are doing the hierarchical regression in SPSS, you'd probably enter the predictors in blocks. Here's a tutorial.
• R: If you are doing this in R, you'd probably define separate linear models lm each adding additional predictors and use anova to compare the models. Here's a tutorial.

Once you understand hierarchical regression in your chosen tool a simple recipe would be as follows. Let's assume that you have the following variables

• main effect precitors: IV1 IV2
• interaction effect: multiplication of IV1 and IV2
• covariates CV1 CV2

In some cases you may need to create the moderator

• If you are using SPSS, you will need to multiply the two predictor variables together (e.g., compute iv1byiv2 = iv1 * iv2.). If you want to interpret the regression coefficients, you may find it useful to center iv1 and iv2 before creating the interaction term.
• If you are using R, you can just use the notation iv1*iv2 in the linear model notation.

You can then estimate the models

• Block/model 1: Enter covariates m1 <- lm(DV~CV1+CV2)
• Block/model 2: Enter main effect predictors m2 <- lm(DV~CV1+CV2+IV1+IV2)
• Block/model 3: Enter interaction effect m3 <- lm(DV~CV1+CV2+IV1*IV2)

You can then interpret the significance of the r-square change between block 2 and 3 as a test of whether there is an interaction effect: anova(m2, m3)

### Simple slopes analysis

If you want to perform simple slopes analysis, you can take the regression formula provided by the final multiple regression and calculate some appropriate values to plot.

You can do this by hand or you can use predict in R. For example, you might calculate the values predicted by the regression equation using the following values

IV1   IV2   CV1   CV2
-2sd  -2sd  mean  mean
-2sd  +2sd  mean  mean
+2sd  -2sd  mean  mean
+2sd  +2sd  mean  mean


You can then plot these values using whatever plotting tool that you like (e.g., R, SPSS, Excel).

Personally, I find Conditioning Plots a better option than simple slopes analysis. R has the coplot function. The idea is to show a scatter plot of the relationship between IV and DV in a set of arranged scatterplots defined by ranges of the moderator. When I searched, I found an example of using conditioning plots for moderator regression on page 585 of Handbook of Research Methods in Personality Psychology