# Connexions

You are here: Home » Content » Linear Regression and Correlation: The Regression Equation (modified R. Bloom)

### Recently Viewed

This feature requires Javascript to be enabled.

# Linear Regression and Correlation: The Regression Equation (modified R. Bloom)

Module by: Roberta Bloom. E-mail the author

Summary: This module provides an overview of Linear Regression and Correlation: The Regression Equation as a part of R. Bloom's custom Collaborative Statistics collection col10617. It has been modified from the original module m17090 in the Collaborative Statistics collection (col10522) by Barbara Illowsky and Susan Dean. This module now includes instructions for finding and graphing the regression equation and scatterplot using the LinRegTTest on the TI-83,83+,84+ calculators.

## Understanding the Regression Equation

Data rarely fit a straight line exactly. Usually, you must be satisfied with rough predictions. Typically, you have a set of data whose scatter plot appears to "fit" a straight line. This is called a Line of Best Fit or Least Squares Line.

### Example 1

A random sample of 11 statistics students produced the following data where xx is the third exam score, out of 80, and yy is the final exam score, out of 200. Can you predict the final exam score of a random student if you know the third exam score?

The third exam score, xx, is the independent variable and the final exam score, yy, is the dependent variable. We will plot a regression line that best "fits" the data. If each of you were to fit a line "by eye", you would draw different lines. We can use what is called a least-squares regression line to obtain the best fit line.

Consider the following diagram. Each point of data is of the the form (x,y)(x,y)and each point of the line of best fit using least-squares linear regression has the form ( x , y ^ ) (x, y ^ ).

The y^y^ is read "y hat" and is the estimated value of yy. It is the value of yy obtained using the regression line. It is not generally equal to the observed yy from data.

The term y y^ yy^ is called the residual. It is the observed yy value − the predicted y^y^ value. It can also be called the "error". It is not an error in the sense of a mistake, but measures the vertical distance between the observed value yy and the estimated value y^y^. In other words, it measures the vertical distance between the actual data point and the predicted point on the line.

If the observed data point lies above the line, the residual is positive, and the line underestimates the actual data value for y y. In the observed data point lies below the line, the residual is negative, and the line overestimates that actual data value for y y.

In the Figure 2 diagram above, y0-y^0=ε0y0-y^0=ε0 is the residual for the point shown. Here the point lies above the line and the residual is positive.

εε = the Greek letter epsilon

For each data point, you can calculate the residuals or errors, yi-y^i=εiyi-y^i=εi for i=1, 2, 3, ..., 11i=1, 2, 3, ..., 11.

Each εε is a vertical distance.

For the example about the third exam scores and the final exam scores for the 11 statistics students, there are 11 data points. Therefore, there are 11 εε values. If you square each εε and add, you get

( ε 1 ) 2 + ( ε 2 ) 2 + ... + ( ε 11 ) 2 = Σ i = 1 11 ε 2 ( ε 1 ) 2 +( ε 2 ) 2 +...+( ε 11 ) 2 = Σ i = 1 11 ε 2

This is called the Sum of Squared Errors (SSE).

Using calculus, you can determine the values of aa and bb that make the SSE a minimum. When you make the SSE a minimum, you have determined the points that are on the line of best fit. It turns out that the line of best fit has the equation:

y ^ = a + bx y ^ =a+bx
(1)

where a=y¯-bx¯a=y¯-bx¯ and b=Σ(x-x¯)(y-y¯) Σ(x-x¯)2b=Σ(x-x¯)(y-y¯) Σ(x-x¯)2.

x¯x¯ and y¯y¯ are the averages of the xx values and the yy values, respectively. The best fit line always passes through the point (x¯,y¯)(x¯,y¯).

The slope bb can be written as b=r( sy sx)b=r( sy sx) where sysy = the standard deviation of the yy values and sxsx = the standard deviation of the xx values. rr is the correlation coefficient which is discussed in the next section.

### Least Squares Criteria for Best Fit

The process of fitting the best fit line is called linear regression . The idea behind finding the best fit line is based on the assumption that the data are scattered about a straight line. The criteria for the best fit line is that the sum of the squared errors (SSE) is minimized, that is made as small as possible. Any other line you might choose would have a higher SSE than the best fit line. This best fit line is called the least squares regression line .

### Note:

Computer spreadsheets, statistical software, and many calculators can quickly calculate the best fit line and create the graphs. The calculations tend to be tedious if done by hand. Instructions to use the TI-83, TI-83+, and TI-84+ calculators to find the best fit line and create a scatterplot are shown at the end of this section.

