Simple Linear Regression
Regression models how a response changes with a predictor: energy use with load, a calibrated reading with a reference, a quality measure with a process setting. We fit least squares, interpret slope and intercept with units, and inspect residuals.
\(R^2\) measures the fraction of observed squared variation accounted for by the line; it is not causation. Statsmodels is used for inference: a test of the slope, a confidence interval for the mean response, and a prediction interval for a new observation. This session is a statistical regression analysis, not a machine-learning prediction lab.
Key Concepts¶
- Least squares: \(\hat{y} = \hat{\beta}_0 + \hat{\beta}_1 x\)
- Interpretation of slope and intercept
- \(R^2\) and correlation
- Residual and QQ-plots
- Confidence interval for the mean versus prediction interval
- Statsmodels for fitting, inference, diagnostics, and intervals
Learning Objectives
- Fit \(\hat{y} = \hat{\beta}_0 + \hat{\beta}_1 x\) and interpret the coefficients with units.
- Report \(R^2\) without treating it as proof of causation.
- Test whether the slope differs from zero.
- Read residual and QQ-plots.
- Distinguish a confidence interval for the mean response from a prediction interval for one new observation.
Session Preparation:¶
Brooks: Chapter 10
Resources¶
Tutorial 10: Energy use and processor load
Assignment 5 — ANOVA and Regression — due 17 Nov. 2026, 12:45