#URGENT : Least squares line fit of the form

28 messages · Page 1 of 1 (latest)

unborn mulch
#

Last two on my assignment and I'm fully lost and no resource is helping
6. Find the least squares line fit of the form y = ax + b through the data
(-2,2), (1,0), (2,-4), (5,-6). What is the residual?
7. Find the least squares quadratic fit of the form y = ax^2 + bx + c through the data
(-3,1), (-2,2), (1,0), (2,-4), (4,-5), (5,-6). What is the residual?

high daggerBOT
#
  1. Ask your question and show the work you've done so far. If you've posted a screenshot of a question, specify which part you need help with.
  2. Wait patiently for a helper to come along.
  3. Once someone helps you, say thank you and close the thread with:
    +close
    
  4. Feel free to nominate the person for helper of the week in #helper-nominations
  5. Do not ping the mods, unless someone is breaking the rules.
  6. If you're happy with the help you got here, and the server overall, you can contribute financially as well:
unborn mulch
#

URGENT : Least squares line fit of the form

#

Nothing I've done so far is working and Im runninginto issues and a lotta scratch out pages

winter scaffold
#

The residuals are then just, if $f(x)$ is your fit, $y_i-f(x_i)$ for each data point $(x_i,y_i)$

frigid basaltBOT
#

Omegabet_

unborn mulch
#

I think I got 6 thoguh

winter scaffold
#

You get Ax=b as your system, then the normal equations are obtained by left multiplication by the adjoint, which here is just the transpose

#

Like for 5 you get the normal equations as [34,6],[6,4]=(-42,-8)

#

Which has a unique solution since the matrix is invertible

#

@unborn mulch

unborn mulch
winter scaffold
#

so yeah

#

then same thing for 6, just more variables

unborn mulch
#

ah thats the fun part got it!

#

then likely im fussing up numbers

winter scaffold
#

probably

unborn mulch
#

should I open a new channel for new questions or keep it here?

winter scaffold
#

you can keep it here, but I'm unable to help further as of rn

unborn mulch
#

That’s ok! I’ll make a new one then!

winter scaffold
#

Plugging in the data gives the system $\begin{bmatrix}2&1\1&1\2&1\5&1\end{bmatrix}\begin{bmatrix}a\b\end{bmatrix}=\begin{bmatrix}2\0\4\-6\end{bmatrix}$

frigid basaltBOT
#

Omegabet_

winter scaffold
#

to which as said, you left multiply by the transpose of the coefficient matrix then solve the resulting system

unborn mulch
#

gotcha

unborn mulch
#

+close