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.

6. Regression

How to explain an outcome with several drivers at once: the least-squares line, multiple regression with statsmodels, dummy variables for categories, and interactions. Then the trap behind every coefficient (what it holds fixed) and how to turn a model into a decision in riyals.

Slides

Present full screen Download the PDF

Click or tap the slide to move forward, its left edge to go back; the arrow keys work too.

Reading

Regression: What Drives Daily Sales builds the models of the lecture step by step on a year of Qahwa House’s daily sales: why the simple regression says that higher prices sell more cups, how the branch and the temperature turn that slope negative, why one promotion coefficient hides a promotion that pays only at the University branch, and what a riyal on the price is worth.

Lab 6: Linear regression with statsmodels

The manager asks two questions: should Qahwa House raise its drink prices by 1 SAR, and should every branch keep the second cup half price promotion? You fit simple and multiple regressions, add dummy variables and an interaction, predict a day with its interval, and turn the coefficients into riyals per day before writing a three-sentence recommendation.

Next week

Model validation and classification: testing a model on data it has not seen, and predicting yes/no outcomes such as customer churn.

→ Week 7: Model Validation and Classification