Simple (univariate) Linear Regression
Case 2: Introducing Errors - This case is the same as Case 1 above except that two y values have been changed to create a situation where the data points do not fall into one line. If you just draw a free-hand line through the middle of the data points approximating the average slope of the data set, then you are likely to have a fairly good approximation of the linear regression model line for this case.
You may notice in the graph and the animation that the regression line does not touch any data point after the two y values change. The distance from a data point to the model line is called an error, and its estimate is called a residual. The goal in regression modeling is to place the line so that the sum of squared errors (or SSE) is at minimum.
Using Microsoft Excel the model (for the changed y values) was found to y(est) = 0.8x + 1.5. Here, 0.8 is the slope coefficient, or parameter associated with the independent variable x. The coefficient, or parameter, with value 1.5 is the y-intercept. This estimated model may be stated, in general, as y(est) = b0 + b1x. With this notation b0 = 1.5 and b1 = 0.8.
In the table the computations are extended to include the error- (residual-) and sum of squared errors (SSE) calculations. First, the table is extended by a column called y(est). The numbers are obtained simply by using the regression model and substituting independent variable x values one-by-one into this model. E.g., for the first value x=1 we obtain y(est) = 0.8 (1) + 1.5 = 2.3. We then repeat the calculation for the remaining x values. Now, an error is then the difference between the observed value y and the estimated value y(est). The first error, or distance between the data point and the model line, results to -0.3 (y-y(est) = 2 - 2.3 = -0.3). Preferably, and most commonly this error is called a residual. The name error is reserved for the true error, which is estimated by the residual.
Note: I know, that you may be saying that we don't want to calculate these things by hand because we have software and calculators for it. However, I encourage you to play with the numbers a little bit to convince yourself that there is no other line with respect to this data set with a smaller sum of squared errors, SSE. This point is of primary importance for understanding why and how regression models are found. This is valid for all regression modeling, multivariate-, polynomial-, non-linear-, etc. If you get this concept now, you don't need to ask questions, about why and how this works, later!!