StudySmarter AI is coming soon!

- :00Days
- :00Hours
- :00Mins
- 00Seconds

A new era for learning is coming soonSign up for free

Suggested languages for you:

Americas

Europe

Q2E

Expert-verifiedFound in: Page 331

Book edition
5th

Author(s)
David C. Lay, Steven R. Lay and Judi J. McDonald

Pages
483 pages

ISBN
978-03219822384

**In Exercises 1-4, find the equation \(y = {\beta _0} + {\beta _1}x\) of the least-square line that best fits the given data points.**

** **

- \(\left( {1,0} \right),\left( {2,1} \right),\left( {4,2} \right),\left( {5,3} \right)\)

The equation of the least-square line that best fits is \(y = - 0.6 + 0.7x\)

Use the *x* and *y* coordinates to find the \(X\) and \(y\) matrices.

\(X = \left[ {\begin{aligned}1&1\\1&2\\1&4\\1&5\end{aligned}} \right]\) and \(y = \left[ {\begin{aligned}0\\1\\2\\3\end{aligned}} \right]\)

The normal equation of \(X\beta = y\) can be obtained using \({X^T}X\beta = {X^T}y\) which is equivalent to \(\beta = {\left( {{X^T}X} \right)^{ - 1}}{X^T}y\).

Find \({X^T}X\) as follows:

\(\begin{aligned}{X^T}X &= \left[ {\begin{aligned}1&1&1&1\\1&2&4&5\end{aligned}} \right]\left[ {\begin{aligned}1&1\\1&2\\1&4\\1&5\end{aligned}} \right]\\ &= \left[ {\begin{aligned}{1 + 1 + 1 + 1}&{1 + 2 + 4 + 5}\\{1 + 2 + 4 + 5}&{1 + 4 + 16 + 25}\end{aligned}} \right]\\ &= \left[ {\begin{aligned}4&{12}\\{12}&{46}\end{aligned}} \right]\end{aligned}\)

Find the inverse of \({X^T}X\) as follows:

\(\begin{aligned}{\left( {{X^T}X} \right)^{ - 1}} &= {\left[ {\begin{aligned}4&{12}\\{12}&{46}\end{aligned}} \right]^{ - 1}}\\ &= \frac{1}{{184 - 144}}\left[ {\begin{aligned}{46}&{ - 12}\\{ - 12}&4\end{aligned}} \right]\\ &= \frac{1}{{40}}\left[ {\begin{aligned}{46}&{ - 12}\\{ - 12}&4\end{aligned}} \right]\end{aligned}\)

Find \({X^T}y\) as follows:

\(\begin{aligned}{X^T}y &= \left[ {\begin{aligned}1&1&1&1\\1&2&4&5\end{aligned}} \right]\left[ {\begin{aligned}0\\1\\2\\3\end{aligned}} \right]\\ &= \left[ {\begin{aligned}{0 + 1 + 2 + 3}\\{0 + 2 + 8 + 15}\end{aligned}} \right]\\ &= \left[ {\begin{aligned}6\\{25}\end{aligned}} \right]\end{aligned}\)

Substitute the calculated values in \(\beta = {\left( {{X^T}X} \right)^{ - 1}}{X^T}y\) and solve it as follows:

\(\begin{aligned}\beta &= {\left( {{X^T}X} \right)^{ - 1}}{X^T}y\\\beta &= \frac{1}{{40}}\left[ {\begin{aligned}{46}&{ - 12}\\{ - 12}&4\end{aligned}} \right]\left[ {\begin{aligned}6\\{25}\end{aligned}} \right]\\\beta &= \frac{1}{{40}}\left[ {\begin{aligned}{276 - 300}\\{ - 72 + 100}\end{aligned}} \right]\\\beta &= \frac{1}{{40}}\left[ {\begin{aligned}{ - 24}\\{28}\end{aligned}} \right]\\\left[ {\begin{aligned}{{\beta _0}}\\{{\beta _1}}\end{aligned}} \right] &= \left[ {\begin{aligned}{ - 0.6}\\{0.7}\end{aligned}} \right]\end{aligned}\)

Hence, the equation of the least-square line that best fits is \(y = - 0.6 + 0.7x\).

94% of StudySmarter users get better grades.

Sign up for free