Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

MATH 4210: Regression Modeling and Analysis

California State University, Bakersfield, Department of Mathematics 4 units | Fall 2026 | Tuesday and Thursday, 8:15-9:50 AM | Science III 239 Instructor: Anjana Yatawara | ayatawara@csub.edu

This is the coursebook for MATH 4210, an advanced undergraduate course in applied regression. It is a free, open coursebook: you can read it on a laptop or a phone, search it, copy its code, and keep it after the semester ends. Nothing in it is behind a paywall.

What this book is

This book teaches regression as a way of answering real questions with data, not as a list of formulas to memorize. Every chapter opens with a genuine dataset and a question someone actually cared about, builds the theory needed to answer it, and proves every result along the way at a level you can follow with the matrix algebra the book itself teaches in Chapter 6.

Three commitments run through every chapter:

We never publish a number the book did not compute. Every figure, summary statistic, and worked answer is produced by code that runs on a real, documented dataset, or it carries a citation to its source. Every derivation is complete: this book does not write “algebra left to the reader” in its exposition. Where a full proof genuinely needs graduate-level machinery, the book says so plainly, proves what is provable at our level, and points you to where the rest is proved.

How to self-study from this book

If you miss a class meeting, or simply want to work ahead, you can learn a full chapter alone. Each chapter is built to make that possible:

Roadmap of the book

The book has sixteen chapters in five parts, plus a reference appendix.

Part I. Regression from the ground up (Chapters 1-5). Simple linear regression from first principles: what a statistical model is, least squares by hand, inference for a slope, correlation, and what to do when the usual normal-theory assumptions are in doubt (permutation and bootstrap methods). By the end of Part I you can fit, interpret, and defend a one-predictor regression completely.

Part II. The linear model in matrix form (Chapters 6-8). A self-contained introduction to the matrix algebra the rest of the book needs, then the general linear model: least squares, the hat matrix, Gauss-Markov, and multiple regression in practice. By the end of Part II you can fit and interpret a regression with any number of predictors and prove the properties of the estimator that make it trustworthy.

Part III. Building and checking models (Chapters 9-12). How to tell whether a fitted model is any good: residual diagnostics, influence and leverage values, transformations and weighted least squares, categorical predictors and interactions, and multicollinearity, model selection, and validation. By the end of Part III you can take a fitted model apart and decide whether to trust it.

Part IV. Regression for other kinds of response (Chapters 13-14). What happens when the response is not a continuous, normally distributed number: logistic regression for binary outcomes and Poisson regression for counts, introduced as two cases of the general idea of a generalized linear model.

Part V. Special topics (Chapters 15-16). Two self-study chapters for the end of the semester: regression with autocorrelated, time-ordered data, and path analysis, a first look at using sequences of regressions to reason about direct and indirect effects.

The appendices in the back are reference material you will return to all semester: a chapter-by-chapter formula summary, statistical tables, R and Python quick references, a datasheet for every dataset in the book, a which-method decision guide, a glossary, and answers to the odd-numbered practice problems.

Course notation

This book follows the notation of Kutner, Nachtsheim, and Neter’s Applied Linear Regression Models (“ALRM”), the standard for the applied-regression tradition this course sits in. Learn this table now; every later chapter uses it without re-explaining it (though each chapter reminds you of a symbol’s meaning in a single line the first time it reappears).

SymbolRead asMeaning
YiY_i“Y sub i”the response (dependent variable) for observation ii
XiX_i“X sub i”the predictor for observation ii; with more than one predictor, Xi1,Xi2,X_{i1}, X_{i2}, \dots (2. Simple linear regression notes the synonyms other books use)
β0,β1\beta_0, \beta_1“beta naught, beta one”the true (population) intercept and slope parameters; unknown constants
b0,b1b_0, b_1“b naught, b one”the least-squares estimates of β0,β1\beta_0, \beta_1, computed from sample data; equivalently written β^0,β^1\hat{\beta}_0, \hat{\beta}_1 (“beta-hat”)
εi\varepsilon_i“epsilon sub i”the true (unobservable) random error for observation ii; the book assumes εiN(0,σ2)\varepsilon_i \sim N(0, \sigma^2), independent across ii
eie_i“e sub i”the residual ei=YiY^ie_i = Y_i - \hat{Y}_i, the observable stand-in for εi\varepsilon_i
Y^i\hat{Y}_i“Y-hat sub i”the fitted (predicted) value for observation ii
nn“n”the number of observations (sample size)
pp“p”the number of regression parameters, including the intercept (so simple linear regression has p=2p = 2)
σ2\sigma^2“sigma squared”the true error variance
s2s^2 (or MSE)“s squared”the estimated error variance
SSTO“S-S-T-O”total sum of squares, (YiYˉ)2\sum (Y_i - \bar{Y})^2
SSR“S-S-R”regression sum of squares, (Y^iYˉ)2\sum (\hat{Y}_i - \bar{Y})^2
SSE“S-S-E”error sum of squares, (YiY^i)2\sum (Y_i - \hat{Y}_i)^2
MSR“M-S-R”regression mean square, SSR divided by its degrees of freedom
MSE“M-S-E”error mean square, SSE divided by its degrees of freedom; also the estimate of σ2\sigma^2
rr“r”the sample Pearson correlation coefficient
R2R^2“R squared”the coefficient of determination, SSR / SSTO
Y\mathbf{Y}“Y” (bold)the n×1n \times 1 response vector, matrix form
X\mathbf{X}“X” (bold)the n×pn \times p design (model) matrix, matrix form
β\boldsymbol{\beta}“beta” (bold)the p×1p \times 1 parameter vector
b\mathbf{b}“b” (bold)the p×1p \times 1 least-squares estimate of β\boldsymbol{\beta}
X\mathbf{X}'“X transpose” or “X prime”the transpose of X\mathbf{X}; transpose is always written with a prime in this book
H\mathbf{H}“hat matrix”the hat matrix, H=X(XX)1X\mathbf{H} = \mathbf{X}(\mathbf{X}'\mathbf{X})^{-1}\mathbf{X}', so that Y^=HY\hat{\mathbf{Y}} = \mathbf{H}\mathbf{Y}
s2{b1}s^2\{b_1\}“s squared of b one”the estimated variance of the sampling distribution of b1b_1 (ALRM’s brace notation for the estimated variance of any statistic)
N(μ,σ2)N(\mu, \sigma^2)“N of mu, sigma squared”the normal distribution, parameterized here by its variance (see the note below)

Software setup

Every worked example in this book runs in both R and Python, reading the same CSV file from the book’s data/ folder. R is the course’s primary language (a catalog requirement); Python is carried alongside it. You will need both installed and working before Chapter 1’s first worked example.

Accessibility

This book is built to be usable by everyone:

If you use a screen reader or other assistive technology and hit a barrier in this book, that is a bug worth fixing. Tell your instructor so it can be reported to the CSUB Department of Mathematics.

Version en espanol

Este libro esta disponible capitulo por capitulo en espanol. Cada capitulo en ingles tiene un enlace “Espanol” en la esquina superior derecha de la pagina, y cada version en espanol tiene un enlace “English” de regreso al ingles en el mismo lugar. Puedes encontrar todos los capitulos en espanol reunidos en Version en espanol, la ultima parte de la tabla de contenidos.

Licensing, in one sentence

The writing is free to reuse and adapt under CC BY-SA 4.0, and the code is MIT.


Welcome to MATH 4210. Open R (or Python, or both), pick up Chapter 1, and let us begin with the question that gave regression its name.