Track 9 · Correlation and Regression · Lesson 4 of 15

Simple linear regression

Fit the least-squares line from data or summary statistics, use it to predict, and calculate residuals.

35 minAdvanced7 graded exercisesMembers

A juice brand's marketing team wants to know how many extra packs it sells, on average, for each additional thousand riyals of TV advertising in a week — and what sales to expect in a week with a planned 60 000 SAR campaign. A correlation says the two move together; a regression line says by how much.

Simple linear regression describes how a response yy changes, on average, with one explanatory variable xx, using a straight line y^=b0+b1x\hat{y} = b_0 + b_1 x. The hat on y^\hat{y} (“y-hat”) marks a fitted or predicted value. For each observation, the vertical gap between the actual and the fitted value is the residual:

ei=yi−y^i.e_i = y_i - \hat{y}_i.

A positive residual means the point lies above the line (the model under-predicts it); a negative residual means it lies below.

Included with a Formula Quest membership

It has 7 graded exercises with feedback, hints and worked solutions. After it you will be able to:

  • Compute the least-squares slope and intercept from data or from r, the SDs and the means
  • Use a fitted line to predict and calculate residuals (actual minus fitted)
  • State the properties of the least-squares line
  • Explain why a simple slope can absorb the effect of variables that move with x