If the linear regression coefficient of a/b is r, why is the linear regression coefficient of b/a 1/r?

24 Views Asked by At

Consider two datasets of equal length: A and B.

Suppose, I find the linear regression equation between them as $$A = B * r1 + constant1$$ (I used Python functions: numpy.polyfit() or LinearRegression().fit().coef_. Both gave the same value)

This means, I could write $$B = A/r1 - constant1/r1 = A * r2 + constant2$$ where r2 = 1/r1 and constant2 = -constant1/r1

But, when I find the linear regression coefficient between A and B in the opposite direction, I get $r2 \neq 1/r1$.

Particularly, when $r1 < 1$, I expect $r2 > 1$; even that isn't happening. In my project, I get $r1 = 0.75$, so I expect r2 to be 1.33, but I get $r2 = 0.89$ instead.

Note: When I make a scatterplot of A v/s B, and then if I switch it to B v/s A, I would expect the scatter to switch from one side of the 45$^\circ$ line to the other side. But here, both regression values make the scatter lie on the same side of the line.

Hope you people can help. Thanks!