Linear regression
Problem
Consider the data:
i |
xi |
yi |
1 |
1 |
1 |
2 |
2 |
1 |
3 |
3 |
2 |
4 |
4 |
2 |
Find a straight line such that is minimized.
Thought
For any given data set and the straight line , the key observation here is that
With
we are looking for appropriate to minimize . This is a least square problem, and we know that the answer is .
Sample answer
Let
Then the answer is
Thus, is the straight line that best describes the data, which is also known as the best fitting line .
This note can be found at Course website > Learning resources.