Regression

12. Regression#

This chapter introduces prediction with relationships between numeric variables. You will study correlation, regression lines, least squares, residual diagnostics, and how much a fitted slope can be trusted. One case runs through the chapter, advertising and sales across 40 stores (simulated teaching data), with supporting cases on sales reps’ quarterly results, price and demand, Anscombe’s quartet, and real New York City taxi fares.

  • Correlation: A unit-free number between -1 and 1 that measures how tightly a scatter plot clusters around a straight line.

  • Regression Line: A straight line, set by its slope and intercept, that predicts one variable from another.

  • Least Squares: The best-fitting line is the one with the smallest root mean squared error.

  • Residual: The observed value minus the fitted value; residual plots reveal patterns a line misses.

  • Inference for the Slope: Bootstrapping the rows of the data gives a confidence interval for the true slope; if 0 is outside the interval, reject the hypothesis of no linear association at about the 5% cutoff.

  • Association Is Not Causation: A strong correlation describes a pattern in the data but does not show that one variable causes the other.

Chapter Video

Video credit: CrashCourse. (2018, October 3). Regression: Crash Course Statistics #32. YouTube. Watch on YouTube (12:40).

This embedded video is provided for educational reference only. All rights are retained by the respective copyright holder.

Learning Objectives

By the end of this chapter, you will be able to:

  1. Describe linear association with scatter plots and correlation.

  2. Use a regression line to make numeric predictions.

  3. Explain least squares as a method for choosing a fitted line.

  4. Use residual plots to diagnose patterns that a line misses.

  5. Build and interpret a bootstrap confidence interval for the true slope, and use it to test whether the slope could be 0.

  6. Communicate prediction limits and uncertainty in applied settings.

Chapter Flow

Glossary

#

Term

Explanation

1

Regression

A method for modeling or predicting an outcome from one or more features.

2

Prediction

An estimate of an outcome for a new or existing case.

3

Feature

An input variable used to predict an outcome.

4

Target

The outcome variable being predicted.

5

Scatter plot

A plot showing paired numeric values.

6

Association

A relationship or pattern between variables.

7

Correlation

A standardized measure of linear association.

8

Regression line

A straight line used to predict an outcome from a feature.

9

Slope

The predicted change in the outcome for a one-unit change in the feature.

10

Intercept

The predicted outcome when the feature is zero.

11

Fitted value

The model prediction for an observed case.

12

Residual

The observed value minus the fitted value.

13

Least squares

A method that chooses the line with the smallest root mean squared error (equivalently, the smallest mean of the squared residuals).

14

Residual plot

A plot of residuals used to check model patterns.

15

Standard units

Values expressed in standard deviations from the mean.

16

Root mean squared error

A typical prediction error measured in outcome units.

17

Linearity

The assumption that a straight line captures the main trend.

18

Extrapolation

Prediction outside the range of observed data.

19

Influential point

An observation that strongly affects a fitted model.

20

Diagnostics

Checks used to evaluate how well a model fits.

21

True slope

The slope of the regression line for the whole population; a fitted slope estimates it.

22

Sampling variability

The change in a statistic, such as a fitted slope, from one sample to another.

23

Bootstrap slope

The slope of the line fitted to one bootstrap resample of the rows.

24

Slope confidence interval

An interval of plausible values for the true slope, here from percentiles of bootstrap slopes.

25

No linear association

A true slope of 0; tested by checking whether 0 is inside the slope confidence interval.

26

Correlation coefficient (r)

The mean of the products of two variables in standard units; between -1 and 1.

27

Spurious correlation

A strong correlation between two variables that do not affect each other, produced by a third variable.

28

Ecological correlation

A correlation computed from group averages, often much stronger than the correlation for individuals.

29

Regression effect

The tendency of extreme results in one period to be closer to average in the next; also called regression to the mean.

30

Heteroscedasticity

Uneven spread: residuals that are more spread out in some parts of the data than in others.

31

Anscombe’s quartet

Four small data sets with nearly the same summary statistics and regression line but very different scatter plots.

Lecture Slides