Digital tools

Finding a Line of Best Fit

Most graphing calculators have a function called linear regression, which can be used to find a precise line of fit using strict rules. This line of fit is then called the line of best fit. For example, consider the following data set.
x y
1 33.12
2 24.4
3 16.6
4 9.3
5 3.9

The line of best fit can be calculated following these 3 steps.

1
Enter Values
expand_more

On a graphing calculator, begin by entering the data points. To do so, press the STAT button and select the option Edit.

The window in the calculator, which shows Stat and then Edit

This gives a number of columns, labeled L_1, L_2, L_3, and so on.

Calculator showing two empty lists

Use the arrow keys to choose where in the lists to fill in the data values. Enter the x-values of the data points in L_1 and press ENTER after each value. The same can be done for the the corresponding y-values in column L_2.

Calculator that shows two lists where you entered values
2
Fitting the Line
expand_more

After entering the values, press the STAT button and select the menu item Calc.

Counter that displays the list of CALC and where you have chosen LinReg

The option LinReg(ax+b) gives the line of best fit, expressed as a linear function in slope-intercept form. Press the ENTER button until the parameters are given.

Calculator showing a linear function regression

In this case, the line of best fit is described by the function y= - 7.354x + 39.506. The correlation coefficient r is less than - 0.99, indicating a strong negative correlation. If r does not appear, press 2ND and 0 to get to the CATALOG, then select DiagnosticOn and enable it by pressing ENTER twice. Once more, find the line of best fit.

3
Graphing the Line of Best Fit
expand_more

A graphing calculator can also be used to graph the line of best fit. After selecting the option LinReg(ax+b), choose the option Store RegEQ.

Press VARS and move to the Y-VARS menu. Then, select the option FUNCTION and press ENTER.

Press the ENTER button until the parameters are given. To graph the scatter plot, first push the buttons 2nd and Y=. Then, choose one of the plots in the list. Select the option ON, choose the type to be a scatter plot, and assign L_1 and L_2 as XList and Ylist, respectively.

Then, the plot can be made by pressing the button GRAPH. It is possible that after drawing the plot the window-size is not large enough to see all of the information.

To fix this, press ZOOM and select the option ZoomStat. After doing that, the window will resize to show the important information.

Exercises