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.

A random sample of 11 statistics students produced the following data, where *x* is the third exam score out of 80, and *y* 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?

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 |

The third exam score, *x*, is the independent variable and the final exam score, *y*, 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*) and each point ofthe line of best fit using least-squares linear regression has the form (*x*, *ŷ*).

The *ŷ* is read **" y hat"** and is the

**estimated value of**. It is the value of

*y**y*obtained using the regression line. It is not generally equal to

*y*from data.

The term *y*_{0} – *ŷ*_{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 *y* and the estimated value of *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*. If the observed data point lies below the line, the residual is negative, and the line overestimates that actual data value for *y*.

In the diagram in [link], *y*_{0} – *ŷ*_{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, *y*_{i} - *ŷ*_{i} = *ε*_{i} for *i* = 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 yousquare each ε and add, you get

$${({\epsilon}_{1})}^{2}+{({\epsilon}_{2})}^{2}+\mathrm{...}+{({\epsilon}_{11})}^{2}=\stackrel{11}{\underset{i\text{}=\text{}1}{\Sigma}}{\epsilon}^{2}$$

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

Using calculus, you can determine the values of *a* and *b* 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:

where $a=\overline{y}-b\overline{x}$ and $b=\frac{\Sigma (x-\overline{x})(y-\overline{y})}{\Sigma {(x-\overline{x})}^{2}}$.

The sample means of the *x* values and the *y* values are $\overline{x}$ and $\overline{y}$, respectively. The best fit line always passes through the point $(\overline{x},\overline{y})$.

The slope *b* can be written as $b=r\left(\frac{{s}_{y}}{{s}_{x}}\right)$ where *s*_{y} = the standard deviation of the *y* values and *s*_{x} = the standard deviation of the *x* values. *r* 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 **.

THIRD EXAM vs FINAL EXAM EXAMPLE: The graph of the line of best fit for the third-exam/final-exam example is as follows:

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

# 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 EXAMPLESlope: 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.

# The Correlation Coefficient *r*

Besides looking at the scatter plot and seeing that a line seems reasonable, how can you tell if the line is a good predictor? Use the correlation coefficient as another indicator (besides the scatterplot) of the strength of the relationship between *x* and *y*.

The **correlation coefficient, r, ** developed by Karl Pearson in the early 1900s, is numerical and provides a measure of strength and direction of the linear association between the independent variable

*x*and the dependent variable

*y*.

The correlation coefficient is calculated as

where *n* = the number of data points.

If you suspect a linear relationship between *x* and *y*, then *r* can measure how strong the linear relationship is.

What the VALUE of *r* tells us:

- The value of
*r*is always between –1 and +1: –1 ≤*r*≤ 1. - The size of the correlation
*r*indicates the strength of the linear relationship between*x*and*y*. Values of*r*close to –1 or to +1 indicate a stronger linear relationship between*x*and*y*. - If
*r*= 0 there is absolutely no linear relationship between*x*and*y***(no linear correlation)**. - If
*r*= 1, there is perfect positive correlation. If*r*= –1, there is perfect negativecorrelation. In both these cases, all of the original data points lie on a straight line. Of course,in the real world, this will not generally happen.

What the SIGN of *r* tells us

- A positive value of
*r*means that when*x*increases,*y*tends to increase and when*x*decreases,*y*tends to decrease**(positive correlation)**. - A negative value of
*r*means that when*x*increases,*y*tends to decrease and when*x*decreases,*y*tends to increase**(negative correlation)**. - The sign of
*r*is the same as the sign of the slope,*b*, of the best-fit line.

The formula for *r* looks formidable. However, computer spreadsheets, statistical software, and many calculators can quickly calculate *r*. The correlation coefficient *r* is the bottom item in the output screens for the LinRegTTest on the TI-83, TI-83+, or TI-84+ calculator (see previous section for instructions).

# The Coefficient of Determination

**The variable r^{2} is called the** coefficient of determination and is the square of the correlation coefficient, but is usually stated as a percent, rather than in decimal form. It has an interpretation in the context of the data:

- ${r}^{2}$, when expressed as a percent, represents the percent of variation in the dependent (predicted) variable
*y*that can be explained by variation in the independent (explanatory) variable*x*using the regression (best-fit) line. - 1 – ${r}^{2}$, when expressed as a percentage, represents the percent of variation in
*y*that is NOT explained by variation in*x*using the regression line. This can be seen as the scattering of the observed data points about the regression line.

Consider the third exam/final exam example introduced in the previous section

- The line of best fit is:
*ŷ*= –173.51 + 4.83x - The correlation coefficient is
*r*= 0.6631 - The coefficient of determination is
*r*^{2}= 0.6631^{2}= 0.4397 **Interpretation of***r*^{2}in the context of this example:- Approximately 44% of the variation (0.4397 is approximately 0.44) in the final-exam grades can be explained by the variation in the grades on the third exam, using the best-fit regression line.
- Therefore, approximately 56% of the variation (1 – 0.44 = 0.56) in the final exam grades can NOT be explained by the variation in the grades on the third exam, using the best-fit regression line. (This is seen as the scattering of the points about the line.)

# Chapter Review

A regression line, or a line of best fit, can be drawn on a scatter plot and used to predict outcomes for the *x* and *y* variables in a given data set or sample data. There are several ways to find a regression line, but usually the least-squares regression line is used because it creates a uniform line. Residuals, also called “errors,” measure the distance from the actual value of *y* and the estimated value of *y*. The Sum of Squared Errors, when set to its minimum, calculates the points on the line of best fit. Regression lines can be used to predict values within the given set of data, but should not be used to make predictions for values outside the set of data.

The correlation coefficient *r* measures the strength of the linear association between *x* and *y*. The variable *r* has to be between –1 and +1. When *r* is positive, the *x* and *y* will tend to increase and decrease together. When *r* is negative, *x* will increase and *y* will decrease, or the opposite, *x* will decrease and *y* will increase. The coefficient of determination *r*^{2}, is equal to the square of the correlation coefficient. When expressed as a percent, *r*^{2} represents the percent of variation in the dependent variable *y* that can be explained by variation in the independent variable *x* using the regression line.

*Use the following information to answer the next five exercises*. A random sample of ten professional athletes produced the following data where *x* is the number of endorsements the player has and *y* is the amount of money made (in millions of dollars).

x |
y |
x |
y |

0 | 2 | 5 | 12 |

3 | 8 | 4 | 9 |

2 | 7 | 3 | 9 |

1 | 3 | 0 | 3 |

5 | 13 | 4 | 10 |

Draw a scatter plot of the data.

Use regression to find the equation for the line of best fit.

*ŷ* = 2.23 + 1.99*x*

Draw the line of best fit on the scatter plot.

What is the slope of the line of best fit? What does it represent?

The slope is 1.99 (*b* = 1.99). It means that for every endorsement deal a professional player gets, he gets an average of another $1.99 million in pay each year.

What is the *y*-intercept of the line of best fit? What does it represent?

What does an *r* value of zero mean?

It means that there is no correlation between the data sets.

When *n* = 2 and *r* = 1, are the data significant? Explain.

When *n* = 100 and *r* = -0.89, is there a significant correlation? Explain.

Yes, there are enough data points and the value of r is strong enough to show that there is a strong negative correlation between the data sets.

# Homework

What is the process through which we can calculate a line that goes through a scatter plot with a linear pattern?

Explain what it means when a correlation has an *r*^{2} of 0.72.

It means that 72% of the variation in the dependent variable (*y*) can be explained by the variation in the independent variable (*x*).

Can a coefficient of determination be negative? Why or why not?

- Introductory Statistics
- Preface
- Sampling and Data
- Descriptive Statistics
- Introduction
- Stem-and-Leaf Graphs (Stemplots), Line Graphs, and Bar Graphs
- Histograms, Frequency Polygons, and Time Series Graphs
- Measures of the Location of the Data
- Box Plots
- Measures of the Center of the Data
- Skewness and the Mean, Median, and Mode
- Measures of the Spread of the Data
- Descriptive Statistics

- Probability Topics
- Discrete Random Variables
- Introduction
- Probability Distribution Function (PDF) for a Discrete Random Variable
- Mean or Expected Value and Standard Deviation
- Binomial Distribution
- Geometric Distribution
- Hypergeometric Distribution
- Poisson Distribution
- Discrete Distribution (Playing Card Experiment)
- Discrete Distribution (Lucky Dice Experiment)

- Continuous Random Variables
- The Normal Distribution
- The Central Limit Theorem
- Confidence Intervals
- Hypothesis Testing with One Sample
- Hypothesis Testing with Two Samples
- The Chi-Square Distribution
- Linear Regression and Correlation
- F Distribution and One-Way ANOVA
- Appendix A: Review Exercises (Ch 3-13)
- Appendix B: Practice Tests (1-4) and Final Exams
- Appendix C: Data Sets
- Appendix D: Group and Partner Projects
- Appendix E: Solution Sheets
- Appendix F: Mathematical Phrases, Symbols, and Formulas
- Appendix G: Notes for the TI-83, 83+, 84, 84+ Calculators
- Appendix H: Tables