Skip to content Skip to navigation

OpenStax_CNX

You are here: Home » Content » Linear Regression and Correlation: Outliers

Navigation

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: Outliers

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

Summary: This module provides an overview of Linear Regression and Correlation: Outliers 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.

In some data sets, there are values (points) called outliers. Outliers are points that are far from the least squares line. They have large "errors." Outliers need to be examined closely. Sometimes, for some reason or another, they should not be included in the analysis of the data. It is possible that an outlier is a result of erroneous data. Other times, an outlier may hold valuable information about the population under study. The key is to carefully examine what causes a data point to be an outlier.

Example 1

Problem 1

In the third exam/final exam example, you can determine if there is an outlier or not. If there is one, as an exercise, delete it and fit the remaining data to a new line. For this example, the new line ought to fit the remaining data better. This means the SSE should be smaller and the correlation coefficient ought to be closer to 1 or -1.

Solution

Computers and many calculators can determine outliers from the data. However, as an exercise, we will go through the steps that are needed to calculate an outlier. In the table below, the first two columns are the third exam and the final exam data. The third column shows the y-hat values calculated from the line of best fit.

Table 1
xx yy y^y^
65    175   140  
67 133 150
71 185 169
71 163 169
66 126 145
75 198 189
67 153 150
70 163 164
71 159 169
69 151 160
69 159 160

A Residual is the Actual y valuepredicted y value=yy^Actual y valuepredicted y value=yy^

Calculate the absolute value of each residual.

Calculate each |y-y^||y-y^|:

Table 2
xx yy y^y^ |y-y^||y-y^|
65 175 140 |175-140|=35|175-140|=35
67 133 150 |133-150|=17|133-150|=17
71 185 169 |185-169|=16|185-169|=16
71 163 169 |163-169|=6|163-169|=6
66 126 145 |126-145|=19|126-145|=19
75 198 189 |198-189|=9|198-189|=9
67 153 150 |153-150|=3|153-150|=3
70 163 164 |163-164|=1|163-164|=1
71 159 169 |159-169|=10|159-169|=10
69 151 160 |151-160|=9|151-160|=9
69 159 160 |159-160|=1|159-160|=1

Square each |y-y^||y-y^|:

352352; 172172; 162162; 6262; 192192; 9292; 3232; 1212; 102102; 9292; 1212

Then, add (sum) all the |y-y^||y-y^| squared terms:

Σ i = 1 11 (|y-y^|)2 = Σ i = 1 11 ε2 Σ i = 1 11 (|y-y^|)2= Σ i = 1 11 ε2 (Recall that |yi-y^i|=εi|yi-y^i|=εi.)

=352 +172 +162 +62 +192 +92 +32 +12 +102 +92 +12=352+172+162+62+192+92+32+12+102+92+12

=2440==2440= SSE

Next, calculate ss, the standard deviation of all the |y-y^|=ε|y-y^|=ε values where nn = the total number of data points. (Calculate the standard deviation of 35; 17; 16; 6; 19; 9; 3; 1; 10; 9; 1.)

s= SSE n-2 s= SSE n-2

For the third exam/final exam problem, s= 2440 11-2 =16.47 s= 2440 11-2 =16.47

Next, multiply ss by 1.91.9 and get (1.9)(16.47)=31.29(1.9)(16.47)=31.29 (the value 31.29 is almost 2 standard deviations away from the mean of the |y-y^||y-y^| values.)

Note:
The number 1.9s1.9s is equal to 1.9 standard deviations. It is a measure that is almost 2 standard deviations. If we were to measure the vertical distance from any data point to the corresponding point on the line of best fit and that distance was equal to 1.9s1.9s or greater, then we would consider the data point to be "too far" from the line of best fit. We would call that point a potential outlier.

For the example, if any of the |y-y^||y-y^| values are at least 31.29, the corresponding (x,y)(x,y) point (data point) is a potential outlier.

Mathematically, we say that if |y-y^|(1.9)(s)|y-y^|(1.9)(s), then the corresponding point is an outlier.

For the third exam/final exam problem, all the |y-y^||y-y^|'s are less than 31.29 except for the first one which is 35.

35>31.2935>31.29 That is, |y-y^|(1.9)(s)|y-y^|(1.9)(s)

The point which corresponds to |y-y^|=35 |y-y^|=35 is (65,175)(65,175). Therefore, the point (65,175)(65,175) is an outlier. For this example, we will delete it. (Remember, we do not always delete an outlier.) The next step is to compute a new best-fit line using the 10 remaining points. The new line of best fit and the correlation coefficient are:

y^ =-355.19+7.39x y^=-355.19+7.39x and r=0.9121 r=0.9121

If you compare r=0.9121r=0.9121 to its critical value 0.632, 0.9121>0.6320.9121>0.632. Therefore, rr is significant. In fact, r=0.9121r=0.9121 is a better rr than the original (0.6631) because r=0.9121r=0.9121 is closer to 1. This means that the 10 points fit the line better. The line can better predict the final exam score given the third exam score.

Example 2

Problem 1

Using the new line of best fit (calculated with 10 points), what would a student who receives a 73 on the third exam expect to receive on the final exam?

Solution

184.28

Example 3

(From The Consumer Price Indexes Web site) The Consumer Price Index (CPI) measures the average change over time in the prices paid by urban consumers for consumer goods and services. The CPI affects nearly all Americans because of the many ways it is used. One of its biggest uses is as a measure of inflation. By providing information about price changes in the Nation's economy to government, business, and labor, the CPI helps them to make economic decisions. The President, Congress, and the Federal Reserve Board use the CPI's trends to formulate monetary and fiscal policies. In the following table, xx is the year and yy is the CPI.

Table 3: Data:
xx yy
1915   10.1  
1926 17.7
1935 13.7
1940 14.7
1947 24.1
1952 26.5
1964 31.0
1969 36.7
1975 49.3
1979 72.6
1980 82.4
1986 109.6
1991 130.7
1999 166.6

Problem 1

  • Make a scatterplot of the data.
  • Calculate the least squares line. Write the equation in the form y^=a+bxy^=a+bx.
  • Draw the line on the scatterplot.
  • Find the correlation coefficient. Is it significant?
  • What is the average CPI for the year 1990?

Solution

  • Scatter plot and line of best fit.
  • y^=-3204+1.662xy^=-3204+1.662x is the equation of the line of best fit.
  • r=0.8694r=0.8694
  • The number of data points is n=14n=14. Use the 95% Critical Values of the Sample Correlation Coefficient table at the end of Chapter 12. n-2=12n-2=12. The corresponding critical value is 0.532. Since 0.8694>0.5320.8694>0.532, rr is significant.
  • y^=-3204+1.662(1990)=103.4y^=-3204+1.662(1990)=103.4 CPI
Figure 1
Scatter plot and line of best fit of the consumer price index data, on the y-axis, and year data, on the x-axis.

Glossary

Outlier:
An observation that does not fit the rest of the data.

Content actions

Download module as:

Add 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