### THIRD EXAM vs FINAL EXAM EXAMPLE:

The graph of the line of best fit for the third exam/final exam example is shown below:

The least squares regression line (best fit line) for the third exam/final exam example has the equation:

y ^ = -173.51 + 4.83x y ^ =-173.51+4.83x
(2)

### Note:

• Remember, it is always important to plot a scatter diagram first. If the scatter plot indicates that there is a linear relationship between the variables, then it is reasonable to use a best fit line to make predictions for yy given xx within the domain of xx-values in the sample data, but not necessarily for xx-values outside that domain.
• You could use the line to predict the final exam score for a student who earned a grade of 73 on the third exam.
• You should NOT use the line to predict the final exam score for a student who earned a grade of 50 on the third exam, because 50 is not within the domain of the x-values in the sample data, which are between 65 and 75.

### UNDERSTANDING SLOPE

The slope of the line, b, describes how changes in the variables are related. It is important to interpret the slope of the line in the context of the situation represented by the data. You should be able to write a sentence interpreting the slope in plain English.

INTERPRETATION OF THE SLOPE: The slope of the best fit line tells us how the dependent variable (y) changes for every one unit increase in the independent (x) variable, on average.

### THIRD EXAM vs FINAL EXAM EXAMPLE

• Slope: The slope of the line is b = 4.83.
• Interpretation: For a one point increase in the score on the third exam, the final exam score increases by 4.83 points, on average.

## Using the TI-83+ and TI-84+ Calculators

### Using the Linear Regression T Test: LinRegTTest

1. Step 1. In the STAT list editor, enter the X data in list L1 and the Y data in list L2, paired so that the corresponding (x,y) values are next to each other in the lists. (If a particular pair of values is repeated, enter it as many times as it appears in the data.)
2. Step 2. On the STAT TESTS menu, scroll down with the cursor to select the LinRegTTest. (Be careful to select LinRegTTest as some calculators may also have a different item called LinRegTInt.)
3. Step 3. On the LinRegTTest input screen enter: Xlist: L1 ; Ylist: L2 ; Freq: 1
4. Step 4. On the next line, at the prompt β or ρ, highlight "≠ 0" and press ENTER
5. Step 5. Leave the line for "RegEq:" blank
6. Step 6. Highlight Calculate and press ENTER.

The output screen contains a lot of information. For now we will focus on a few items from the output, and will return later to the other items.

• The second line says y=a+bx. Scroll down to find the values a=-173.513, and b=4.8273 ; the equation of the best fit line is y ^ = -173.51 + 4.83x y ^ =-173.51+4.83x
• The two items at the bottom are r2 r 2 = .43969 and rr=.663. For now, just note where to find these values; we will discuss them in the next two sections.

### Graphing the Scatterplot and Regression Line

1. Step 1. We are assuming your X data is already entered in list L1 and your Y data is in list L2
2. Step 2. Press 2nd STATPLOT ENTER to use Plot 1
3. Step 3. On the input screen for PLOT 1, highlight On and press ENTER
4. Step 4. For TYPE: highlight the very first icon which is the scatterplot and press ENTER
5. Step 5. Indicate Xlist: L1 and Ylist: L2
6. Step 6. For Mark: it does not matter which symbol you highlight.
7. Step 7. Press the ZOOM key and then the number 9 (for menu item "ZoomStat") ; the calculator will fit the window to the data
8. Step 8. To graph the best fit line, press the "Y=" key and type the equation -173.5+4.83X into equation Y1. (The X key is immediately left of the STAT key). Press ZOOM 9 again to graph it.
9. Step 9. Optional: If you want to change the viewing window, press the WINDOW key. Enter your desired window using Xmin, Xmax, Ymin, Ymax

## Content actions

PDF | EPUB (?)

### What is an EPUB file?

EPUB is an electronic book format that can be read on a variety of mobile devices.

My Favorites (?)

'My Favorites' is a special kind of lens which you can use to bookmark modules and collections. 'My Favorites' can only be seen by you, and collections saved in 'My Favorites' can remember the last module you were on. You need an account to use 'My Favorites'.

| A lens I own (?)

#### Definition of a lens

##### Lenses

A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

##### What is in a lens?

Lens makers point to materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

##### Who can create a lens?

Any individual member, a community, or a respected organization.

##### What are tags?

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

| External bookmarks