4.3 Fitting Linear Models to Data
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.
4.3.1 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. Figure 1 shows a sample scatter plot.

Figure 1 A scatter plot of age and final exam score variables
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.
4.3.2 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 \(y\)-intercept. We can approximate the slope of the line by extending it until we can estimate the \(\frac{\text{rise}}{\text{run}}.\)
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.
Figure 4 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.

Figure 4 Interpolation occurs within the domain and range of the provided data whereas extrapolation occurs outside.
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. 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. 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.
4.3.3 Distinguishing Between Linear and Nonlinear Models
As we saw above with the cricket-chirp model, some data exhibit strong linear trends, but other data, like the final exam scores plotted by age, are clearly 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, Figure 7 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.
4.3.4 Fitting a Regression Line to a Set of Data
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 above, 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.
Section Exercises
Verbal
1. Describe what it means if there is a model breakdown when using a linear model.
Solution (click to reveal)
When our model no longer applies, after some value in the domain, the model itself doesn’t hold.
2. What is interpolation when using a linear model?
3. What is extrapolation when using a linear model?
Solution (click to reveal)
We predict a value outside the domain and range of the data.
4. Explain the difference between a positive and a negative correlation coefficient.
5. Explain how to interpret the absolute value of a correlation coefficient.
Solution (click to reveal)
The closer the number is to 1, the less scattered the data, the closer the number is to 0, the more scattered the data.
Algebraic
6. A regression was run to determine whether there is a relationship between hours of TV watched per day \((x)\) and number of sit-ups a person can do \((y).\) The results of the regression are given below. Use this to predict the number of sit-ups a person who watches 11 hours of TV can do.
\[\begin{array}{l} {y = ax + b} \\ {a = -1.341} \\ {b = 32.234} \\ {\mspace{9mu} r = -0.896} \end{array}\]
7. A regression was run to determine whether there is a relationship between the diameter of a tree ( \(x\) , in inches) and the tree’s age ( \(y\) , in years). The results of the regression are given below. Use this to predict the age of a tree with diameter 10 inches.
\[\begin{array}{l} {y = ax + b} \\ {a = 6.301} \\ {b = -1.044} \\ {\mspace{9mu} r = 0.970} \end{array}\]
Solution (click to reveal)
61.966 years
For the following exercises, draw a scatter plot for the data provided. Does the data appear to be linearly related?
8.
| 0 | 2 | 4 | 6 | 8 | 10 |
| –22 | –19 | –15 | –11 | –6 | –2 |
9.
| 1 | 2 | 3 | 4 | 5 | 6 |
| 46 | 50 | 59 | 75 | 100 | 136 |
Solution (click to reveal)

No.
10.
| 100 | 250 | 300 | 450 | 600 | 750 |
| 12 | 12.6 | 13.1 | 14 | 14.5 | 15.2 |
11.
| 1 | 3 | 5 | 7 | 9 | 11 |
| 1 | 9 | 28 | 65 | 125 | 216 |
Solution (click to reveal)

No.
12. For the following data, draw a scatter plot. If we wanted to know when the population would reach 15,000, would the answer involve interpolation or extrapolation? Eyeball the line, and estimate the answer.
| Year | Population |
|---|---|
| 1990 | 11,500 |
| 1995 | 12,100 |
| 2000 | 12,700 |
| 2005 | 13,000 |
| 2010 | 13,750 |
13. For the following data, draw a scatter plot. If we wanted to know when the temperature would reach 28°F, would the answer involve interpolation or extrapolation? Eyeball the line and estimate the answer.
| Temperature,°F | 16 | 18 | 20 | 25 | 30 |
| Time, seconds | 46 | 50 | 54 | 55 | 62 |
Solution (click to reveal)

Interpolation. About \(60{^\circ}F.\)
Graphical
For the following exercises, match each scatterplot with one of the four specified correlations in Figure 9 and Figure 10.

Figure 9

