# Should I re-center variables when looking at moderator effect in men and women separately?

I want to see if an interaction variable in a multiple regression is significant for the whole sample, and then just for men and just for women. When I created the interaction variable for the whole sample, I centered the interaction components by subtracting the mean for the whole sample.

Now, when I want to look at men and women separately should I recalculate male and female specific centered and interaction variables, centering them with the respective male and female sample means for the interaction components?

Centring: Centring does not change the significance of the r-square change of your interaction effect. It also will not change the values you get for a simple slopes analysis.

Thus, for most purposes it does not matter whether you centre or not. This applies both to the general analysis, and to the subgroup analysis.

The main benefit of centring is that it can make the interpretation of the regression coefficients a little easier. If you want to compare these absolute size of these coefficients across males and females, then you should only centre once.

Prefer integrated models: A better suggestion is to include gender in your overall multiple regression. For example, if you have DV, IV1, IV2 and gender and you are interested in the IV1 * IV2 interaction for each gender. I'd examine various models such as:

DV ~ IV1 + IV2 + gender
DV ~ IV1 * IV2 + gender
DV ~ IV1 * IV2 + gender * IV1 + gender*IV2
DV ~ IV1 * IV2 * gender


If you get a significant gender by something interaction, then you may wish to further explore this using separate analyses, but I'd start with the overall integrated model.

The following code returns the p-value of the r-square change and the final r-square for both an uncentered and three centred versions (global, female centred, male centred) of an interaction effect model.

library(MASS)
survey <- na.omit(survey)

x <- survey[, c('Sex', 'Wr.Hnd', 'NW.Hnd', 'Pulse')]
names(x) <- c('gender', 'iv1', 'iv2', 'dv')
x$scaled_iv1 <- scale(x$iv1, scale=FALSE)
x$scaled_iv2 <- scale(x$iv2, scale=FALSE)
x$female_scaled_iv1 <- scale(x$iv1, center=mean(x[x$gender == "Female", 'iv1']), scale=FALSE) x$female_scaled_iv2 <- scale(x$iv2, center=mean(x[x$gender == "Female", 'iv2']), scale=FALSE)
x$male_scaled_iv1 <- scale(x$iv1, center=mean(x[x$gender == "Male", 'iv1']), scale=FALSE) x$male_scaled_iv2 <- scale(x$iv2, center=mean(x[x$gender == "Male", 'iv2']), scale=FALSE)

compare_fits <- function(x) {
fit1 <- lm(dv ~ iv1+iv2, x)
fit2 <- lm(dv ~ iv1*iv2, x)
fit3 <- lm(dv ~ scaled_iv1*scaled_iv2, x)
fit4 <- lm(dv ~ male_scaled_iv1*male_scaled_iv2, x)
fit5 <- lm(dv ~ female_scaled_iv1*female_scaled_iv2, x)
results <- list()
results$p_normal <- anova(fit1, fit2)[2,6] results$p_centered <- anova(fit1, fit3)[2,6]
results$p_centered_male <- anova(fit1, fit4)[2,6] results$p_centered_female <- anova(fit1, fit5)[2,6]
results$rsq_normal <- summary(fit2)$r.squared
results$rsq_centered <- summary(fit3)$r.squared
results$rsq_centered_male <- summary(fit4)$r.squared
results$rsq_centered_female <- summary(fit5)$r.squared
unlist(results)
}

# The following results report p-values and rsq for final model
# using normal (i.e., uncentered) and centered predictors
compare_fits(x)
compare_fits(x[x$gender=='Male', ]) compare_fits(x[x$gender=='Female', ])


The results show how the values do not vary across uncentered and centered analyses.

> compare_fits(x)
p_normal          p_centered     p_centered_male   p_centered_female          rsq_normal
0.241816265         0.241816265         0.241816265         0.241816265         0.009982317
rsq_centered   rsq_centered_male rsq_centered_female
0.009982317         0.009982317         0.009982317
> compare_fits(x[x$gender=='Male', ]) p_normal p_centered p_centered_male p_centered_female rsq_normal 0.14034102 0.14034102 0.14034102 0.14034102 0.03055692 rsq_centered rsq_centered_male rsq_centered_female 0.03055692 0.03055692 0.03055692 > compare_fits(x[x$gender=='Female', ])
p_normal          p_centered     p_centered_male   p_centered_female          rsq_normal
0.5196788           0.5196788           0.5196788           0.5196788           0.0128802
rsq_centered   rsq_centered_male rsq_centered_female
0.0128802           0.0128802           0.0128802

• +1, I was hoping to see a recommendation for including interactions with the gender variable directly in an "integrated model". One question: are you sure that centering a second time, this time within each group separately, would not change the R² for the 2 models (as opposed to using the grand-mean-centered variables)? This is very reminiscent of the different types of centering in multilevel modeling (e.g. grand-mean centering vs. group-mean [a.k.a. within-context] centering) – Patrick Coulombe Jul 15 '13 at 3:43
• +1, this is good info. To quibble: in this context, an additional benefit of centering is that you avoid the multicollinearity that would otherwise occur in creating the interaction terms. – gung - Reinstate Monica Jul 15 '13 at 3:44
• @PatrickCoulombe I added the code above to double check. – Jeromy Anglim Jul 15 '13 at 3:58
• I don't think that we are talking about the same thing. The OP asked about having 2 separate regressions, one for males and one for females, the 2 models using: 1) IVs centered around the grand mean (i.e. of both males & females, even though you're then running the regression for the two groups separately); 2) IVs centered around the group mean (which is what you added in your code). You would need to try centering BEFORE, not after, selecting observations based on gender. – Patrick Coulombe Jul 15 '13 at 4:04
• @PatrickCoulombe good point. I've updated. They still look the same. – Jeromy Anglim Jul 15 '13 at 4:22