Python for Introductory StatisticsXYZ Homework Edition

⇩ Download ▾

12. Linear Regression and Correlation

How do we measure a relationship between two quantitative variables? For example, what is the relationship between students’ time spent studying for a test and their test scores? In general, the more time spent studying (more hours) would yield a higher test score. There is a direct or positive relationship between time spent and test scores. But how strong is the relationship?

Another example is the relationship between the age (years) of a car and its price (in dollars). In general, the older the car (more years) the cheaper (less dollars) it costs. The relationship is indirect or negative. What type and how strong is the relationship?

Adapted from Python for Introductory Statistics, by Simon Aman (Truman College, City Colleges of Chicago), licensed under CC BY 4.0. Changes were made: reformatted as an accessible XYZ web edition with live in-browser code cells. License: CC-BY-4.0.

These eBooks are a prerelease and are not yet certified conformant with WCAG 2.1 AA or ADA Title II. Every page is built against an automated accessibility gate, and the published editions will meet ADA Title II requirements when they release in late September 2026. If something is unusable, please tell us.