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.
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:
From here you can enter all the data. Common practice is to have -values in the list and -values in the list. For the example given before, if a question asked to estimate the monthly electricity bill given a certain temperature, the -values would be temperatures and the -values would be prices of the electricity bills. Make sure each 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 and lists. Continuing with this question, the full table should look like:
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.
Once you enter the "LinReg(ax+b)" page, you should see something like the following:
Xlist and Ylist are the lists containing the and lists, respectively . As you can see, is the Xlist and is Ylist. These are the default values and why the common practice is to have -values in the list and -values in the list.
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 ) you want to save the regression result and hit enter.
Finally, you navigate to "Calculate" at the bottom and hit enter. The resulting screen contains the slope, , the y-intercept, , the coefficient of determination, , and the correlation coefficient, . It is important to add these values in your answer if it asks for the line of best fit.
When writing down the results be sure to include all results, inlcuding and , to 3 significant figures, unless stated otherwise.
If you not see or , 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 and .
Is Your Model Accurate?
and both are measures of how well your estimate of the relationship fits the data, but for most purposes, 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.
, formally the correlation coefficient, ranges from . 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 can be used for. Below is a commonly used interpretation:
- : Very weak correlation
- : Weak correlation
- : Moderate correlation
- : Strong correlation
- : Very strong correlation
Given these are qualitative descriptions, small differences like saying a model with 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 . Looking at the results from the example, the model has an . 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 -values are 58 and 85, respectively. For -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.
Now it's as simple as clicking graph:
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, , a person consumes during an -km hike. Suppose that we observed data of hikes from 5-km to 25km, and we get the model . 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 -value for a given 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 . Write in your value and click enter. At the bottom right, you should see , followed by the estimate, and the cursor on the graph. In this case, the estimated electricity bill for a temperature of is .
The process for estimating an -value for a given within the range of our dataset, is a bit more convoluted. You must first set a line equal to given -value, by clicking y=, and then set another equation slot to the -value.
Then click 2nd+trace, and then select "5: intersect" and click enter.
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 -value. In our context, given a electricity bill, the estimated temperature for that month was