Statistics 101 · Worked example
Linear regression explained with an example
Simple linear regression describes a linear relationship between an explanatory variable x and a response variable y. The fitted line predicts an average response at a given x.
The method
A fitted regression line is ŷ = a + bx. The intercept a is the predicted response at x = 0. The slope b is the predicted change in y for a one-unit increase in x.
Worked example
A shop models weekly sales using advertising spend. Its fitted line is ŷ = 20 + 3x, where x is advertising spend in thousands of rand and ŷ is sales in thousands of rand. The observed advertising values range from 1 to 8.
- For advertising spend of R4,000, use x = 4.
- Predicted sales = 20 + 3 × 4 = 32 thousand rand, or R32,000.
- The slope predicts an average R3,000 increase in sales for each additional R1,000 of advertising within the relevant range.
Interpret the answer
The line describes an association in the observed data. It does not establish that advertising alone causes the change in sales.
A common mistake
Do not mix rand and thousands of rand. Avoid extrapolating far beyond the observed x values, and check the model’s assumptions before relying on predictions.
Check your understanding
For the line ŷ = 20 + 3x, what are the predicted sales when x = 6?
Show the answer
20 + 3 × 6 = 38 thousand rand, or R38,000.
Continue practising
Try the free sample, or create an account to practise across all 13 topics.
Try five questions free