# Analyzing the effect of categorical variables on a correlation coefficient

For my research project, I’m looking for some help on how to analyze my data. The research setup is as follows: I’ve got two normal variables that I want to correlate with each other and a number of categorical variables. The objective is to figure out the effect of each individual categorical variable on the correlation coefficient, as well as the effects of the interactions between the categorical variables on the correlation coefficient.

I’m new to statistics but I’ve read up a little bit and I’m pretty sure I need more than just one statistical test to do this. I know I can check a variable for significance by splitting it up into two categories, conducting a correlation for each one and comparing the two coefficients, but I’m not sure how to control for the other variables or how to check for interaction effects (other than by splitting my data up for every category and carrying out multiple analyses, which would be very chaotic). Is there any way for me to obtain comprehensive results?

• In ANOVA and regression contexts, when you have interaction effects involving categorical variables, you will want to be sure to use effect coding rather than dummy coding to avoid creating artificial heteroscedasticity that will bias your estimates. For more depth on this point, see Glantz, S. A. and Slinker, B. (2000). Primer of Applied Regression and Analysis of Variance, chapter 8: Two-Way Analysis of Variance, pages 339–417. McGraw-Hill Medical, New York, NY, 2nd edition. – Alexis Sep 18 '14 at 17:51

Assuming that your categorical variable represents independent groups and that you have two such groups. Let $\rho_1$ and $\rho_2$ be the population values of Pearson's correlation coefficients between the 2 normal variables for groups 1 and 2, respectively. By comparing the difference between two correlations, you test $H_0: \rho_1=\rho_2$. To do this, you need to perform the so-called Steiger Test because the two correlations in your study have no shared variable. If you use R you can use r.test in the psych package.