Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Linear regression

  1. Oct 26, 2012 #1
    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

    [itex] m=\frac{E(XY)-E(X)E(Y)}{E(X^{2})-[E(X)]^{2}}

    \\ m=\frac{Cov(XY)}{Var(X)}

    \\ m=\frac{ρσ_{x}σ_{y}}{σ_{x}^{2}}

    \\ m=\frac{ρσ_{y}}{σ_{x}}

    \\and\ the\ equation\ is

    \\y-\bar{y}= m (x-\bar{x})

    [/itex]

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

    [itex]
    \\

    \\ m=\frac{ρσ_{x}}{σ_{y}}


    \\and\ the\ equation\ is

    \\x-\bar{x}= m (y-\bar{y})


    [/itex]


    Just tell me if the above equations are right.

    Thanks a lot
     
    Last edited: Oct 26, 2012
  2. jcsd
  3. Oct 27, 2012 #2

    chiro

    User Avatar
    Science Advisor

    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).
     
  4. Oct 27, 2012 #3
    I mean, you should swap
    [itex] x\ and\ \bar{x}\ with\ y\ and\ \bar{y} [/itex] for finding out the line of regression for x on y (not y on x) right?
     
  5. Oct 27, 2012 #4

    chiro

    User Avatar
    Science Advisor

    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.
     
  6. Oct 27, 2012 #5
    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
     
  7. Oct 27, 2012 #6

    chiro

    User Avatar
    Science Advisor

    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.
     
  8. Oct 27, 2012 #7
    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)
     
  9. Oct 27, 2012 #8

    chiro

    User Avatar
    Science Advisor

    Ohh yes, sorry you are spot on.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Linear regression
Loading...