3.4 Simple Linear Regression: Math
- RSS = residual sum of squares
RSS=e21+e22+…+e2n
RSS=(y1−ˆβ0−ˆβ1x1)2+(y2−ˆβ0−ˆβ1x2)2+…+(yn−ˆβ0−ˆβ1xn)2
ˆβ1=∑ni=1(xi−ˉx)(yi−ˉy)∑ni=1(xi−ˉx)2 ˆβ0=ˉy−ˆβ1ˉx
- ˉx, ˉy = sample means of x and y
3.4.1 Visualization of Fit

Figure 3.2: Contour and three-dimensional plots of the RSS on the Advertising
data, using sales
as the response and TV
as the predictor. The red dots correspond to the least squares estimates ˆβ0 and ˆβ1, given by (3.4)
Learning Objectives:
- Perform linear regression with a single predictor variable. ✔️