I have three columns of data, Y, X1, X2 and I want to do single and multi regression on them. For single regression the result is fine:
REG(Y, X1) ==> ŷ = -0.87027X - 0
REG(Y, X2) ==> ŷ = 0.30389X - 0.0003
As you can see for X1, the coefficient is negative while for X2, the coefficient is positive and they are meaningful in my work. However, when I perform a multi-regression calculation, I see a different thing.
REG(Y, X1, X2) ==> ŷ = -0.99349X1 - 0.22949X2 + 0.00022
As you can see both coefficients are negative.
I was wondering what does that mean exactly as I expected to see both negative and positive coefficients.
I also plotted REG(Y,X1,X2) which can be seen below. Note that for a better plot, I did this renaming:
Y -> z-axis
X1 -> x-axis
X2 -> y-axis
As you can see, when X2 (y-axis) increases, Y (z-axis) decreases. This is not true in the case of REG(Y,X2). Any thoughts on that?




It means that there is a negative correlation between $x_1$ and $x_2$, such that even though the effect of $x_2$ on $y$ in itself is negative, if you don't control for $x_1$, the effect comes out positive, because it is outweighed by the confounding factor of high $x_2$ being associated with low $x_1$ which has a positive effect on $y$. That's assuming there isn't some other problem with the regression.