# How to interpret very different interaction coefficients in correlation and regression

I am analyzing a very simple dataset, with numerical dependent variable y, and independent variable x. the dataset has also z, a categorial variable with 2 levels A and B.

If I run the two correlations separately for the levels A and B, I get two very different values (rA = 0.87 and rB = 0.28), pointing toward an interaction effect of z. Yet if I run a regression model, the effect disappears (interaction ß = -0.1591 ± 0.23).

My understanding is that the difference stems from the fact that correlation does not consider the scale of the data (i.e. it normalizes the data) whereas correlation does (i.e. it uses raw data, by default).

This interpretation makes sense if I plot the data

But even if I understand why the coefficients are so different, I don't understand how I should interpret the difference.

Is there an interaction effect, or not? Should I normalize the data in the regression, or report null results?

DATA and R code:

x = c(140.43,139.19,116.27,137.37,146.00,110.43,137.75,151.81,66.04,87.86,149.50,97.30,206.52,180.41,139.58,111.01,183.72,129.39,126.03,117.50,142.39,126.58,199.74,164.36,112.85,150.72,140.43,139.19,116.27,137.37,146.00,110.43,137.75,151.81,66.04,87.86,149.50,97.30,206.52,180.41,139.58,111.01,183.72,129.39,126.03,117.50,142.39,126.58,199.74,164.36,112.85,150.72)
y = c(154,159,147,161,149,143,162,164,118,147,169,125,182,163,167,144,191,160,152,142,156,141,195,158,133,145,105,105,185,127,103,104,194,134,89,169,114,100,135,138,191,108,197,111,192,111,165,123,179,98,95,90)
z = factor(c("A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B"))

coef(lm(y~x*z))
#(Intercept)           x          zB        x:zB
# 89.4084893   0.4767568   0.1206448  -0.1591085
cor(x[z=="A"],y[z=="A"]) #0.8708543
cor(x[z=="B"],y[z=="B"]) #0.2766038

• One issue is probably that the line doesn't fit well for z = B. – Peter Flom Jul 1 at 12:28

Is there an interaction effect, or not?

Barely. There is an interaction in these data, because the estimate for the interaction coefficient is -0.16 and this seems to be meaningful in the context of the model, given that the estimated coefficient for x is 0.48, although with an intercept of 89 (and the mean of y of 144) it may not be meaningful in the context of your study. However if there is actually no interaction at all, and you repeated the study, there is a 0.50 probability that you would obtain results at least as extreme as what you found here.

Peter Flom has quite correctly commented on the question that this is due to the association between x and y being small in the group when z is B, which is fairly obvious from the plots. We can also see that R-Squared for the regression of y on x in group B is 0.08 (the correlation squared) which means that only 8% of the variation in y is explained by x in the B group.

Should I normalize the data in the regression, or report null results?

It is important to note that normalising the data will not change the message, it is simply a re-parameterisation of the the same model. You will still obtain the same p-value of 0.50 for the interaction (p values for other estimates will change). Only you can decide whether it makes sense to normalise - it is a matter of interpretaion - quite often both are reported.

Also note the range of the data. Even though the correlation between x and y is fairly high, the regression coefficient of 0.48 for x is quite small in relation to the mean of y of 144, so you might want to consider how important / meaninful this is.

Rather than normalising, you could consider centering the data. Again, this won't change the message but it might improve the interpretation because the intercept term will be more meaningful.