liveBook · Manning

Linearity

As explained in Grokking Statistics

A relationship in which changes in one variable are proportional to changes in another.

A linear relationship is a pattern between two variables that approximately follows a straight line. As one variable changes, the other tends to change in a consistent direction: both rise together in a positive relationship, or one rises while the other falls in a negative one. The closer the points cluster around a line, the stronger the pattern. section 7.1 section 7.2

Hotter days, more sports drinks

A shop can compare temperature with sports-drink sales across 10 days. Plot temperature on the x-axis and sales on the y-axis: the dots trend upward and roughly follow an unseen line. That suggests a positive linear relationship, making temperature a plausible input for forecasting sales. section 7.1

Figure 7.1 A scatterplot showing 10 data points relating weather temperature to sports drink sales. The points seem to follow a “line” and have an upward trend pattern: as temperature increases, so do sales.

Use the scatterplot to judge the pattern before calculating anything: an upward, roughly straight arrangement suggests a positive linear relationship. section 7.1

A scatterplot is a useful first check, but it does not prove that one variable causes the other. A relationship may be coincidental, affected by other variables, or nonlinear—such as polynomial or exponential—so a straight line would be the wrong description. Common sense and later model testing matter. section 7.1 section 1.7

Pearson correlation summarizes the strength and direction of a linear relationship with r, from -1 to 1. Values near 1 indicate a strong positive pattern; values near -1 indicate a strong negative pattern; values near 0 indicate little linear correlation. For the temperature-and-sales data, r is about 0.9889. section 7.2

When the pattern is suitably linear, linear regression fits a line between input and output variables. That fitted line can predict values not previously seen, but useful predictions depend on the relationship holding up beyond the observed data. section 7.0 section 1.7

How Grokking Statistics covers it

How deep it goes
Explains visual patterns and Pearson r interpretation, while deferring formula proofs and broader nonlinear treatment.
Examples
Uses temperature and sports-drink sales, contrasting sleep and rainfall as a likely coincidental association.
What it assumes
Introduces the visual idea from paired data and explains summation notation while avoiding formula proofs.
What you can do after
Evaluate/understand whether paired data suggests a linear pattern and what correlation direction and strength imply.
How it connects
Connects scatterplots, Pearson correlation, p-values, linear regression, hypothesis testing, and causation.

Also explained in

Compare how 2 books explain linearity →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking Statistics. The section links point to the parts of the book it draws on.