Errors in Linear Regression


If we take a ruler and draw a straight line through the scatter plot that would cover most of the points, then the error is the vertical distance from the line we drew to the points on the scatter plot.


Let's look at the two examples.

In Example 1, the errors consist of the sum of all the vertical distances from the straight line we drew to each point on the scatter plot.

Scatter Plot of the cost with errors

In Example 2, the errors consist of the sum of all the vertical distances from the straight line we drew to each point on the scatter plot. Notice that there are two points on the vertical axis. We just take one point at a time and calculate the distance from it to the straight line.
Scatter Plot of the cost with errors

We will be learning simple linear regression analysis which consists of determining the line that best suits the data that is available to us. This line of best fit is the line with the least errors.