Skip to content Skip to navigation Skip to collection information

OpenStax-CNX

You are here: Home » Content » Collaborative Statistics » The Regression Equation

Navigation

Table of Contents

Lenses

What is a lens?

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? tag icon

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

This content is ...

In these lenses

  • Lucy Van Pelt display tagshide tags

    This collection is included inLens: Lucy's Lens
    By: Tahiya Marome

    Comments:

    "Part of the Books featured on Community College Open Textbook Project"

    Click the "Lucy Van Pelt" link to see all content selected in this lens.

    Click the tag icon tag icon to display tags associated with this content.

  • Bio 502 at CSUDH display tagshide tags

    This collection is included inLens: Bio 502
    By: Terrence McGlynn

    Comments:

    "This is the course textbook for Biology 502 at CSU Dominguez Hills"

    Click the "Bio 502 at CSUDH" link to see all content selected in this lens.

    Click the tag icon tag icon to display tags associated with this content.

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.
 

The Regression Equation

Module by: Susan Dean, Barbara Illowsky, Ph.D.. E-mail the authors

Summary: Linear Regression and Correlation: The Regression Equation is a part of Collaborative Statistics collection (col10522) by Barbara Illowsky and Susan Dean. Contributions from Roberta Bloom include instructions for finding and graphing the regression equation and scatterplot using the LinRegTTest on the TI-83,83+,84+ calculators.

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?

Figure 1
(a) Table showing the scores on the final exam based on scores from the third exam.(b) 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 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.

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=ε0y0-y^0=ε0 is called the "error" or residual. It is not an error in the sense of a mistake. The absolute value of a residual measures the vertical distance between the actual value of yy and the estimated value of yy. 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. If 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 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 ¯ ) 2 b= Σ ( x - x ¯ ) ( y - y ¯ ) Σ ( x - x ¯ ) 2 .

x¯x¯ and y¯y¯ are the sample means 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:

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

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.

Figure 4
1. Image of calculator input screen for LinRegTTest with input matching the instructions above. 2.Image of corresponding output calculator output screen for LinRegTTest: Output screen shows: Line 1. LinRegTTest; Line 2. y = a + bx; Line 3. beta does not equal 0 and rho does not equal 0; Line 4. t = 2.657560155; Line 5. df = 9; Line 6. a = 173.513363; Line 7. b = 4.827394209; Line 8. s = 16.41237711; Line 9. r squared = .4396931104; Line 10. r = .663093591

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

**With contributions from Roberta Bloom

Collection Navigation

Content actions

Download module as:

Add:

Collection to:

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? tag icon

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

Module to:

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? tag icon

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