Skip to content
← All questions

How do you derive the intercept formula from the normal equations in simple linear regression?

By setting the partial derivative of the least-squares objective with respect to the intercept to zero, we obtain the relationship: intercept = mean(y) − slope · mean(x). This implies that the fitted line always passes through the point of sample means.

Conditions

  • The model includes an intercept term.
  • The derivative is taken with respect to the intercept parameter.

Reasoning, step by step

  1. Take the partial derivative of the sum of squared residuals with respect to the intercept.
  2. Set this derivative equal to zero to find the critical point.
  3. Solve the resulting equation for the intercept in terms of the slope and sample means.

Example

The script states: 'Setting the intercept derivative to zero gives intercept=mean(y)−slope·mean(x). Hence a fitted line with an intercept passes through the point of sample means.'

Common misconceptions

  • Assuming the intercept is independent of the slope.
  • Forgetting that this relationship holds specifically when an intercept is included in the model.

Watch the explanation

Connected concepts

Explore next

Related questions

Understand why

↗
Meet the concept

↗
Meet the concept

↗
Understand why

↗

Answers are generated from source material and independently checked. Consult the original video or creator if something is unclear.