01 / 21

Simple Linear
Regression

Learn to fit a line to data, interpret the slope and intercept, and use \(\hat{y} = b_0 + b_1 x\) to make predictions in real business scenarios.

Business Analytics

What Is Regression?

Regression is a statistical method that models the relationship between a dependent variable \(y\) and one or more independent variables \(x\). In simple linear regression, we use exactly one predictor to fit a straight line through the data.

Key Terminology

\(x\) : Independent Variable
The predictor or explanatory variable (e.g., advertising spend).
\(y\) : Dependent Variable
The response or outcome variable (e.g., revenue).
\(\hat{y}\) : Predicted Value
The value on the regression line for a given \(x\).
\(b_0\) : Y-Intercept
Predicted \(y\) when \(x = 0\).
\(b_1\) : Slope
Change in \(\hat{y}\) for each one-unit increase in \(x\).
\(e_i\) : Residual
Difference: \(y_i - \hat{y}_i\). The "error" for observation \(i\).

Why It Matters in Business

Simple linear regression is the foundation of predictive analytics. Companies use it daily to answer questions like:

1
Forecasting: If we spend \(\$50{,}000\) on ads, how much revenue can we expect?
2
Pricing: How does a \(\$1\) price increase affect quantity demanded?
3
Operations: Does adding one employee to a shift increase output significantly?

The Regression Equation

The simple linear regression model is:

\(b_0\) : Intercept
Where the line crosses the \(y\)-axis. The predicted value when \(x = 0\).
\(b_1\) : Slope
For each 1-unit increase in \(x\), \(\hat{y}\) changes by \(b_1\) units.

The Least Squares Method

We choose \(b_0\) and \(b_1\) to minimize the sum of squared residuals:

The formulas that minimize SSE are:

Slope \(b_1\)
$$b_1 = \frac{\sum(x_i - \bar{x})(y_i - \bar{y})}{\sum(x_i - \bar{x})^2}$$
Intercept \(b_0\)
$$b_0 = \bar{y} - b_1\bar{x}$$

Visualizing the Best-Fit Line

Price ($) Units Sold 0 2 4 6 8 10 20 30 40 Best-fit line Residuals

Correlation vs. Regression

Correlation \(r\) Regression
Purpose Measures strength and direction Models the equation of the relationship
Output A single number: \(-1 \leq r \leq 1\) An equation: \(\hat{y} = b_0 + b_1 x\)
Prediction Cannot predict specific values Can predict \(\hat{y}\) for any \(x\)
Direction matters? Symmetric: \(r_{xy} = r_{yx}\) Asymmetric: \(x\) predicts \(y\), not vice versa

Interpreting \(R^2\)

\(R^2\) (the coefficient of determination) tells you the proportion of variance in \(y\) explained by the model:

\(R^2 = 0\)
The model explains none of the variance: the line is no better than using \(\bar{y}\).
\(R^2 = 1\)
The model explains all of the variance: every point falls exactly on the line.

How to Fit a Regression

1
Plot the data: Create a scatter plot of \((x_i, y_i)\) to check for a linear pattern.
2
Compute the means: Find \(\bar{x}\) and \(\bar{y}\).
3
Calculate the slope: \(b_1 = \frac{\sum(x_i - \bar{x})(y_i - \bar{y})}{\sum(x_i - \bar{x})^2}\).
4
Calculate the intercept: \(b_0 = \bar{y} - b_1\bar{x}\).
5
Write the equation: \(\hat{y} = b_0 + b_1 x\).
6
Evaluate fit: Compute \(R^2\) and check residual plots.

Example 1: Computing the Slope

A coffee shop tracks temperature (\(x\), in °F) and iced-coffee sales (\(y\), in cups) over 5 days:

Day \(x\) (°F) \(y\) (cups)
16030
27040
37550
48055
59075

Example 1: Finding \(b_1\) and \(b_0\)

Example 2: Making a Prediction

Using the equation \(\hat{y} = -62.5 + 1.5x\), predict sales on a 85°F day:

Temperature (°F) Cups Sold 60 70 75 80 85 90 30 40 50 60 70 80 65 cups

Example 3: Computing \(R^2\)

For our coffee-shop data, compute how well the model fits:

Common Mistakes

✕ Extrapolation
Predicting far outside the range of observed \(x\) values. The linear trend may not hold at extremes.
✕ Correlation = Causation
A strong \(R^2\) does not prove \(x\) causes \(y\). Lurking variables may drive both.
✕ Ignoring Residual Patterns
If residuals show a curve or fan shape, a linear model is inappropriate: check the residual plot first.
✕ Misinterpreting \(b_0\)
The intercept often lacks real meaning (e.g., \(-62.5\) cups at 0°F). Do not over-interpret it outside context.
✕ Swapping \(x\) and \(y\)
Regressing \(x\) on \(y\) gives a different line than \(y\) on \(x\). The predictor matters.

Summary of Key Concepts

Concept Symbol Interpretation
Slope \(b_1\) Change in \(\hat{y}\) per 1-unit change in \(x\)
Intercept \(b_0\) Predicted \(y\) when \(x = 0\)
Coefficient of Determination \(R^2\) Proportion of variance in \(y\) explained by the model
Residual \(e_i = y_i - \hat{y}_i\) Error for observation \(i\): actual minus predicted
SSE \(\sum e_i^2\) Total squared error: smaller is better
Correlation \(r\) Direction and strength: \(r = \pm\sqrt{R^2}\)

Question 1 of 5

A regression equation is \(\hat{y} = 20 + 3x\). What does the slope of 3 mean?

Question 2 of 5

If \(R^2 = 0.85\) for a regression model, which statement is most accurate?

Question 3 of 5

Given the data: \(\bar{x} = 10\), \(\bar{y} = 25\), \(b_1 = 2\). What is the intercept \(b_0\)?

Question 4 of 5

A company builds a regression with data from \(x = 10\) to \(x = 50\). Using it to predict \(y\) at \(x = 200\) is an example of:

Question 5 of 5

The residual for a data point is \(e_i = -4\). This means the actual value \(y_i\) is: