Fitting Linear Models to Data: Learn It 4

Finding the Line of Best Fit

Once we recognize a need for a linear function to model that data, the natural follow-up question is “what is that linear function?”

One way to approximate our linear function is to sketch the line that seems to best fit the data. Then we can extend the line until we can verify the [latex]y[/latex]-intercept. We can approximate the slope of the line by extending it until we can estimate the [latex]\dfrac{\text{rise}}{\text{run}}[/latex].

The table below shows the number of cricket chirps in [latex]15[/latex] seconds, for several different air temperatures, in degrees Fahrenheit.[1]

Chirps [latex]44[/latex] [latex]35[/latex] [latex]20.4[/latex] [latex]33[/latex] [latex]31[/latex] [latex]35[/latex] [latex]18.5[/latex] [latex]37[/latex] [latex]26[/latex]
Temperature [latex]80.5[/latex] [latex]70.5[/latex] [latex]57[/latex] [latex]66[/latex] [latex]68[/latex] [latex]72[/latex] [latex]52[/latex] [latex]73.5[/latex] [latex]53[/latex]

Plotting this data suggests that there may be a positive linear trend, though certainly not perfectly so. We can see from the trend in the data that the number of chirps increases as the temperature increases.

In the plotted data, we have sketched a line that seems to best fit the data.

What is the estimated linear function?

Finding the Line of Best Fit Using a Graphing Utility

While eyeballing a line works reasonably well, there are statistical techniques for fitting a line to data that minimize the differences between the line and data values.[2] One such technique is called least squares regression and can be computed by many graphing calculators as well as both spreadsheet and statistical software. Least squares regression is also called linear regression, and we can use an online graphing calculator to perform linear regressions.

Find the least squares regression line using the cricket-chirp data in the table below.Use an online graphing calculator.

Chirps [latex]44[/latex] [latex]35[/latex] [latex]20.4[/latex] [latex]33[/latex] [latex]31[/latex] [latex]35[/latex] [latex]18.5[/latex] [latex]37[/latex] [latex]26[/latex]
Temperature [latex]80.5[/latex] [latex]70.5[/latex] [latex]57[/latex] [latex]66[/latex] [latex]68[/latex] [latex]72[/latex] [latex]52[/latex] [latex]73.5[/latex] [latex]53[/latex]

Steps to obtain the equation of the regression line and equation:
[latex]\\[/latex]
Step 1: Under “Enter Data”, select the “Enter Own”.
Step 2: Change the name of the [latex]x[/latex]– and [latex]y[/latex]-variable accordingly.
Step 3: Enter the input ([latex]x[/latex]Var) and output ([latex]y[/latex]Var) accordingly.
Step 4: “Submit Data” and you will see the scatterplot on the right side of the statistical tool.
Step 5: Under Plot Options: click on “Regression Line” and you will see that the statistical tool will draw the line that best fit your data in your scatterplot. Right above the scatterplot, you will also see the equation of that line.
[Trouble viewing? Click to open in a new tab.]
Find the equation of the line that best fit the data in the table below using the statistical tool. Is it the same or different as the one you found previously? If it is different, why do you think it is different?

Chirps [latex]44[/latex] [latex]35[/latex] [latex]20.4[/latex] [latex]33[/latex] [latex]31[/latex] [latex]35[/latex] [latex]18.5[/latex] [latex]37[/latex] [latex]26[/latex]
Temperature [latex]80.5[/latex] [latex]70.5[/latex] [latex]57[/latex] [latex]66[/latex] [latex]68[/latex] [latex]72[/latex] [latex]52[/latex] [latex]73.5[/latex] [latex]53[/latex]


  1. Selected data from http://classic.globe.gov/fsl/scientistsblog/2007/10/. Retrieved Aug 3, 2010
  2. Technically, the method minimizes the sum of the squared differences in the vertical direction between the line and the data values.