Are Equations for Linear Regression Right?

AI Thread Summary
The equations for linear regression presented in the discussion are generally correct, but adjustments are needed when switching between the regression of y on x and x on y. Specifically, when finding the regression of x on y, the variables and their means should be swapped accordingly. The standard form of a linear equation is reiterated, emphasizing the relationship between points on the line and the slope. Additionally, the discussion touches on the implications of changing axes and the relationship between slopes of perpendicular lines. Overall, the key takeaway is the importance of correctly identifying which variable is dependent and which is independent in regression equations.
iVenky
Messages
212
Reaction score
12
I read about "Linear regression" and I want to make sure that what I read is right

Just tell if these equations are right-

Slope of line of regression for y on x is given by

m=\frac{E(XY)-E(X)E(Y)}{E(X^{2})-[E(X)]^{2}}<br /> <br /> \\ m=\frac{Cov(XY)}{Var(X)}<br /> <br /> \\ m=\frac{ρσ_{x}σ_{y}}{σ_{x}^{2}}<br /> <br /> \\ m=\frac{ρσ_{y}}{σ_{x}}<br /> <br /> \\and\ the\ equation\ is<br /> <br /> \\y-\bar{y}= m (x-\bar{x})<br /> <br />

Similarly the slope of line of regression of x on y is given by

<br /> \\<br /> <br /> \\ m=\frac{ρσ_{x}}{σ_{y}}\\and\ the\ equation\ is<br /> <br /> \\x-\bar{x}= m (y-\bar{y})Just tell me if the above equations are right.

Thanks a lot
 
Last edited:
Physics news on Phys.org
Hey iVenky and welcome to the forums.

Those look correct if you swap the x's and x_bar's with the y's and y_bar's. So think about y - y_bar = m(x - x_bar) instead.

Also, we usually we write B0 = y_bar - B1_hat*x_bar (this is obtained by setting x = 0 and solving for y) and B1_hat = m (the gradient).
 
I mean, you should swap
x\ and\ \bar{x}\ with\ y\ and\ \bar{y} for finding out the line of regression for x on y (not y on x) right?
 
No you need to swap both.

Recall that the definition of a straight line in two dimensions has one form which is y - y0 = m(x - x0) and this is something from high school geometry. In this definition (x,y) is a point on the line and (x0,y0) is a specific point on the line with m being the gradient.
 
chiro said:
No you need to swap both.

Recall that the definition of a straight line in two dimensions has one form which is y - y0 = m(x - x0) and this is something from high school geometry. In this definition (x,y) is a point on the line and (x0,y0) is a specific point on the line with m being the gradient.

Please note that I have written the equation for two cases

i) Y is a function of X and the equation is given by the one that you have written
ii) X is a function of Y. By which I mean I have taken the values of Y along the X axis and values of X along the Y axis. If that is the case you have to swap them.

See my question. I have written the equation for both cases. :)
Thanks a lot
 
If you changing the axis then recall that in two dimensions m1*m2 = -1 where m2 is the gradient of the line perpendicular to that involving the gradient m1.
 
If I change the axis the slope won't be perpendicular to the one before. For eg: Y increases as X increases (slope is positive). This means that X increases as Y increases. (once again slope is positive and not negative)
 
Ohh yes, sorry you are spot on.
 
Back
Top