This demonstration allows you to specify a prediction line and see how well it fits the data. When the simulation begins, the prediction line is a horizontal line that goes through the mean of Y. The equation for the line is shown at the bottom of the graph. Since the line is horizontal, it has a slope of 0. The intercept is the mean of Y. The SSE and MSE are also shown. The SSE is the sum of squares error which is equal to the sum of the squared deviations of the points from the line. The MSE is the SSE divided by N-2 where N is the number of points. The SSE and MSE indicate how well the line fits the data. If the fit were perfect, they would both be 0. The point of this demonstration is to allow you to change the prediction line and see its effects on the SSE and MSE.

To change the intercept of the line, click and hold somewhere in the middle of the line and move the line up or down. As you move the line, you will see that the intercept as well as the SSE and MSE change.

To change the slope, click and hold the line at the left end of the line and drag the line down or up. Or, you can click and hold the right end of the line and drag up and down. Notice that as the slope changes, the SSE and MSE change as well.

To see the best-fitting line, click the "Show regression line" button. The best-fitting line is shown in red, as are the SSE and MSE.

1. Find the prediction line and notice what the slope and intercept are. The slope will be 0. The initial value of the intercept will be the mean of Y. Also locate the values of SSE and MSE.
2. Move the line up by clicking and holding in the middle of the line and then dragging it up. Notice that the intercept increases as you move the line up. The slope does not change.
3. Notice how the MSE (which indicates how close the line comes to the points) changes as the intercept changes.
4. Make the slope positive by clicking and holding on the left edge of the line and dragging the line down. Check the slope to make sure it is positive.
5. Reduce the slope by clicking and holding on the right edge of the line and dragging down.
6. Change the slope so as to get the lowest MSE you can get. Then change the intercept to see if you can lower the MSE further. Then change the slope again.
7. Click the "Show regression line" button and see how close your prediction line is to the best-fitting line. Compare the MSE's of the two lines.
8. Click the "new data set" button and find the best fit you can. Compare this to the best-fitting line.
9. Repeat the previous step several times.

Illustrated Instructions

Video Demo
The demonstration starts by dragging each of the 5 points to different locations on the Y axis. Notice how these changes influence the total deviation and area. The video continues by repositioning the regression line by draggin either end as well as the middle. Finaly the regression line that minimizes the squared errors is found by clicking the "OK" button.

Video Demo