I don't know what is the appropriate term for my question. The scenario is described as following.
In the analysis there one dependent variable Y and two independent variable X1 and X2.
All three variables are continuous.
I converted X1 into a categorical variable which has three levels A, B, and C. It was found that Y and X2 are positively correlated in group A and B, but negatively correlated in group C.
I was told that convert a continuous variable into categorical was generally a bad idea and I understand this. My question is, how can I demonstrate the above pattern without break X1 into categories? I was suggested to go with multiple regression, but I still don't know how to demonstrate this kind of relationship in the three variables with multiple regression.
Thanks.