### Learning Outcomes

- Draw and interpret scatter plots.
- Find the line of best fit.
- Distinguish between linear and nonlinear relations.
- Use a linear model to make predictions.

A professor is attempting to identify trends among final exam scores. His class has a mixture of students, so he wonders if there is any relationship between age and final exam scores. One way for him to analyze the scores is by creating a diagram that relates the age of each student to the exam score received. In this section, we will examine one such diagram known as a scatter plot.

## Drawing and Interpreting Scatter Plots

A **scatter plot** is a graph of plotted points that may show a relationship between two sets of data. If the relationship is from a **linear model**, or a model that is nearly linear, the professor can draw conclusions using his knowledge of linear functions. Below is a sample scatter plot.

Notice this scatter plot does *not* indicate a **linear relationship**. The points do not appear to follow a trend. In other words, there does not appear to be a relationship between the age of the student and the score on the final exam.

### Example 1: Using a Scatter Plot to Investigate Cricket Chirps

The table below shows the number of cricket chirps in 15 seconds, for several different air temperatures, in degrees Fahrenheit.^{[1]} Plot this data, and determine whether the data appears to be linearly related.

Chirps |
44 | 35 | 20.4 | 33 | 31 | 35 | 18.5 | 37 | 26 |

Temperature |
80.5 | 70.5 | 57 | 66 | 68 | 72 | 52 | 73.5 | 53 |

## Finding the Line of Best Fit

Once we recognize a need for a linear function to model the data in “Draw and interpret scatter plots,” 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 *y*-intercept. We can approximate the slope of the line by extending it until we can estimate the [latex]\frac{\text{rise}}{\text{run}}[/latex].

### Example 2: Finding a Line of Best Fit

Find a linear function that fits the data in the table below by “eyeballing” a line that seems to fit.

Chirps |
44 | 35 | 20.4 | 33 | 31 | 35 | 18.5 | 37 | 26 |

Temperature |
80.5 | 70.5 | 57 | 66 | 68 | 72 | 52 | 73.5 | 53 |

## Recognizing Interpolation or Extrapolation

While the data for most examples does not fall perfectly on the line, the equation is our best guess as to how the relationship will behave outside of the values for which we have data. We use a process known as **interpolation** when we predict a value inside the domain and range of the data. The process of **extrapolation** is used when we predict a value outside the domain and range of the data.

The graph below compares the two processes for the cricket-chirp data addressed in Example 2. We can see that interpolation would occur if we used our model to predict temperature when the values for chirps are between 18.5 and 44. Extrapolation would occur if we used our model to predict temperature when the values for chirps are less than 18.5 or greater than 44.

There is a difference between making predictions inside the domain and range of values for which we have data and outside that domain and range. Predicting a value outside of the domain and range has its limitations. When our model no longer applies after a certain point, it is sometimes called **model breakdown**. For example, predicting a cost function for a period of two years may involve examining the data where the input is the time in years and the output is the cost. But if we try to extrapolate a cost when *x* = 50, that is in 50 years, the model would not apply because we could not account for factors fifty years in the future.

### A General Note: Interpolation and Extrapolation

Different methods of making predictions are used to analyze data.

- The method of
**interpolation**involves predicting a value inside the domain and/or range of the data. - The method of
**extrapolation**involves predicting a value outside the domain and/or range of the data. **Model breakdown**occurs at the point when the model no longer applies.

### Example 3: Understanding Interpolation and Extrapolation

Chirps |
44 | 35 | 20.4 | 33 | 31 | 35 | 18.5 | 37 | 26 |

Temperature |
80.5 | 70.5 | 57 | 66 | 68 | 72 | 52 | 73.5 | 53 |

Use the cricket data above to answer the following questions:

- Would predicting the temperature when crickets are chirping 30 times in 15 seconds be interpolation or extrapolation? Make the prediction, and discuss whether it is reasonable.
- Would predicting the number of chirps crickets will make at 40 degrees be interpolation or extrapolation? Make the prediction, and discuss whether it is reasonable.

### Try It

According to the data from the table in Example 3, what temperature can we predict it is if we counted 20 chirps in 15 seconds?

## 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, spreadsheet software, statistical software, and many web-based calculators.^{[3]} Least squares regression is one means to determine the line that best fits the data, and here we will refer to this method as linear regression.

### How To: Given data of input and corresponding outputs from a linear function, find the best fit line using linear regression.

- Enter the input in List 1 (L1).
- Enter the output in List 2 (L2).
- On a graphing utility, select Linear Regression (LinReg).

