Pre-Calc Notes 9/5
(preresiduals)
The Line of Best Fit
Last week we were spending time finding the errors between actual data and predicted values from a line of best fit. We were introduced to finding the errors by using our calculators. We are going to compare a line of best fit that we do versus a linear regression on the calculator to which one is the better fit. Below is data that is somewhat linear.
|
Year |
1978 |
1979 |
1980 |
1981 |
1982 |
1983 |
1984 |
1985 |
1986 |
1987 |
|
Cost/Day ($) |
194 |
217 |
245 |
284 |
327 |
369 |
411 |
460 |
501 |
539 |
Step 1: Using graph paper and a ruler, create a scattergram of the data listed above.
Step 2: Find the line of best fit using your ruler and calculating the slope and y-intercept using two pts from the line. Do your calculations in the space provided and indicate your equation.
Your Equation:____________________________
Step 3: To find
the calculator’s equation: enter the
data into the lists of your calculator.
Put the years (abbrevated to 78, 79, etc) in L1 and the
Cost in L2.
Turn your stat plots on. Do a linear
regression of the data: For the
TI-83s, press STAT and arrow over
once to CALC and go down to where it
says LinReg (ax + b).
Press Enter to bring the
command to the home screen. Then do 2nd 1 (for L1) “,” above the 7 key, 2nd 2 for (L2 ) “,” VARS, arrow once to Y-VARS, Function, Enter, and 1 for Y1. The command should look like LinReg (ax+b) L1, L2,Y1
on your screen. Then press Enter
and the equation with appear both on you screen and in Y1.
For the TI-82s, do a LinReg (ax +b) by pressing Stat, arrow once to Calc, and go down to
LinReg(ax +b), press Enter. Once you have your equation on your screen. Go to Y= and place your cursor in the Y1 spot. Press VARS, 5 for statistics, arrow to the right twice, and 7 for RegEQ. This will place the equation in Y1.
Modfy your window and graph. Indicate the calculator’s equation in the space provided.
Calc Equation:____________________________
Step 4: Put your equation in Y2.
Step 5: Go to your lists. Highlight the space where L3 is located. We want the cost per day that is predicted by calculator’s equation. To do this, go to VARS, arrow over once, ENTER, and ENTER to get Y1 to appear in the header. Enter ( 2nd 1 for L1 )….it should look like Y1(L1) in your calculator and press ENTER. All the predicted values of the cost should appear in L3. Study the values in L3 and describe in sentences what is happening mathematically.
_________________________________________________________________________
We are going to find both the mean absolute value and the mean squared values as we did in our activity last Friday.
Step 6: To find errors, we first have to find the error between the observed data and the predicted data. To do that, we have to subtract the predicted data from the observed data. So at the top of L4, enter the equation “L2 - L3”. Note:Use the ALPHA “ keys. The quotes make the equation hold when you manipulate a different list. The errors should appear.
In L5, we want the absolute value of the errors so they all become positive. Go to the top of L5, press Enter and type in “abs(L4)”
In L6, we want the squared errors so they all become positive. Go to the top of L6, press Enter and type in “L42”
To keep this all straight, I have placed a table with your six lists below. Write above the lists what data is in each one:
|
|
|
|
|
|
|
|
L1 |
L2 |
L3 |
L4 |
L5 |
L6 |
|
|
|
|
|
|
|
Step 7: Find the mean
absolute error and the root mean squared error for the calculator’s equation.
mean absolute error ______________ root mean squared error _________________
Step 8: Do the same process above with your equation in Y2. This requires that you change the formula in L3 to “Y2(L1)”. The rest of the lists should change if you used the ALPHA “ keys.
Find the mean absolute error and the root mean squared error for your equation.
mean absolute error ______________ root mean squared error _________________
The line of best fit is the line with the smallest value for the sum of the squares of the errors. Which line has the line of best fit and why?