Question
please answer all parts
4. Least Square Method A. (10 points) Use the least squares method and find a linear fit for the following points: (0, -3), (
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Part(a)

.

equation of the line is

y=mx+b

mx+b=y

put all data points

0m+b=-3

2m +b= -3

m+b=-4

4m+b=5

system Ax=b is

\begin{pmatrix}0&1\\ 2&1\\ 1&1\\ 4&1\end{pmatrix}\begin{pmatrix}m\\ b\end{pmatrix}=\begin{pmatrix}-3\\ -3\\ -4\\ 5\end{pmatrix}

here we have

A=\begin{pmatrix}0&1\\ 2&1\\ 1&1\\ 4&1\end{pmatrix},\:A^T=\begin{pmatrix}0&2&1&4\\ 1&1&1&1\end{pmatrix},\:b=\begin{pmatrix}-3\\ -3\\ -4\\ 5\end{pmatrix}

.

take A^TA

A^TA=\begin{pmatrix}0&2&1&4\\ 1&1&1&1\end{pmatrix}\begin{pmatrix}0&1\\ 2&1\\ 1&1\\ 4&1\end{pmatrix}

A^TA=\begin{pmatrix}0\cdot \:0+2\cdot \:2+1\cdot \:1+4\cdot \:4&0\cdot \:1+2\cdot \:1+1\cdot \:1+4\cdot \:1\\ 1\cdot \:0+1\cdot \:2+1\cdot \:1+1\cdot \:4&1\cdot \:1+1\cdot \:1+1\cdot \:1+1\cdot \:1\end{pmatrix}

A^TA=\begin{pmatrix}21&7\\ 7&4\end{pmatrix}

.

take A^Tb

A^Tb= \begin{pmatrix}0&2&1&4\\ 1&1&1&1\end{pmatrix}\begin{pmatrix}-3\\ -3\\ -4\\ 5\end{pmatrix}

A^Tb= \begin{pmatrix}0\cdot \left(-3\right)+2\left(-3\right)+1\cdot \left(-4\right)+4\cdot \:5\\ 1\cdot \left(-3\right)+1\cdot \left(-3\right)+1\cdot \left(-4\right)+1\cdot \:5\end{pmatrix}

A^Tb= \begin{pmatrix}10\\ -5\end{pmatrix}

.

now solve the system for

LATA].x = AT6

\begin{pmatrix}21&7\\ 7&4\end{pmatrix}\begin{pmatrix}m\\ b\end{pmatrix}=\begin{pmatrix}10\\ -5\end{pmatrix}

the augmented matrix is

\begin{pmatrix}21&7&10\\ 7&4&-5\end{pmatrix}

R_2\:\leftarrow \:R_2-\frac{1}{3}\cdot \:R_1

=\begin{pmatrix}21&7&10\\ 0&\frac{5}{3}&-\frac{25}{3}\end{pmatrix}

R_2\:\leftarrow \frac{3}{5}\cdot \:R_2

=\begin{pmatrix}21&7&10\\ 0&1&-5\end{pmatrix}

R_1\:\leftarrow \:R_1-7\cdot \:R_2

=\begin{pmatrix}21&0&45\\ 0&1&-5\end{pmatrix}

R_1\:\leftarrow \frac{1}{21}\cdot \:R_1

=\begin{pmatrix}1&0&\frac{15}{7}\\ 0&1&-5\end{pmatrix}

least-square solution is

\begin{pmatrix}m\\ b\end{pmatrix}=\begin{pmatrix}\frac{15}{7}\\ -5\end{pmatrix}

so best fit line

{\color{Red} y=\frac{15}{7}x-5}

.

.

Part(a)

.

09 (4,5) 4 2 -2 0 2. 09 8 -2 (0, 3) . (2,3) 4 (1, +4)

from the graph, we can see that it is not the best fit line

the best fit curve would be a parabola

Add a comment
Know the answer?
Add Answer to:
please answer all parts 4. Least Square Method A. (10 points) Use the least squares method...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT