liveBook · Manning

Chapter 7: Number go up (or down)! Correlation and linear regression

What you will learn in chapter 7 of Grokking Statistics

The chapter introduction defines linear regression as a way to model and predict a linear relationship, explains why it is useful, and introduces correlation as a numerical score of a relationship.

After this chapter you will be able to

What it builds on

Section by section

Introduction

The chapter introduction defines linear regression as a way to model and predict a linear relationship, explains why it is useful, and introduces correlation as a numerical score of a relationship.

Key terms: linear regression, independent (input) variables, dependent (output) variables, linear relationship, linear operations, scalable, correlation

7.1 Correlation

This section introduces correlation and uses a sports-drink sales scatterplot to show how an upward linear pattern can indicate a relationship without proving causation.

Key terms: correlation, positive correlation, negative correlation, no correlation, scatterplot, linear pattern, positive linear relationship, noise, causation, coincidental

7.2 The Pearson correlation

This section introduces Pearson’s correlation coefficient, shows how to interpret its value, and cautions that a strong observed correlation is not automatically statistically significant.

Key terms: Pearson correlation, correlation coefficient (r), covariance, standard deviations, negative correlation, positive correlation, linear correlation, sports drink sales, temperature, statistically significant

7.3 Hypothesis testing the correlation coefficient

This section explains how to test whether a Pearson correlation is statistically significant and why the p-value depends on both the correlation and the amount of data.

Key terms: null hypothesis, alternative hypothesis, Pearson correlation, p-value, alpha threshold, two-tailed t-test, t-distribution, degrees of freedom, n - 2, sample size

7.4 Assumptions of Pearson correlation

This section explains when Pearson correlation is useful, why plots can reveal misleading correlation values, and what to consider when its assumptions fail.

Key terms: Pearson correlation, linear, continuous variables, normal distribution, homoscedasticity, heteroscedastic, outliers, Anscombe’s quartet, data cleaning, logarithmic transformations

7.5 Correlation is not causation

This section explains why correlation alone cannot establish causation, how to strengthen a causal claim, and why a correlation may still be useful for prediction.

Key terms: correlation, causation, p-value, spurious correlations, causality, randomized double-blind testing, healthy skepticism, linear regression, prediction

7.6 Linear regression

Defines regression as fitting relationships for prediction and linear regression as predicting an output by scaling and adding inputs.

Key terms: regression, linear regression, independent variables, dependent variable

7.7 Simple linear regression

Introduces simple linear regression as a way to predict sports drink sales from temperature, interprets the fitted line, and explains why its predictions still need scrutiny.

Key terms: simple linear regression, input variable x, output variable y, correlation, y = mx + b, slope, intercept, tight linear regression, overfitting, generalization

7.8 Interpolation vs. extrapolation

This section distinguishes interpolation from extrapolation and explains why predictions or claims beyond observed data can be unreliable.

Key terms: interpolation, extrapolation, observed data range, linear regression, y-axis, intercept, range of data, training the model, large language model

7.9 Residuals and sum of squares

Explains how residuals become a sum-of-squares loss and how simple linear regression chooses the line that minimizes it.

Key terms: residuals, ŷ, y-hat, sum of squares, loss function, m and b, minimize, simple linear regression

7.10 Overfitting and bias/variance tradeoff

The section explains why fitting training data perfectly can hurt prediction and how model bias trades off against prediction variability.

Key terms: loss function, sum of squares, residuals, noise, biased model, biased data, linear regression, bias-variance tradeoff, variance

7.11 Evaluating a simple linear regression

This section explains how R² and RMSE evaluate a simple linear regression, why graphical checks still matter, and how multiple regression uses beta coefficients.

Key terms: R2, coefficient of determination, Pearson correlation, squared residuals, dependent variable, independent variable, root mean squared error, RMSE, residuals, sum of squares

7.12 A real-world example

The section uses FAA bird-strike data to show why an apparent altitude pattern does not necessarily support Pearson correlation or linear regression.

Key terms: FAA bird strike database, self-reported, flights where no bird strikes occurred, HEIGHT, 100-foot bins, dependent variable, Pearson correlation, linear regression, p-value, logarithmic transformation

7.13 Summary

Where this is used later

Concepts explained in this chapter

← Chapter 6: Coincidence? I think not! Chapter 8: Yes, no, or maybe so? Logistic regression and classification →

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.