Question 6.8.1: Find the least-squares line y = β0 + β1x that best fits the ...
Find the least-squares line y=\beta_{0}+\beta_{1} x that best fits the data (-2, 3), (-1, 5), (0, 5), (1, 4), and (2,3). Suppose the errors in measuring the y-values of the last two data points are greater than for the other points. Weight these data half as much as the rest of the data.
Learn more on how we answer questions.
As in Section 6.6, write X for the matrix A and β for the vector x, and obtain
X=\left[\begin{array}{rr}1 & -2 \\1 & -1 \\1 & 0 \\1 & 1 \\1 & 2\end{array}\right],\quad \beta=\left[\begin{array}{l}\beta_{0} \\\beta_{1}\end{array}\right], \quad y =\left[\begin{array}{l}3 \\5 \\5 \\4 \\3\end{array}\right].
For a weighting matrix, choose W with diagonal entries 2, 2, 2, 1, and 1. Left-multiplication by W scales the rows of X and y:
W X=\left[\begin{array}{rr}2 & -4 \\2 & -2 \\2 & 0 \\1 & 1 \\1 & 2\end{array}\right], \quad W y =\left[\begin{array}{r}6 \\10 \\10 \\4 \\3\end{array}\right].
For the normal equation, compute
(W X)^{T} W X=\left[\begin{array}{rr}14 & -9 \\-9 & 25\end{array}\right] \quad \text { and } \quad(W X)^{T} W y =\left[\begin{array}{r}59 \\-34\end{array}\right].
and solve
\left[\begin{array}{rr}14 & -9 \\-9 & 25\end{array}\right]\left[\begin{array}{l}\beta_{0} \\\beta_{1}\end{array}\right]=\left[\begin{array}{r}59 \\-34\end{array}\right].
\text { The solution of the normal equation is (to two significant digits) } \beta_{0}=4.3 \text { and } \beta_{1}=.20.
The desired line is
y=4.3+.20 x.
In contrast, the ordinary least-squares line for these data is
y=4.0-.10 x.
Both lines are displayed in Figure 1.
