GATE DA 2025 | Question 34
Given data \(\{(-1, 1), (2, -5), (3, 5)\}\) of the form \((x, y)\), we fit a model \(y = wx\) using linear least-squares regression. The optimal value of \(w\) is __________
(Round off to three decimal places)
Explanation
Answer: 0.29
The model has no intercept, so least squares picks \(w\) to minimise \(L(w) = \sum_i (y_i - w x_i)^{2}\). Setting \(L'(w) = -2\sum_i x_i (y_i - w x_i) = 0\) gives
\[w = \frac{\sum_i x_i y_i}{\sum_i x_i^{2}}.\]
Here \(\sum x_i y_i = (-1)(1) + (2)(-5) + (3)(5) = 4\) and \(\sum x_i^{2} = 1 + 4 + 9 = 14\), so \(w = \frac{4}{14} = \frac{2}{7} \approx 0.286\).
Fitting a line with an intercept would give a different slope (about 0.308), but this model is forced through the origin.
Answer: 0.286