From Hand Calculations to the TI-84
In “Computing a Least-Squares Line From Raw Data,” we found a fitted line by calculating sums from paired observations. A TI-84 can calculate the same least-squares line using its regression command. The calculator saves arithmetic time, but it still depends on you to enter the data correctly, choose which variable predicts the other, and read the output accurately.
In this tutorial, \(x\) is the predictor and \(y\) is the response, as in the earlier tutorials on reading and calculating a regression equation. The calculator’s command LinReg(a+bx) reports the intercept \(a\) and slope \(b\) for the equation \(\hat{y}=a+bx\). We will enter \(x\)-values in one list and their paired \(y\)-values in another, then store the equation in \(Y1\).
Enter Paired Data in Lists
Press STAT, choose 1:Edit, and press ENTER to open the list editor. The built-in lists are named \(L1\), \(L2\), and so on. Enter the predictor values in \(L1\) and the response values in \(L2\), pressing ENTER after each value. The first value in \(L1\) must pair with the first value in \(L2\); the second values must pair, and so forth.
If the lists already contain data, clear the old entries before entering a new data set. On many TI-84 models, move the cursor to the list name at the top of the column, press CLEAR, and then press ENTER. This clears the entries in that list. Avoid using DEL on the list name unless you intend to delete the list itself. Menu details can differ slightly between TI-84 models, but the goal is the same: leave only the values for the current paired data set in the two lists.
You can use other lists, such as \(L3\) and \(L4\), if that better suits your work. Whatever lists you use, keep track of which one contains the predictor and which one contains the response. The regression command does not know what your variables mean; it uses the lists you specify.
Run LinReg(a+bx) and Store the Equation
Press STAT, move to the CALC menu, and select LinReg(a+bx). The command has the general form LinReg(a+bx) Xlist,Ylist,RegEQ, where Xlist is the predictor list, Ylist is the response list, and the optional RegEQ argument tells the calculator where to store the equation. To store the equation in \(Y1\), enter \(L1,L2,Y1\) after the command.
To enter a list name in the command, press 2nd and the key labeled 1 for \(L1\), or 2nd and 2 for \(L2\). To select \(Y1\), open the VARS menu, choose the \(Y\)-VARS menu, choose Function, and select \(Y1\). A typical command therefore looks like this:
Press ENTER to run it. The calculator displays the regression results, including \(a\) and \(b\), and stores the equation in \(Y1\). The exact extra statistics shown can depend on calculator settings. In this command, \(a\) is the intercept and \(b\) is the slope, so write the equation as \(\hat{y}=a+bx\). Do not reverse the coefficients or treat the first reported number as the slope.
To check that the equation was stored, press Y=. The regression equation should appear in the \(Y1\) line. If it is not there, rerun the command and check that you included \(Y1\) as the storage destination. Storing the equation lets you use it later without retyping its coefficients.
Press STAT, choose Edit, and clear any old entries you do not want to use.
Put predictor values in one list and the matching response values in another, preserving the original row order.
From STAT, open CALC and select LinReg(a+bx).
Enter the predictor list first, the response list second, and \(Y1\) as the place to store the equation.
Identify \(a\) as the intercept and \(b\) as the slope, write \(\hat{y}=a+bx\), and check the \(Y=\) screen for the stored equation.
Worked Example: Enter Practice Data and Store the Line
A fictional greenhouse log records the number of weeks after planting, \(x\), and a young plant’s height in centimeters, \(y\). Find the least-squares line and store it in \(Y1\). The invented data are:
| Observation | \(x\), weeks | \(y\), centimeters |
|---|---|---|
| 1 | 0 | 4 |
| 2 | 2 | 7 |
| 3 | 4 | 9 |
| 4 | 6 | 12 |
| 5 | 8 | 14 |
Worked Example: Run LinReg(a+bx) With \(L1\) and \(L2\)
Enter \(0,2,4,6,8\) down \(L1\), and enter \(4,7,9,12,14\) down \(L2\), keeping each height beside its corresponding week. Select LinReg(a+bx) from STAT, then enter \(L1,L2,Y1\). The calculator’s coefficients should be \(a=4.2\) and \(b=1.25\), allowing for the way the screen displays decimals.
The calculator’s result gives the equation:
Here, the fitted line’s intercept is \(4.2\) centimeters and its slope is \(1.25\) centimeters per week. To check the coefficients independently, the means are \(\bar{x}=4\) and \(\bar{y}=9.2\). The centered \(x\)-values are \(-4,-2,0,2,4\); their squared values sum to \(40\). The products of centered \(x\)- and \(y\)-values sum to \(50\), so \(b=50/40=1.25\). Then \(a=9.2-(1.25)(4)=4.2\), matching the calculator.
Because the command included \(Y1\), the equation should now appear on the \(Y=\) screen. That confirms it was saved for later use.
Worked Example: Choose the Lists in the Right Order
A fictional community survey records walking distance to a bus stop, \(x\), in kilometers, and walking time, \(y\), in minutes. Suppose the distances are entered in \(L3\) and the corresponding times in \(L4\). The list names are different from the first example, but the predictor still goes first in the regression command.
Worked Example: Use \(L3\) as the Predictor List
The paired values are \((2,8),(5,14),(7,16),(10,23),(12,25)\). Enter \(2,5,7,10,12\) into \(L3\), and enter \(8,14,16,23,25\) into \(L4\). Then run LinReg(a+bx) with \(L3,L4,Y1\), in that order. The calculator gives approximately \(a=4.7261\) and \(b=1.7325\).
As an arithmetic check, \(\bar{x}=7.2\) and \(\bar{y}=17.2\). The centered \(x\)-values have squared deviations summing to \(62.8\), and the paired centered products sum to \(108.8\). Thus the slope is \(108.8/62.8\approx1.7325\). Using the unrounded slope, \(a=17.2-(1.732484\ldots)(7.2)\approx4.7261\). These match the calculator’s output after rounding.
If you instead enter \(L4,L3,Y1\), the calculator treats walking time as the predictor and distance as the response. That is a different regression line, not simply the same equation written another way. The list order must reflect the question you are answering: here, predicting time from distance.
After running the command, press Y= to verify that the equation is stored. If \(Y1\) already held an older equation, the new command replaces it with the current fitted line.
Worked Example: Replace Old Data and Confirm the Stored Equation
Suppose a fictional solar-panel log records hours of sunlight, \(x\), and energy produced, \(y\), in kilowatt-hours. Before entering the new data, the lists contain values from an earlier exercise. Clear the list entries so the calculator does not use an unintended mixture of observations.
Worked Example: Clear the Lists Before a New Calculation
The new paired data are \((1,5),(3,9),(4,11),(6,16),(8,18)\). In the list editor, clear \(L1\) and \(L2\), then enter the five sunlight values in \(L1\) and the five matching energy values in \(L2\). Run LinReg(a+bx) with \(L1,L2,Y1\). The calculator returns approximately \(a=3.3014\) and \(b=1.9315\).
Check the result using the centered-data calculations. The means are \(\bar{x}=4.4\) and \(\bar{y}=11.8\). The sum of squared deviations of \(x\) is \(29.2\), and the sum of paired products of centered values is \(56.4\). Therefore \(b=56.4/29.2\approx1.9315\), and \(a=11.8-(1.9315068\ldots)(4.4)\approx3.3014\). The result agrees with the calculator.
Now press Y=. The equation should appear beside \(Y1\). If you see an old equation or a blank line, check that you ran the command with \(Y1\) as its storage destination. When you are ready to graph the fitted line, \(Y1\) is the function the calculator will use. The equation summarizes the fitted relationship; it does not mean every observed energy value lies exactly on the line.
Common Mistakes and AP Exam Tips
Using a calculator does not remove the need to identify the variables and preserve the data structure. A correct command with incorrect lists produces a precise answer to the wrong problem. Use these checks before accepting the output.
- Reversing the list order. LinReg(a+bx) takes the predictor list first and the response list second. State which variable is \(x\) and which is \(y\) before running the command.
- Misaligning paired observations. The first \(x\)-value must match the first \(y\)-value, and so on. Do not sort one list separately or delete an entry from just one list.
- Leaving old values in a list. Extra entries can change the calculation or cause list-length problems. Clear the lists or verify that they contain only the intended data.
- Reading the coefficients backward. For LinReg(a+bx), \(a\) is the intercept and \(b\) is the slope. The line is \(\hat{y}=a+bx\), not \(a+bx\) with \(b\) used as the constant.
- Forgetting to store the equation. Seeing coefficients on the result screen does not guarantee that the equation was saved in \(Y1\). Include \(Y1\) in the command and check the \(Y=\) screen.
- Rounding too early. Keep the calculator’s displayed precision when checking or using the coefficients, and round only when writing the final equation as requested.
On an AP Statistics response, a calculator command is not a substitute for communicating what the output means. Identify the predictor and response, give the fitted equation with \(\hat{y}\) on the left, and label the intercept and slope correctly if asked. In context, the slope describes the change in the line’s predicted response for a one-unit increase in the predictor, with response units per predictor unit. As emphasized in earlier tutorials, it describes the fitted association, not proof that changing the predictor causes the response to change.
Check Your Understanding
Use the TI-84 workflow and the variable roles described in each question.
- If \(L1\) contains predictor values and \(L2\) contains matching response values, what list order should you use in LinReg(a+bx)?
- In the command LinReg(a+bx) \(L3,L4,Y1\), which list is treated as the predictor, and where is the equation stored?
- For the equation \(\hat{y}=6.5+0.8x\) displayed by the calculator, identify the intercept and slope.
- What should you check if the calculator’s output includes an observation from an earlier data set?
- After running LinReg(a+bx), what screen can you use to confirm that the equation was saved in \(Y1\)?