Figure 10
14. \(r = 0.\text{95}\)
15. \(r = -0.\text{89}\)
Solution (click to reveal)
\(\text{This~value~of~r~indicates~a~strong~negative~correlation~or~slope,~so~C}\)
16. \(r = -0.26\)
17. \(r = -0.39\)
Solution (click to reveal)
\(\text{This~value~of~r~indicates~a~weak~negative~correlation,~so~B}\)
For the following exercises, draw a best-fit line for the plotted data.
18.

19.

Solution (click to reveal)

20.

21.

Solution (click to reveal)

Numeric
22. The U.S. Census tracks the percentage of persons 25 years or older who are college graduates. That data for several years is given in Table 4. Determine whether the trend appears linear. If so, and assuming the trend continues, in what year will the percentage exceed 35%?
| Year | Percent Graduates |
|---|---|
| 1990 | 21.3 |
| 1992 | 21.4 |
| 1994 | 22.2 |
| 1996 | 23.6 |
| 1998 | 24.4 |
| 2000 | 25.6 |
| 2002 | 26.7 |
| 2004 | 27.7 |
| 2006 | 28 |
| 2008 | 29.4 |
Table 4
23. The U.S. import of wine (in hectoliters) for several years is given in Table 5. Determine whether the trend appears linear. If so, and assuming the trend continues, in what year will imports exceed 12,000 hectoliters?
| Year | Imports |
|---|---|
| 1992 | 2665 |
| 1994 | 2688 |
| 1996 | 3565 |
| 1998 | 4129 |
| 2000 | 4584 |
| 2002 | 5655 |
| 2004 | 6549 |
| 2006 | 7950 |
| 2008 | 8487 |
| 2009 | 9462 |
Table 5
Solution (click to reveal)
Yes, trend appears linear because \(r = 0.\text{985}\) and will exceed 12,000 near midyear, 2016, 24.6 years since 1992.
24. Table 6 shows the year and the number of people unemployed in a particular city for several years. Determine whether the trend appears linear. If so, and assuming the trend continues, in what year will the number of unemployed reach 5?
| Year | Number Unemployed |
|---|---|
| 1990 | 750 |
| 1992 | 670 |
| 1994 | 650 |
| 1996 | 605 |
| 1998 | 550 |
| 2000 | 510 |
| 2002 | 460 |
| 2004 | 420 |
| 2006 | 380 |
| 2008 | 320 |
Table 6
Technology
For the following exercises, use each set of data to calculate the regression line using a calculator or other technology tool, and determine the correlation coefficient to 3 decimal places of accuracy.
25.
| \(x\) | 8 | 15 | 26 | 31 | 56 |
| \(y\) | 23 | 41 | 53 | 72 | 103 |
Solution (click to reveal)
\(y = \text{1}.\text{64}0x + \text{13}.\text{8}00,\) \(r = 0.\text{987}\)
26.
| \(x\) | 5 | 7 | 10 | 12 | 15 |
| \(y\) | 4 | 12 | 17 | 22 | 24 |
27.
| \(x\) | \(y\) | \(x\) | \(y\) |
|---|---|---|---|
| 3 | 21.9 | 10 | 18.54 |
| 4 | 22.22 | 11 | 15.76 |
| 5 | 22.74 | 12 | 13.68 |
| 6 | 22.26 | 13 | 14.1 |
| 7 | 20.78 | 14 | 14.02 |
| 8 | 17.6 | 15 | 11.94 |
| 9 | 16.52 | 16 | 12.76 |
Solution (click to reveal)
\(y = - 0.962x + 26.86,~~~r = - 0.965\)
28.
| \(x\) | \(y\) |
|---|---|
| 4 | 44.8 |
| 5 | 43.1 |
| 6 | 38.8 |
| 7 | 39 |
| 8 | 38 |
| 9 | 32.7 |
| 10 | 30.1 |
| 11 | 29.3 |
| 12 | 27 |
| 13 | 25.8 |
29.
| \(x\) | 21 | 25 | 30 | 31 | 40 | 50 |
| \(y\) | 17 | 11 | 2 | –1 | –18 | –40 |
Solution (click to reveal)
\(y = - \text{1}.\text{981}x + \text{6}0.\text{197;}\) \(r = - 0.\text{998}\)
30.
| \(x\) | \(y\) |
|---|---|
| 100 | 2000 |
| 80 | 1798 |
| 60 | 1589 |
| 55 | 1580 |
| 40 | 1390 |
| 20 | 1202 |
31.
| \(x\) | 900 | 988 | 1000 | 1010 | 1200 | 1205 |
| \(y\) | 70 | 80 | 82 | 84 | 105 | 108 |
Solution (click to reveal)
\(y = 0.\text{121}x - 38.841,r = 0.998\)
Extensions
32. Graph \(f(x) = 0.5x + 10.\) Pick a set of five ordered pairs using inputs \(x = -2,\text{1},\text{5},\text{6},9\) and use linear regression to verify that the function is a good fit for the data.
33. Graph \(f(x) = - 2x - 10.\) Pick a set of five ordered pairs using inputs \(x = -2,\text{1},\text{5},\text{6},9\) and use linear regression to verify the function.
Solution (click to reveal)
\((-2,-6),(1,\text{−12}),(5,-20),(6,\text{−22}),(9,\text{−28});\) Yes, the function is a good fit.
For the following exercises, consider this scenario: The profit of a company decreased steadily over a ten-year span. The following ordered pairs shows dollars and the number of units sold in hundreds and the profit in thousands of dollars over the ten-year span, (number of units sold, profit) for specific recorded years:
\((46,1{,}600),(48,1{,}550),(50,1{,}505),(52,1{,}540),(54,1{,}495).\)
34. Use linear regression to determine a function \(P\) where the profit in thousands of dollars depends on the number of units sold in hundreds.
35. Find to the nearest tenth and interpret the \(x\)-intercept.
Solution (click to reveal)
\((\text{189}.8,0)\) If 18,980 units are sold, the company will have a profit of zero dollars.
36. Find to the nearest tenth and interpret the \(y\)-intercept.
Real-World Applications
For the following exercises, consider this scenario: The population of a city increased steadily over a ten-year span. The following ordered pairs shows the population and the year over the ten-year span, (population, year) for specific recorded years:
\((\text{25}00,2000),(\text{265}0,2001),(3000,2003),(\text{35}00,2006),(\text{42}00,2010)\)
37. Use linear regression to determine a function \(y,\) where the year depends on the population. Round to three decimal places of accuracy.
Solution (click to reveal)
\(y = 0.00587x + \text{1985}.4\text{1}\)
38. Predict when the population will hit 8,000.
For the following exercises, consider this scenario: The profit of a company increased steadily over a ten-year span. The following ordered pairs show the number of units sold in hundreds and the profit in thousands of dollars over the ten year span, (number of units sold, profit) for specific recorded years:
\((\text{46},\text{25}0),(\text{48},\text{3}05),(50,\text{35}0),(\text{52},\text{39}0),(\text{54},\text{41}0).\)
39. Use linear regression to determine a function \(y\), where the profit in thousands of dollars depends on the number of units sold in hundreds.
Solution (click to reveal)
\(y = \text{2}0.\text{25}x - \text{671}.\text{5}\)
40. Predict when the profit will exceed one million dollars.
For the following exercises, consider this scenario: The profit of a company decreased steadily over a ten-year span. The following ordered pairs show dollars and the number of units sold in hundreds and the profit in thousands of dollars over the ten-year span (number of units sold, profit) for specific recorded years:
\((\text{46},\text{25}0),(\text{48},\text{225}),(50,\text{2}05),(\text{52},\text{18}0),(\text{54},\text{165}).\)
41. Use linear regression to determine a function \(y\), where the profit in thousands of dollars depends on the number of units sold in hundreds.
Solution (click to reveal)
\(y = - \text{1}0.\text{75}x + \text{742}.\text{5}0\)
42. Predict when the profit will dip below the $25,000 threshold.





