In Depth Guide to Linear Regressions

Last updated: 2026-09-16

Background

The goal of linear regressions are to find the line that best represents a group of points. Many problems, which involve linear regressions are meant for you to model the relationship between data, hence why we sometimes call them "linear models", and we use that model to estimate outputs for a given input.

Example

An example is the one below about the relationship between temperature and the monthly electricity bill. The table below provides the raw data, note the "Month" columns are not used in the regression and are only there for reference.

Calculator screen

Entering the Data

To navigate to the data-entry screen, click: stat followed by either 1 or selecting "Edit" and then enter. You should see something like this:

Calculator screen

From here you can enter all the data. Common practice is to have xx-values in the L1L_1 list and yy-values in the L2L_2 list. For the example given before, if a question asked to estimate the monthly electricity bill given a certain temperature, the xx-values would be temperatures and the yy-values would be prices of the electricity bills. Make sure each xyxy pair is on the same row, or else issues could occur. A good way to check if you missed any values is to check whether there are an equal amount of elements in both the L1L_1 and L2L_2 lists. Continuing with this question, the full table should look like:

Calculator screen

Note that this is the bottom of the table, so some of the top-most entries are cut off.

Calculating Line of Best Fit

Now that we have all the data loaded, we can get to the actual calculating. Start by once again clicking stat; however, now you should navigate to the "CALC" section by clicking and then either scroll down to "4: LinReg(ax+b)" and hit enter or directly hit 4.

Calculator screen

Once you enter the "LinReg(ax+b)" page, you should see something like the following:

Calculator screen

Xlist and Ylist are the lists containing the xx and yy lists, respectively yy. As you can see, L1L_1 is the Xlist and L2L_2 is Ylist. These are the default values and why the common practice is to have xx-values in the L1L_1 list and yy-values in the L2L_2 list.

Tip!

If for whatever reason these values have changed or need to use different lists, you can always scroll to either Xlist or Ylist, hit clear, then 2nd followed by the number of the list you want. For example to enter list 3, you should click 2nd+3.

For now, you can ignore "FreqList" as it is rarely used. "Store RegEQ" is where the calculated line is saved within the equations listed when you click y=. Before entering, ensure that your desired equation slot is either empty or does not contain an equation you want to keep. Clicking "Calculate" will DELETE whatever is currently in that slot and replace it with the line of best fit. To save equation, make sure your cursor is on the "Store RegEQ" line, then click vars, enter the "Y-VARS" section by hitting , clicking enter on "1: Function" or directly pressing 1, and finally select the equation slot (usually Y1Y_1) you want to save the regression result and hit enter.

Calculator screen
Calculator screen

Finally, you navigate to "Calculate" at the bottom and hit enter. The resulting screen contains the slope, aa, the y-intercept, bb, the coefficient of determination, r2r^2, and the correlation coefficient, rr. It is important to add these values in your answer if it asks for the line of best fit.

Calculator screen
Tip!

When writing down the results be sure to include all results, inlcuding r2r^2 and rr, to 3 significant figures, unless stated otherwise.

Note!

If you not see r2r^2 or rr, click mode, and navigate down to "STAT DIAGNOSTICS" near the bottom in blue. Ensure "ON" is selecting, by verifying is has a static/non-flashing black box around it. If it is not selected, hover over it and click enter. Repeating the calculation process should now give you r2r^2 and rr.

Is Your Model Accurate?

R2R^2 and rr both are measures of how well your estimate of the relationship fits the data, but for most purposes, rr is used to describe the accuracy, or fit, of models. Formally, "accuracy" is called correlation, how closely the variables follow the relationship; however, the two terms will be used interchangeably for the following explaination.

rr, formally the correlation coefficient, ranges from 1r1-1 \leq r \leq 1. It describes the strength and direction of a linear relationship between two variables quantitatively, in numerical form, which you then interpret to describe it qualitatively, in words. When using the words "positive" and "negative" is this context, you are describing the direction/slope of the relationship, not the actual correlation. That's what the magnitude of rr can be used for. Below is a commonly used interpretation:

  • 0.00r<0.190.00 \leq |r| < 0.19: Very weak correlation
  • 0.20r<0.390.20 \leq |r| < 0.39: Weak correlation
  • 0.40r<0.590.40 \leq |r| < 0.59: Moderate correlation
  • 0.60r<0.790.60 \leq |r| < 0.79: Strong correlation
  • 0.80r1.000.80 \leq |r| \leq 1.00: Very strong correlation

Given these are qualitative descriptions, small differences like saying a model with r=0.78|r| = 0.78 has "very strong correlation," shouldn't cause too many issues.

Many problems requiring you to build a linear model with often have a question asking you to describe the fit of your model, or something similar. When asked to describe the correlation, you should refer to rr. Looking at the results from the example, the model has an r=0.91460r = 0.91460 \dots. With this results we can be pretty certain that we can describe the model of having a "very strong positive linear correlation."

Graphing Your Model

Many problems will also require you to sketch a graph of the relationship. However, before using your GDC to graph the line (which should already be saved in the chosen equation slot), you need to set appropriate bounds for window so you can see the relevant range of the model. To determine the appropriate bounds, you should find the minimum and maximum values for your Xlist and Ylist, and then add some margin. For the example, the minimum and maximum xx-values are 58 and 85, respectively. For yy-values, the minimum and maximum are 110 and 255, respectively. We can now add some margin to these values, because setting the bounds to these exact values can be constraining. This part up to you, and it doesn't have to be perfect, but it's always easier to set the bounds once, than realizing they were too constraining and having to change them later.

Calculator screen

Now it's as simple as clicking graph:

Calculator screen
Tip!

If you want to and don't see the individual points on the graph, click 2nd+y=, select "Plot 1...OFF" and click enter, and select "ON" and click enter.

Interpolating

Interpolating is using your model to estimate values, which are within your data range. If you are asked if it is appropriate to use the model to estimate a value outside the range of the dataset, the answer it is not, because that is extrapolation. Extrapolation is not always appropriate because it is less reliable and we can not be certain the relationship we see in the data continues outside of the observed range.

A practical example of extrapolation is building a model to estimate the amount of water in liters, yy, a person consumes during an xx-km hike. Suppose that we observed data of hikes from 5-km to 25km, and we get the model y=0.25x1y=0.25x-1. When we try to use this model to extrapolate for values below 4km, we actually find that a person consumes negative liters of water. Within the context of our problem, this result is clearly unreasonable.

Assuming we need to estimate a yy-value for a given xx within the range of our dataset, the process is quite easy. Click 2nd+trace, which should open a menu of 7 tools, select "1: value" and click enter. In the following screen, you should see X=X=. Write in your xx value and click enter. At the bottom right, you should see Y=Y=\dots, followed by the estimate, and the cursor on the graph. In this case, the estimated electricity bill for a temperature of 6060^{\circ} is $131\approx \$131.

Calculator screen

The process for estimating an xx-value for a given yy within the range of our dataset, is a bit more convoluted. You must first set a line equal to given yy-value, by clicking y=, and then set another equation slot to the yy-value.

Calculator screen

Then click 2nd+trace, and then select "5: intersect" and click enter.

Calculator screen

In the following screen, you will be able to move a cursor on both of the lines. Just get the cursor near the intersection, like in the image below. Click enter, then you will be prompted to do the same thing for the other line, repeat the same steps. Then you will see "Guess?" at the bottom left of your screen, click enter to proceed. You should now see "Intersect" in the bottom left with the estimated xx-value. In our context, given a $190\$190 electricity bill, the estimated temperature for that month was 74.2\approx 74.2^{\circ}

Calculator screen