How to Get a Function from Data

The procedure described here is for use with TI-83/84 calculators. [If you are using another calculator, read your
instructions on how to perform "regression".]

This data represents accumulated profit (y in $100) per hour (x) at a concession stand.

Here's how the calculator can find the slope and the y -intercept of a line to predict y
from x.

First input the data into your TI-83/4. To do this, press STAT ENTER and clear out
columns L1 and L2. Put your x- values in L1 and your y-values in L2. To plot the three
pairs of points, press 2ND STATPLOT ENTER and turn on Plot 1. Choose the scatter plot
- the first graph type. Make sure xLIST is L1 and yLIST is L2. Next press WINDOW and
change Xmin to 0, Xmax to 10, Ymin to 0 and Ymax to 5. Press graph and your graph
should appear.

Now to get the linear regression equation expressing y in terms of x, press STAT, choose
the CALC menu and select 4: LinReg(ax+b). Here, a represents the slope of the line and
b represents the intercept. (Menu number 8 is also a linear model , but it calls a the
intercept and b the slope .)

Once the command is on the home screen, press 2ND 1 (L1) [ , ] 2ND 2 (L2) to ensure that
your calculator is looking at the correct lists. Your screen should look like this :

LinReg (ax+b) L1,L2

Then press ENTER. Record the slope, intercept, line equation and value of r here:

a =_______ b =_______ ; y = ___________ x + __________; r =___________

(If you do not see the correlation coefficient ( r ) , press 2ND 0 (CATALOG), scroll down and select
DiagnosticOn. Repeat the calculation.)

Now suppose you want to predict the profit after 4.5 hours. Substitute 4.5 into the
equation for x and compute the corresponding value for y. Calculating by hand is easy,
but your calculator can also be used. One way is as follows:
Press Y= and clear any functions you may find in the list. Make sure your cursor is on
Y1. Press VARS 5 to get to the EQuation menu. Select ReqEQ. The most recently
computed regression equation (which is your line equation) should appear in the function
list as Y1. It can now be graphed, a table of values can be computed, etc. Our purpose,
though, is to evaluate the function at a specific value of x using the Y-VARS feature.

Starting from the home screen, select VARS then Y-VARS and press ENTER twice to
copy Y1 to the screen. Press ( 4.5 ) so that the screen contains Y1(4.5).
Then press ENTER. Write your answer here:

When x = 4.5 hours, y = _____ hundred dollars

To graph the linear regression function you stored in the function list, simply press
GRAPH. The line should graph through the points graphed earlier.

The points in this example fit exactly on the line. So if you put, say, 3 in for x, you'll get
exactly 0.5. If the points don't fit a line exactly, the same calculator entry procedure is
used, but the line you get cannot fit all the points exactly. It will, however, be the "best"
fit in the " Least Squares sense". (If you care to know what that means, ask. It takes a few
minutes of explanation; it is not necessary for our purpose today, but is interesting.)

Now let's apply our knowledge and extend it a bit.

Is the Globe Warming?

The Goddard Institute for Space Studies.
has recorded mean temperatures for the decades 1880 - the present. Here's their data,
coded so that 1800 is "year 0". That means "8" is the 1880s, "12" is the 1920s, etc.

  Code for Decade Degrees Celsius
Decade X Y
1880-1889 8 13.82 (This is 56.876° F.)
1890-1899 9 13.69 (°F = 1.8 °C + 32)
1900-1909 10 13.74
1910-1919 11 13.79
1920-1929 12 13.91
1930-1939 13 14.02
1940-1949 14 14.05
1950-1959 15 13.98
1960-1969 16 13.94
1970-1979 17 14.02
1980-1989 18 14.26
1990-1999 19 14.40
2000-2005 20 14.62 (This is 58.316° F.)

Using your calculator, (a) find the Least Squares Line that predicts the average
temperature (Y) when given the coded value for a decade (X). Put your answer here:

Y = _____________ X + ______________. Also record r^2: ________

(b) Use your function to approximate the average temperature in the decade of the
2060s. (If you are a freshman, this will probably be the first decade you are retired.)

Y(_____________) = ______________.

Now graph your points and your function. Note that the points "bend" but the line, of
course, is straight. Recall from algebra that the graph of a quadratic function can bend.
Your calculator can easily produce a quadratic function (Y = aX^2 + bX + c). All you
have to do is choose 5:QuadReg from the STAT|CALC menu (instead of 4:LinReg(ax+b)).

(c) Re-run the regression choosing the quadratic model. Record your results here:
Y = _______ X^2 +________ X + ________. Again record r^2: ________
Graph your new model. Note the fit. Is it better than the line? ______

(d) And once again, predict the mean temperature in the decade of the 2060s:
Y(_____________) = ______________.

(e) What major world event occurred in the late '30s and early '40s?
_____________________________________

Additional information : The value r^2 (which is just the square of the correlation
coefficient "r", and is called the "coefficient of determination") tells us, in layman's
terms , the proportion of variation in Y that is described by the variation in X. More
simply, if r^2 is closer to 1, the curve "fits" the points better. We'll discuss this more in
class. For now, note the two values of r^2.

Very important assignment:

In a paragraph or two, tell which model above (the quadratic model or the linear model)
you believe to be the more credible. Explain your choice. If you don't believe either tells
the story of the globe's warming, explain your belief. In either case, base your
explanation on DATA, not just your gut feelings. An extra credit homework grade will
be given if the writing assignment is word-processed.

Prev Next