### Example 4: Finding a Least Squares Regression Line

Find the least squares regression line using the cricket-chirp data in the table below.

Chirps |
44 | 35 | 20.4 | 33 | 31 | 35 | 18.5 | 37 | 26 |

Temperature |
80.5 | 70.5 | 57 | 66 | 68 | 72 | 52 | 73.5 | 53 |

### Q & A

**Will there ever be a case where two different lines will serve as the best fit for the data?**

*Although there are other ways to find “best fit” lines, we will always use the least squares regression line.*

## Distinguishing Between Linear and Non-Linear Models

Some data exhibit strong linear trends, but other data are nonlinear. Most calculators and computer software can also provide us with the **correlation coefficient**, which is a measure of how closely the line fits the data. Many graphing calculators require the user to turn a “diagnostic on” selection to find the correlation coefficient, which mathematicians label as *r*. The correlation coefficient provides an easy way to get an idea of how close to a line the data falls.

We should compute the correlation coefficient only for data that follows a linear pattern or to determine the degree to which a data set is linear. If the data exhibits a nonlinear pattern, the correlation coefficient for a linear regression is meaningless. To get a sense for the relationship between the value of *r* and the graph of the data, the image below shows some large data sets with their correlation coefficients. Remember, for all plots, the horizontal axis shows the input and the vertical axis shows the output.

### A General Note: Correlation Coefficient

The **correlation coefficient** is a value, *r*, between –1 and 1.

*r*> 0 suggests a positive (increasing) relationship*r*< 0 suggests a negative (decreasing) relationship- The closer the value is to 0, the more scattered the data.
- The closer the value is to 1 or –1, the less scattered the data is.

### Example 5: Finding a Correlation Coefficient

Calculate the correlation coefficient for cricket-chirp data in the table below.

Chirps |
44 | 35 | 20.4 | 33 | 31 | 35 | 18.5 | 37 | 26 |

Temperature |
80.5 | 70.5 | 57 | 66 | 68 | 72 | 52 | 73.5 | 53 |

## Predicting with a Regression Line

Once we determine that a set of data is linear using the correlation coefficient, we can use the regression line to make predictions. As we learned previously, a regression line is a line that is closest to the data in the scatter plot, which means that only one such line is a best fit for the data.

### Example 6: Using a Regression Line to Make Predictions

Gasoline consumption in the United States has been steadily increasing. Consumption data from 1994 to 2004 is shown in the table below.^{[4]} Determine whether the trend is linear, and if so, find a model for the data. Use the model to predict the consumption in 2008.

Year |
’94 | ’95 | ’96 | ’97 | ’98 | ’99 | ’00 | ’01 | ’02 | ’03 | ’04 |

Consumption (billions of gallons) |
113 | 116 | 118 | 119 | 123 | 125 | 126 | 128 | 131 | 133 | 136 |

The scatter plot of the data, including the least squares regression line, is shown in Figure 8.

### Try It

Use the model we created using technology in Example 6 to predict the gas consumption in 2011. Is this an interpolation or an extrapolation?

## Key Concepts

- Scatter plots show the relationship between two sets of data.
- Scatter plots may represent linear or non-linear models.
- The line of best fit may be estimated or calculated, using a calculator or statistical software.
- Interpolation can be used to predict values inside the domain and range of the data, whereas extrapolation can be used to predict values outside the domain and range of the data.
- The correlation coefficient,
*r*, indicates the degree of linear relationship between data. - A regression line best fits the data.
- The least squares regression line is found by minimizing the squares of the distances of points from a line passing through the data and may be used to make predictions regarding either of the variables.

## Glossary

**correlation coefficient**- a value,
*r*, between –1 and 1 that indicates the degree of linear correlation of variables, or how closely a regression line fits a data set.

**extrapolation**- predicting a value outside the domain and range of the data

**interpolation**- predicting a value inside the domain and range of the data

**least squares regression**- a statistical technique for fitting a line to data in a way that minimizes the differences between the line and data values

**model breakdown**- when a model no longer applies after a certain point

- Selected data from http://classic.globe.gov/fsl/scientistsblog/2007/10/. Retrieved Aug 3, 2010 ↵
- Technically, the method minimizes the sum of the squared differences in the vertical direction between the line and the data values. ↵
- For example, http://www.shodor.org/unchem/math/lls/leastsq.html ↵
- http://www.bts.gov/publications/national_transportation_statistics/2005/html/table_04_10.html ↵