This template draws a scatterplot and the user has control over the best-fitting line. If the user changes the intercept and slope, then the line automatically moves and summary statistics are automatically computed and updated. This gives insight into minimizing SSE and R2. The user also controls the error structure to see its effect on the regression and the scatterplot.

Finally, the user can hit a button to automatically minimize the best-fitting line using least squares (sum of squares) or sum of absolute error.