liveBook · Manning

Intercept

As explained in Statistics Every Programmer Needs

An intercept is the predicted value of a response variable when all predictors in a linear equation equal zero.

In linear regression, the intercept is the predicted response when every predictor equals zero. For one predictor, the fitted equation is ŷ = β₀ + β₁x: β₀ is the intercept, while β₁ is the change in the prediction for a one-unit change in x. The intercept and slope position the regression line to minimize differences between observed and predicted values under a linear model. section 4.1.1 section 4.2.2

Predicting a running split

A fitted model predicts Stage 2 running time from Stage 1 time as ŷ = −3.0778 + 1.3083x, in minutes. At x = 193, the predicted Stage 2 time is about 249 minutes. The intercept, −3.0778, is the model’s prediction at a Stage 1 time of zero—not a typical running time in the observed data. Interpret it as part of the fitted equation rather than as a practical forecast at zero. section 4.2.3 section 4.1.1

With statsmodels, add the constant to the predictor before fitting ordinary least squares; the constant receives the intercept estimate. The regression table reports it under `coef` alongside the slope. Use those coefficients to calculate predictions, then assess fit rather than treating the coefficients alone as proof of predictive quality. section 4.2.2 section 4.2.3

>>> x = sm.add_constant(x)

The `sm.add_constant(x)` call adds the constant used to estimate the intercept. section 4.2.2

How Statistics Every Programmer Needs covers it

How deep it goes
Defines the zero-predictor interpretation and works through coefficient-based prediction and statsmodels fitting.
Examples
Uses Stage 1 and Stage 2 running times, a fitted equation, and a 193-minute input yielding an approximately 249-minute prediction.
What it assumes
Assumes numeric predictor and response data while defining their roles and showing how to add a constant before fitting.
What you can do after
Apply it via statsmodels by adding a constant, fitting OLS, and using the reported intercept with the slope to predict a response.
How it connects
Connects the intercept to linear regression, slope, ordinary least squares, regression coefficients, and predicted values.

Also explained in

Compare how 7 books explain intercept →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Statistics Every Programmer Needs. The section links point to the parts of the book it draws on.