1. Home
  2. Explore
  3. Mathematics
  4. Basic Statistics Intro

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Basic Statistics Intro

Simple Linear Regression Basics

Simple linear regression allows a mathematical model of the relationship between two variables—an independent variable (predictor) and a dependent variable (outcome). Even before introducing that second variable, it is essential to understand the baseline model that uses only the dependent variable. This foundation clarifies how regression improves predictions.


The Mean-Only Model

When only one variable is available (for example, tip amounts from six meals: 5,5,5,17, 11,11,11,8, 14,14,14,5), there is no other information to guide a prediction. The best possible estimate for any future observation is simply the mean of the observed values.

  • Mean of tips: (5+17+11+8+14+5)/6=10(5 + 17 + 11 + 8 + 14 + 5) / 6 = 10(5+17+11+8+14+5)/6=10 dollars.

  • This mean is represented as a horizontal line at \10$ when the data are plotted (meal number on the x‑axis, tip amount on the y‑axis).

  • Because the order of meals does not matter, the x‑axis only serves as a location marker for each observation.

Key takeaway: With only the dependent variable, the mean is the best predictor of any new value. The mean-only model is the starting point for all regression comparisons.


Residuals and Sum of Squared Errors

The residual (also called the error) is the vertical distance between an observed value and the best‑fit line—here the mean line at \10$.

For each tip:

  • Meal 1: 5−10=−55 - 10 = -55−10=−5 (residual)

  • Meal 2: 17−10=+717 - 10 = +717−10=+7

  • Meal 3: 11−10=+111 - 10 = +111−10=+1

  • Meal 4: 8−10=−28 - 10 = -28−10=−2

  • Meal 5: 14−10=+414 - 10 = +414−10=+4

  • Meal 6: 5−10=−55 - 10 = -55−10=−5

Properties of residuals:

  • Their sum always equals zero: (−5)+7+1+(−2)+4+(−5)=0(-5) + 7 + 1 + (-2) + 4 + (-5) = 0(−5)+7+1+(−2)+4+(−5)=0.

  • Squaring each residual makes all values positive and emphasizes larger deviations (a residual of ±7\pm7±7 squares to 494949, while ±2\pm2±2 squares to 444).

The squared residuals for this example are 25,49,1,4,16,2525, 49, 1, 4, 16, 2525,49,1,4,16,25. Adding them gives the sum of squared errors (SSE):

SSE=25+49+1+4+16+25=120SSE = 25 + 49 + 1 + 4 + 16 + 25 = 120SSE=25+49+1+4+16+25=120

SSE is a measure of how poorly the mean‑only model fits the observed data. It represents the total unexplained variation in the dependent variable.

Definition: The sum of squared errors (SSE) is the sum of the squared residuals. It quantifies the discrepancy between observed values and the predictions of a model.


The Goal of Simple Linear Regression

Simple linear regression introduces an independent variable (e.g., bill amount for a meal) to create a new best‑fit line—one that is no longer flat. This line is chosen to minimize the sum of squared errors (SSE). Through calculus, this line is mathematically guaranteed to be the best possible linear fit to the data.

  • The regression line will “eat up” some of the SSE that existed in the mean‑only model.

  • If the independent variable is useful, the new SSE will be smaller; if it is useless, the regression line will remain flat (equal to the mean), and the SSE will not change.

Thus, the quality of a regression model is judged by how much it reduces the SSE compared to the mean‑only baseline.


Comparing Models

At its core, simple linear regression is always a comparison of two models:

  1. Model 1 (mean‑only): The independent variable is ignored; predictions equal the mean of the dependent variable.

  2. Model 2 (regression): The independent variable is included; predictions come from a sloped line that minimizes SSE.

If Model 2 does not meaningfully reduce SSE, the independent variable adds no explanatory power. If it does, the model provides better predictions than simply guessing the mean.

Foundation concept: A “good” regression model reduces the sum of squared errors by a large amount relative to the mean‑only model. This comparison is the basis for understanding R‑squared, hypothesis tests, and all further regression diagnostics.

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent