What if you were given a table of values that showed the U.S. deficit for each year from 2000 to 2010? How could you use the information in that table to estimate the deficit for 2015? After completing this Concept, you'll be able to perform regression to model real-world situations like this one.
Try This
If you don’t have a graphing calculator, there are resources available on the Internet for finding lines and curves of best fit. For example, the applet at http://science.kennesaw.edu/~plaval/applets/LRegression.html does linear regression on a set of data points; the one at http://science.kennesaw.edu/~plaval/applets/QRegression.html does quadratic regression; and the one at http://science.kennesaw.edu/~plaval/applets/ERegression.html does exponential regression. Also, programs like Microsoft Office or OpenOffice have the ability to create graphs and charts that include lines and curves of best fit.
Watch This
CK-12 Foundation: 1012S Comparing Function Models Using Regression
Guidance
Earlier, you learned how to perform linear regression with a graphing calculator to find the equation of a straight line that fits a linear data set. In this section, you’ll learn how to perform exponential and quadratic regression to find equations for curves that fit non-linear data sets.
Example A
The following table shows how many miles per gallon a car gets at different speeds.
Speed (mph) | Miles per gallon |
---|---|
30 | 18 |
35 | 20 |
40 | 23 |
45 | 25 |
50 | 28 |
55 | 30 |
60 | 29 |
65 | 25 |
70 | 25 |
Using a graphing calculator:
a) Draw the scatterplot of the data.
b) Find the quadratic function of best fit.
c) Draw the quadratic function of best fit on the scatterplot.
d) Find the speed that maximizes the miles per gallon.
e) Predict the miles per gallon of the car if you drive at a speed of 48 mph.
Solution
Step 1: Input the data.
Press [STAT] and choose the [EDIT] option.
Input the values of \begin{align*}x\end{align*} in the first column @$\begin{align*}(L_1)\end{align*}@$ and the values of @$\begin{align*}y\end{align*}@$ in the second column @$\begin{align*}(L_2)\end{align*}@$. (Note: in order to clear a list, move the cursor to the top so that @$\begin{align*}L_1\end{align*}@$ or @$\begin{align*}L_2\end{align*}@$ is highlighted. Then press [CLEAR] and then [ENTER].)
Step 2: Draw the scatterplot.
First press [Y=] and clear any function on the screen by pressing [CLEAR] when the old function is highlighted.
Press [STATPLOT] [STAT] and [Y=] and choose option 1.
Choose the ON option; after TYPE, choose the first graph type (scatterplot) and make sure that the Xlist and Ylist names match the names on top of the columns in the input table.
Press [GRAPH] and make sure that the window is set so you see all the points in the scatterplot. In this case, the settings should be @$\begin{align*}30 \le x \le 80\end{align*}@$ and @$\begin{align*}0 \le y \le 40\end{align*}@$. You can set the window size by pressing the [WINDOW] key at the top.
Step 3: Perform quadratic regression.
Press [STAT] and use the right arrow to choose [CALC].
Choose Option 5 (QuadReg) and press [ENTER]. You will see “QuadReg” on the screen.
Type in @$\begin{align*}L_1, L_2\end{align*}@$ after ‘QuadReg’ and press [ENTER]. The calculator shows the quadratic function: @$\begin{align*}y=-0.017x^2+1.9x-25\end{align*}@$
Step 4: Graph the function.
Press [Y=] and input the function you just found.
Press [GRAPH] and you will see the curve fit drawn over the data points.
To find the speed that maximizes the miles per gallon, use [TRACE] and move the cursor to the top of the parabola. You can also use [CALC] [2nd] [TRACE] and option 4:Maximum, for a more accurate answer. The speed that maximizes miles per gallon is 56 mph.
Finally, plug @$\begin{align*}x = 48\end{align*}@$ into the equation you found: @$\begin{align*}y=-0.017(48)^2+1.9(48)-25=27.032 \ miles \ per \ gallon.\end{align*}@$
Note: The image above shows our function plotted on the same graph as the data points from the table. One thing that is clear from this graph is that predictions made with this function won’t make sense for all values of @$\begin{align*}x\end{align*}@$. For example, if @$\begin{align*}x < 15\end{align*}@$, this graph predicts that we will get negative mileage, which is impossible. Part of the skill of using regression on your calculator is being aware of the strengths and limitations of this method of fitting functions to data.
Example B
The following table shows the amount of money an investor has in an account each year for 10 years.
Year | Value of account |
---|---|
1996 | $5000 |
1997 | $5400 |
1998 | $5800 |
1999 | $6300 |
2000 | $6800 |
2001 | $7300 |
2002 | $7900 |
2003 | $8600 |
2004 | $9300 |
2005 | $10000 |
2006 | $11000 |
Using a graphing calculator:
a) Draw a scatterplot of the value of the account as the dependent variable, and the number of years since 1996 as the independent variable.
b) Find the exponential function that fits the data.
c) Draw the exponential function on the scatterplot.
d) What will be the value of the account in 2020?
Solution
Step 1: Input the data.
Press [STAT] and choose the [EDIT] option.
Input the values of @$\begin{align*}x\end{align*}@$ in the first column @$\begin{align*}(L_1)\end{align*}@$ and the values of @$\begin{align*}y\end{align*}@$ in the second column @$\begin{align*}(L_2)\end{align*}@$.
Step 2: Draw the scatterplot.
First press [Y=] and clear any function on the screen.
Press [GRAPH] and choose Option 1.
Choose the ON option and make sure that the Xlist and Ylist names match the names on top of the columns in the input table.
Press [GRAPH] make sure that the window is set so you see all the points in the scatterplot. In this case the settings should be @$\begin{align*}0 \le x \le 10\end{align*}@$ and @$\begin{align*}0 \le y \le 11000\end{align*}@$.
Step 3: Perform exponential regression.
Press [STAT] and use the right arrow to choose [CALC].
Choose Option 0 and press [ENTER]. You will see “ExpReg” on the screen.
Press [ENTER]. The calculator shows the exponential function: @$\begin{align*}y=4975.7(1.08)^x\end{align*}@$
Step 4: Graph the function.
Press [Y=] and input the function you just found. Press [GRAPH].
Finally, plug @$\begin{align*}x = 2020 - 1996 = 24\end{align*}@$ into the function: @$\begin{align*}y=4975.7(1.08)^{24}=\underline{\$31551.81}\end{align*}@$
In 2020, the account will have a value of $31551.81.
Note: The function above is the curve that comes closest to all the data points. It won’t return @$\begin{align*}y-\end{align*}@$values that are exactly the same as in the data table, but they will be close. It is actually more accurate to use the curve fit values than the data points.
Solve Applications by Comparing Function Models
Example C
The following table shows the number of students enrolled in public elementary schools in the US (source: US Census Bureau). Make a scatterplot with the number of students as the dependent variable, and the number of years since 1990 as the independent variable. Find which curve fits this data the best and predict the school enrollment in the year 2007.
Year | Number of students (millions) |
---|---|
1990 | 26.6 |
1991 | 26.6 |
1992 | 27.1 |
1993 | 27.7 |
1994 | 28.1 |
1995 | 28.4 |
1996 | 28.1 |
1997 | 29.1 |
1998 | 29.3 |
2003 | 32.5 |
Solution
We need to perform linear, quadratic and exponential regression on this data set to see which function represents the values in the table the best.
Step 1: Input the data.
Input the values of @$\begin{align*}x\end{align*}@$ in the first column @$\begin{align*}(L_1)\end{align*}@$ and the values of @$\begin{align*}y\end{align*}@$ in the second column @$\begin{align*}(L_2)\end{align*}@$.
Step 2: Draw the scatterplot.
Set the window size: @$\begin{align*}0 \le x \le 10\end{align*}@$ and @$\begin{align*}20 \le y \le 40.\end{align*}@$
Here is the scatterplot:
Step 3: Perform Regression.
Linear Regression
The function of the line of best fit is @$\begin{align*}y=0.51x+26.1\end{align*}@$. Here is the graph of the function on the scatterplot:
Quadratic Regression
The quadratic function of best fit is @$\begin{align*}y=0.064x^2-.067x+26.84\end{align*}@$. Here is the graph of the function on the scatterplot:
Exponential Regression
The exponential function of best fit is @$\begin{align*}y=26.2(1.018)^x\end{align*}@$. Here is the graph of the function on the scatterplot:
From the graphs, it looks like the quadratic function is the best fit for this data set. We’ll use this function to predict school enrollment in 2007.
@$\begin{align*}x = 2007 - 1990 = 17\end{align*}@$ so @$\begin{align*}y=0.064(17)^2-.067(17)+26.84\end{align*}@$ which is 44.2 million students.
Watch this video for help with the Examples above.
CK-12 Foundation: 1012 Comparing Function Models Using Regression
Vocabulary
- Mathematical modeling is a process by which we start with a real-life situation and arrive at a quantitative solution.
- If the differences of the @$\begin{align*}y-\end{align*}@$values is always the same, the function is linear.
- If the difference of the differences of the @$\begin{align*}y-\end{align*}@$values is always the same, the function is quadratic.
- If the ratio of the @$\begin{align*}y-\end{align*}@$values is always the same, the function is exponential.
Guided Practice
The profits in dollars of a company are given in the table below. Find the model that describes the relationship to profit as a function of time in years:
@$$\begin{align*}& \text{Time in Years} && 0 && 1 && 2 && 3 && 4 \\ &\text{Profit in Dollars} && 0 && 5000 && 20000 && 45000 && 80000\end{align*}@$$
Solution:
Start by graphing the points, to get a sense of the shape.
This curve looks like it could be quadratic or exponential. If you check the ratios, you would see they are not the same. Checking the differences of differences yields:
@$$\begin{align*}& \text{Time in Years} && 0 && 1 && 2 && 3 && 4 \\ &\text{Profit in Dollars} && 0 && 5000 && 20000 && 45000 && 80000\\ &\text{Differences} && && 5000-0=5000 && 20000-5000=15000 && 45000-20000=25000 && 80000-45000=35000\\ &\text{Differences of Differences} && && 15000-5000=10000 && 25000-15000=10000 && 35000-25000=10000 \end{align*}@$$
Since the differences of differences are the same, this is a quadratic model.
Explore More
For 1-5, suppose as a ball bounces up and down, the maximum height that the ball reaches continually decreases from one bounce to the next. For a given bounce, this table shows the height of the ball with respect to time:
Time (seconds) | Height (inches) |
---|---|
2 | 2 |
2.2 | 16 |
2.4 | 24 |
2.6 | 33 |
2.8 | 38 |
3.0 | 42 |
3.2 | 36 |
3.4 | 30 |
3.6 | 28 |
3.8 | 14 |
4.0 | 6 |
Using a graphing calculator, answer the following questions:
- Draw the scatterplot of the data
- Find the quadratic function of best fit
- Draw the quadratic function of best fit on the scatterplot
- Find the maximum height the ball reaches on the bounce
- Predict how high the ball is at time @$\begin{align*}t = 2.5 \ seconds\end{align*}@$
For 6-9, a chemist has a 250 gram sample of a radioactive material. She records the amount of radioactive material remaining in the sample every day for a week and obtains the data in the following table:
Day | Weight (grams) |
---|---|
0 | 250 |
1 | 208 |
2 | 158 |
3 | 130 |
4 | 102 |
5 | 80 |
6 | 65 |
7 | 50 |
Using a graphing calculator to answer the following questions:
- Draw a scatterplot of the data
- Find the exponential function of best fit
- Draw the exponential function of best fit on the scatterplot
- Predict the amount of material after 10 days
For 10-12, use the following table, which shows the rate of pregnancies (per 1000) for US women aged 15 to 19. (source: US Census Bureau).
- Make a scatterplot with the rate of pregnancies as the dependent variable and the number of years since 1990 as the independent variable.
- Find which type of curve fits this data best.
- Predict the rate of teen pregnancies in the year 2010.
Year | Rate of pregnancy (per 1000) |
---|---|
1990 | 116.9 |
1991 | 115.3 |
1992 | 111.0 |
1993 | 108.0 |
1994 | 104.6 |
1995 | 99.6 |
1996 | 95.6 |
1997 | 91.4 |
1998 | 88.7 |
1999 | 85.7 |
2000 | 83.6 |
2001 | 79.5 |
2002 | 75.4 |