Skip to content Skip to navigation

Connexions

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

Navigation

Content Actions

  • Download module PDF
  • Add to ...
    Add the module to:
    • My Favorites
    • A lens
    • An external social bookmarking service
    • My Favorites (What is 'My Favorites'?)
      'My Favorites' is a special kind of lens which you can use to bookmark modules and collections directly in Connexions. 'My Favorites' can only be seen by you, and collections saved in 'My Favorites' can remember the last module you were on. You need a Connexions account to use 'My Favorites'.
    • A lens (What is a lens?)

      Definition of a lens

      Lenses

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

      What is in a lens?

      Lens makers point to Connexions 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 Connexions member, a community, or a respected organization.

    • External bookmarks
  • E-mail the authors

Lenses

What is a lens?

Definition of a lens

Lenses

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

What is in a lens?

Lens makers point to Connexions 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 Connexions member, a community, or a respected organization.

This content is ...

In these lenses

  • Printable Books

    This module is included inLens: Connexions Books Available for Print on Demand
    By: ConnexionsAs a part of collection:"Collaborative Statistics"

    Comments:

    "This book was purchased from the authors by the Maxfield Foundation and provided to the community as an open textbook available freely online and in PDF format. Bound copies of the book can also […]"

    Click the "Printable Books" link to see all content selected in this lens.

Recently Viewed

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

Module by: Dr. Barbara Illowsky, Susan Dean

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.

Data rarely fits 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?

Figure 1
Subfigure 1.1: Table showing the scores on the final exam based on scores from the third exam.Subfigure 1.2: Scatter plot showing the scores on the final exam based on scores from the third exam.
x (third exam score) y (final exam score)
65 175
67 133
71 185
71 163
66 126
75 198
67 153
70 163
71 159
69 151
69 159
Scatterplot of exam scores with the third exam score on the x-axis and the final exam score on the y-axis.

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 diagram shown. 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.

Figure 2
Scatterplot of the exam scores with a line of best fit tying in the relationship between the third exam and final exam scores. A specific point on the line, specific data point, and the distance between these two points are used in order to show an example of how to compute the sum of squared errors in order to find the points on the line of best fit.

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 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 Collaborative Statistics Workbook, 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:

Figure 3
Scatterplot of the third exam scores by final exam scores and its line of best fit.

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.

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.

Comments, questions, feedback, criticisms?

Send feedback