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

Homework Help: Least Squares Regression

  1. Jun 28, 2010 #1
    1. The problem statement, all variables and given/known data

    [PLAIN]http://img683.imageshack.us/img683/4744/leastsquares.jpg [Broken]
    [PLAIN]http://img149.imageshack.us/img149/4793/graphwd.jpg [Broken]

    2. Relevant equations



    3. The attempt at a solution

    So would these be the points?
    (-41,51),(-22,62),(23,63),(44,24)

    I'm not too sure how to evaluate the sigmas because it shows n as being the subscript up above in the directions but in the problem it shows i as being the subscript, and I don't understand how i can equal 1. When clearly the subscript is not always 1.
     
    Last edited by a moderator: May 4, 2017
  2. jcsd
  3. Jun 28, 2010 #2

    LCKurtz

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    Your xi's are x1=-4, x2=-2, x3= 2, x4= 4 and your yi's are the corresponding y values. i goes from 1 to 4.
     
  4. Jun 28, 2010 #3
    So I would have...

    nc+0b+40a=19
    0c+40b+144a=-12
    40c+144b+544a=160

    Is this correct for the system of equations? What would n be?
     
    Last edited: Jun 28, 2010
  5. Jun 28, 2010 #4

    LCKurtz

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    They look correct. n is the number of points.
     
  6. Jun 29, 2010 #5
    The system of equations I have created is wrong. I started to solve the system of equations

    4c+0b+40a=19
    0c+40b+144a=-12
    40c+144b+544a=160

    I used linear combinations to start to solve it and I got -9\52 for b. The equation for the regression is suppose to be
    y=(-5/14)x2-(3/10)x+(41/6) and since the b I got doesn't match up with the b in the answer if I solved for a and c those values would also be wrong. I know I'm solving the system correctly because I checked my solution with a matrix on my calculator and my solution matches the one calculated using matrices.

    What's wrong with my system of equations?
     
    Last edited: Jun 29, 2010
  7. Jun 29, 2010 #6

    ehild

    User Avatar
    Homework Helper

    I got the same result as you. Try to plug in the x values into the equation given as solution. You will see, they do not match to the given curve. Try the same with your parameters.

    ehild
     
  8. Jun 30, 2010 #7
    Check your term for "sum-of-x-cubes" again. Since the ordinates x_i are equally disposed about zero, this term should be zero as well. I have not check any other values.
     
  9. Jun 30, 2010 #8

    ehild

    User Avatar
    Homework Helper

    Oops... That is right.

    ehild
     
  10. Jun 30, 2010 #9
    ohhh... ok, thanks. haha that was a stupid mistake.

    4c+0b+40a=19
    0c+40b+0a=-12
    40c+0b+544a=160
     
  11. Jul 1, 2010 #10
    I'm stuck on another one of these problems. This time I have the system of equations and I know It's right, but I'm not sure how I can solve it.

    4c+9b+29a=20
    9c+29b+99a=70
    29c+99b+353a=254

    I know that the solution is a=1 b=-1 c=0 but I'm not sure how to solve the equation to get those variables.

    I'm trying to get it into row echelon form. The only thing that I can do to eliminate a vairable is subtract the third equation from 11 times the first equation. That yields:

    -11c+0b+63a=254
    9c+29b+99a=70
    29c+99b+353a=254

    I don't see how I can eliminate any other variables.
     
  12. Jul 3, 2010 #11

    ehild

    User Avatar
    Homework Helper

    You should do Gauss elimination systematically, but before it, try to make the equations a bit more "friendly". At start, subtract 2 times the first equation from the second, and 3 times the second equation from the third.

    ehild
     
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook