I am running a regression of Y on X (both are continuous variables). I'd like to measure how the effect differs between two groups of individuals, coded by a dummy variable Z. The traditional way of doing it is, I believe, to run:
Y ~ X*Z + X + Z
However, I get much different results when I use an indicator function, meaning, I run:
Y ~ X*1(Z==0) + X*1(Z==1) + Z
Where 1(Z==0) is 1 if Z=0, and 0 otherwise. But I've never seen any regression like that. What is wrong with that approach?