# Connexions

You are here: Home » Content » Linear Regression and Correlation: The Regression Equation

### Recently Viewed

This feature requires Javascript to be enabled.

### Tags

(What is a tag?)

These tags come from the endorsement, affiliation, and other lenses that include this content.

# Linear Regression and Correlation: The Regression Equation

Summary: This module provides an overview of Linear Regression and Correlation: The Regression Equation as a part of Collaborative Statistics collection (col10522) by Barbara Illowsky and Susan Dean.

Note: You are viewing an old version of this document. The latest version is available here.

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.

## Optional Collaborative Classroom Activity

If you know a person's pinky (smallest) finger length, do you think you could predict that person's height? Collect data from your class (pinky finger length, in inches). The independent variable, xx, is pinky finger length and the dependent variable, yy, is height.

For each set of data, plot the points on graph paper. Make your graph big enough and use a ruler. Then "by eye" draw a line that appears to "fit" the data. For your line, pick two convenient points and use them to find the slope of the line. Find the y-intercept of the line by extending your lines so they cross the y-axis. Using the slopes and the y-intercepts, write your equation of "best fit". Do you think everyone will have the same equation? Why or why not?

Using your equation, what is the predicted height for a pinky length of 2.5 inches?

## 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 yy from data.

The term |y0-y^0|=ε0|y0-y^0|=ε0 is called the "error" or residual. It is not an error in the sense of a mistake, but measures the vertical distance between the actual value of yy and the estimated value of yy.

εε = the Greek letter epsilon

For each data point, you can calculate, |yi-y^i|=εi|yi-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.

## Note:

Many calculators or any linear regression and correlation computer program can calculate the best fit line. The calculations tend to be tedious if done by hand. In the technology section, there are instructions for calculating the best fit line.

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

Remember, the best fit line is called the least squares regression line (it is sometimes referred to as the LSL which is an acronym for least squares line). The best fit line for the third exam/final exam example has the equation:

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

The idea behind finding the best fit line is based on the assumption that the data are actually scattered about a straight line. Remember, it is always important to plot a scatter diagram first (which many calculators and computer programs can do) to see if it is worth calculating the line of best fit.

The slope of the line is 4.83 (b = 4.83). We can interpret the slope as follows: As the third exam score increases by one point, the final exam score increases by 4.83 points.

## Note:

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 x-values in the sample data, but not necessarily for x-values outside that domain.

## Content actions

### Give feedback:

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