Jump to ratings and reviews
Rate this book

Linear Regression With Python: A Tutorial Introduction to the Mathematics of Regression Analysis

Rate this book
Linear regression is the workhorse of data analysis. It is the first step, and often the only step, in fitting a simple model to data. This brief book explains the essential mathematics required to understand and apply regression analysis. The tutorial style of writing, accompanied by over 30 diagrams, offers a visually intuitive account of linear regression, including a brief overview of nonlinear and Bayesian regression. Hands-on experience is provided in the form of numerical examples, included as Python code at the end of each chapter, and implemented online as Python and Matlab code. Supported by a comprehensive glossary and tutorial appendices, this book provides an ideal introduction to regression analysis.

125 pages, Paperback

Published February 1, 2022

Loading...
Loading...

About the author

James V. Stone

21 books33 followers
Honorary Associate Professor, University of Sheffield, England.

Ratings & Reviews

What do you think?
Rate this book

Friends & Following

Create a free account to discover what your friends think of this book!

Community Reviews

5 stars
3 (75%)
4 stars
1 (25%)
3 stars
0 (0%)
2 stars
0 (0%)
1 star
0 (0%)
Displaying 1 - 1 of 1 review
Profile Image for Hồ Vinh.
129 reviews12 followers
July 8, 2026
5/5 stars
I picked this up wanting to stop treating linear regression as something I already understood just because I use it constantly. Turns out there was a lot I could fit a line to without ever really explaining why it works, and this book is exactly the kind of ground-up treatment that fixes that.

Stone's structure is what makes it work. He starts from the equation of a line and the idea of squared error, then builds outward one derivation at a time, so by the time you reach maximum likelihood or Bayesian regression, nothing feels like it dropped out of nowhere. The three ways of finding the coefficients (exhaustive search, gradient descent, and the calculus-based normal equations) are laid out side by side early on, and that framing pays off later when gradient descent reappears as the general-purpose tool once the problems stop having closed-form solutions.

A few things stuck with me in particular. The slope of the best fitting line being just covariance rescaled by variance is one of those derivations that turns an abstract optimisation problem into a single obvious sentence once you've worked through it. The signal-versus-noise split, and the fact that the resulting r-squared is provably the same number as squared correlation, was another moment where the algebra actually earned the intuition rather than just asserting it. And the chapter connecting least squares to maximum likelihood reframed the whole method for me: it isn't an arbitrary convenience, it's what falls out once you assume Gaussian noise.

As a data scientist, I appreciated that Stone doesn't stop at simple regression. The chapters on weighted regression, multicollinearity, and nonlinear regression map directly onto problems I've actually run into, and the closing material on Bayesian regression gives a genuinely different lens on the same math: instead of one best line, a whole distribution of plausible lines, with the least squares answer sitting inside it as the special case of an uninformative prior.

The Python code throughout is functional rather than idiomatic, so don't expect production-ready patterns, but that's not really the point of the book. The point is the derivations, and on that front it delivers completely.
Highly recommend it to anyone who uses regression regularly and wants to actually be able to derive it, not just call it.
Displaying 1 - 1 of 1 review