22  Simple Linear Regression

NoteWhat you’ll be able to do

By the end of this chapter you will be able to:

  1. Read lm() summary output: find the slope, its significance, and R².
  2. Interpret the intercept — and recognize when it has no meaningful interpretation.
  3. Interpret R² as the proportion of variance explained.
  4. Explain how the overall F-test and the slope’s t-test relate in simple regression.
  5. State why a fitted regression line does not establish causation.

Across U.S. states, higher poverty rates go with higher teen birth rates. A correlation can tell you that relationship is strong; regression goes further — it draws the line. With the line you can say how much the birth rate rises per point of poverty, and predict the rate for a state you haven’t seen.

Simple linear regression fits a straight line to two continuous variables. It does three things at once:

  1. Describes the relationship between a predictor (X) and an outcome (Y).
  2. Predicts outcomes for new values of X.
  3. Estimates how much Y changes per unit change in X.

If correlation (Chapter 20) tells you how strong the relationship is, regression tells you what shape the relationship takes — specifically, a straight line — and quantifies it.

NoteWhy do we care? See it with real data first

Before the formal machinery below, work through the regression preview activity — a real predictor-and-outcome question, answered start to finish with real data, before intercepts, slopes, or R² are ever named.

22.1 The model

The simple linear regression model is:

\[ Y = \beta_0 + \beta_1 X + \epsilon \]

  • \(\beta_0\) — the intercept. The predicted value of Y when X = 0.
  • \(\beta_1\) — the slope. How much Y changes for a one-unit increase in X.
  • \(\epsilon\) — the error term. Everything Y does that isn’t explained by X.

R estimates the intercept and slope; the goal is to find the line that minimizes the sum of squared errors.

22.2 Key terms

Term Definition
Residual \(\text{observed } Y - \text{predicted } Y\). What the model can’t explain.
Intercept (\(\beta_0\)) Predicted Y when X = 0 (where the line crosses the Y-axis)
Slope (\(\beta_1\)) Change in Y per unit change in X
\(R^2\) Proportion of variance in Y explained by the model (0 to 1)
Standard error of the estimate Average distance of observed values from the regression line
NoteAnalogy: the forecast’s miss

The forecast said 75°; it hit 78°. The 3-degree miss is the residual. A good forecaster’s misses are small, centered on zero, and patternless — wrong by a little in both directions, with no systematic bias. That is exactly what we ask of a regression model’s residuals, and exactly what the diagnostics in Chapter 25 check.

Mapping: forecast = predicted Y; actual temperature = observed Y; miss = residual; “always too cold in winter” = a pattern in residuals, meaning the model is missing something.

Where this breaks: forecasters predict tomorrow, then find out. Regression residuals are computed on the same data used to fit the line — the model has already seen the answers, so its misses flatter it slightly.

22.3 When to use it

Use simple regression when you have:

  • One continuous outcome (Y).
  • One predictor (X) — usually continuous, but can be a dichotomous categorical variable (see Chapter 23).
  • An interest in describing, predicting, or quantifying the relationship.

If your predictor is a categorical variable with 3+ levels, use one-way ANOVA (which is conceptually equivalent — see the equivalence note in Chapter 23). If you have multiple predictors, jump to Chapter 24.

TipTry It: Simulation First

Before fitting a line, build intuition with the Rossman/Chance Analyzing Two Quantitative Variables applet.

Predict first: sketch what you think the best-fit line will look like through your scatterplot. Where will it cross the Y-axis? What direction and steepness will the slope have? Then fit the line in R and compare your prediction to the actual coefficients.

22.4 Two hypothesis tests, one model

Every simple regression actually involves two tests:

22.4.1 1. The F-test (overall model)

  • \(H_0\): The model explains no variance (\(R^2 = 0\), slope = 0).
  • \(H_1\): The model explains some variance.

This asks whether the model does better than predicting the mean of Y for everyone — whether knowing X helps at all.

22.4.2 2. The t-test on the slope

  • \(H_0\): The slope is zero (\(\beta_1 = 0\)).
  • \(H_1\): The slope is non-zero.

For simple regression (one predictor), the t-test on the slope and the overall F-test are mathematically equivalent (\(t^2 = F\)). With multiple predictors, the overall F-test and the per-coefficient t-tests answer different questions (see Chapter 24).

22.5 R syntax

model <- lm(Y ~ X, data = data)
summary(model)

lm() stands for “linear model.” The formula Y ~ X says “predict Y from X.” summary() produces the regression table.

22.5.1 Worked example

Suppose you want to know if state-level poverty rate predicts teen birth rate. The data are real: poverty rate (%) and births per 1,000 females aged 15–19 for all 50 states plus Washington, D.C.

# Step 0: Load the data
data <- read.csv("https://jkoxford-a11y.github.io/awesomesaucestats/data/teen_birth_poverty.csv")

# Step 1: Inspect
str(data)
summary(data)

# Step 2: Visualize — always plot first
plot(data$poverty_rate, data$teen_birth_rate)
abline(lm(teen_birth_rate ~ poverty_rate, data = data), col = "red")

# Or with ggplot
library(ggplot2)
ggplot(data, aes(x = poverty_rate, y = teen_birth_rate)) +
  geom_point() +
  geom_smooth(method = "lm", se = TRUE)

# Step 3: Fit the model
model <- lm(teen_birth_rate ~ poverty_rate, data = data)

# Step 4: Check assumptions (residual diagnostics — see @sec-diagnostics)
par(mfrow = c(2, 2))
plot(model)
par(mfrow = c(1, 1))

# Step 5: Read the output
summary(model)

# Step 6: Confidence intervals on coefficients
confint(model)

22.5.2 Reading the output

The summary() output:


Call:
lm(formula = teen_birth_rate ~ poverty_rate, data = data)

Residuals:
     Min       1Q   Median       3Q      Max 
-19.5940  -6.6084  -0.5902   7.4611  15.7436 

Coefficients:
             Estimate Std. Error t value Pr(>|t|)    
(Intercept)   15.6737     4.0318   3.888 0.000305 ***
poverty_rate   2.0255     0.2925   6.925 8.67e-09 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 8.846 on 49 degrees of freedom
Multiple R-squared:  0.4946,    Adjusted R-squared:  0.4843 
F-statistic: 47.95 on 1 and 49 DF,  p-value: 8.67e-09

Walking through the pieces:

  • Intercept = 15.67, p < .001 — when poverty rate is 0, the predicted teen birth rate is 15.67 per 1,000. Note: the intercept is only meaningful when X = 0 makes sense. The observed poverty rates run from 5.3% to 25.3%, so 0% is far outside the data; the intercept here is mathematical, not substantive.
  • Slope = 2.03, p < .001 — for every 1 percentage-point increase in poverty rate, the teen birth rate increases by 2.03 per 1,000 on average. This is the headline finding.
  • Standard error = 0.29 — the slope is estimated with reasonable precision; confint(model) gives its 95% CI, [1.44, 2.61].
  • \(R^2\) = 0.4946 — poverty rate explains 49.5% of the variance in teen birth rates.
  • Residual standard error = 8.846 — the typical prediction error, in the original units of the outcome (births per 1,000).
  • \(F(1, 49) = 47.95\), p < .001 — the model as a whole is significant. (For simple regression, this matches the slope’s t-test: \(6.925^2 \approx 47.95\).)

22.6 Where R² and F come from

This is the same split as one-way ANOVA (Chapter 17), with a line in place of the group means. For each state, ask three distances:

  • Total: how far its teen birth rate is from the mean of all 51 states.
  • Explained: how far the line’s prediction for that state is from the mean. This is the part poverty rate accounts for.
  • Leftover: how far the state’s actual rate is from the line. That’s the residual.

Square and add them up across states, and the pieces add up exactly:

\[ \text{SS}_\text{total} = \text{SS}_\text{explained} + \text{SS}_\text{residual} \]

Here: 7587.3 = 3752.7 + 3834.5.

summary() doesn’t print these sums, but anova(model) does, in the same layout as Chapter 17’s table:

Analysis of Variance Table

Response: teen_birth_rate
             Df Sum Sq Mean Sq F value   Pr(>F)    
poverty_rate  1 3752.7  3752.7  47.955 8.67e-09 ***
Residuals    49 3834.5    78.3                     
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
  • R² is η² under a new name: 3752.7 / 7587.3 = .49. Poverty rate accounts for 49% of the variation in teen birth rates.
  • F is the same ratio as in ANOVA: 3752.7 / 78.3 = 47.95. The explained row has 1 df because there’s one slope. The residual row has n − 2 = 49, because the line used up two numbers, the intercept and the slope.
  • One predictor means one question. That’s why F = t² for the slope: 6.925² = 47.95.
TipMake the split move

Open Regression: Signal and Noise. Make the Step 1 prediction first, then move the slope and the scatter and watch SS explained, SS residual, R², and F update together. It is the ANOVA playground from Chapter 17 with a line in place of the group means.

NoteInterpret the Output

Read this output carefully. The R code that produced it is not shown.


Call:
lm(formula = sleep_hours ~ screen_time, data = sleep_df)

Residuals:
     Min       1Q   Median       3Q      Max 
-1.83419 -0.59227  0.01496  0.50272  2.06496 

Coefficients:
            Estimate Std. Error t value Pr(>|t|)    
(Intercept)  9.21247    0.23076  39.922  < 2e-16 ***
screen_time -0.25106    0.07492  -3.351  0.00142 ** 
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.8257 on 58 degrees of freedom
Multiple R-squared:  0.1622,    Adjusted R-squared:  0.1477 
F-statistic: 11.23 on 1 and 58 DF,  p-value: 0.001422
  1. What is the outcome variable? What is the predictor?
  2. Interpret the slope in plain language. Use the units of measurement (hours per unit of screen time).
  3. Is the model statistically significant? How do you know?
  4. What proportion of variance in sleep hours does screen time explain?
  5. Write one APA 7 sentence for the slope result, including \(R^2\).
  6. A classmate says “the intercept means people with zero screen time sleep 9.21 hours.” Is this a meaningful interpretation? Why or why not?
  7. Can you conclude that reducing screen time causes more sleep? What design feature would be needed to support a causal conclusion?

22.7 Effect size

For simple regression, the effect size is \(R^2\). Interpretation (rough):

\(R^2\) Effect size
.01 Small
.09 Medium
.25 Large

These thresholds are simply the squares of Cohen’s r benchmarks (.10, .30, .50 → .01, .09, .25). They are not the \(f^2\)-based cutoffs: Cohen’s \(f^2\) conventions (.02, .15, .35) correspond to \(R^2 \approx\) .02, .13, .26.

You can also report Pearson’s \(r\) — the square root of \(R^2\), with the sign of the slope — which most readers understand without translation.

22.8 Reporting

A simple linear regression was conducted to predict teen birth rate from state poverty rate across the 50 states and Washington, D.C. The model was statistically significant, F(1, 49) = 47.95, p < .001, \(R^2\) = .49, indicating that poverty rate explained 49% of the variance in teen birth rate. The slope was significant, b = 2.03, SE = 0.29, 95% CI [1.44, 2.61], t(49) = 6.93, p < .001, indicating that each 1 percentage-point increase in poverty rate was associated with an increase of 2.03 births per 1,000 females aged 15–19.

Conventions:

  • Italicize F, p, R, b, SE, t.
  • Report p to three decimals; everything else to two.
  • For unstandardized slope use b (lowercase italic); for standardized slope use \(\beta\) (Greek beta).
  • Always report the F-test result before the slope.

22.9 Assumptions

Simple regression makes four core assumptions, all about the residuals:

  1. Linearity — the relationship between X and Y is actually linear. Check with a scatterplot before fitting; check with the Residuals vs. Fitted diagnostic plot after.
  2. Independence of residuals.
  3. Normality of residuals.
  4. Homoscedasticity (constant variance) of residuals across the range of X.

The four-panel plot(model) output checks linearity, normality, and constant variance (plus influential points). Independence comes from the study design, not a plot. See Chapter 25 for the detailed walkthrough.

ImportantCommon Misconception: regression establishes causation

A significant slope means X is a reliable predictor of Y in this sample — not that X causes Y. The same data support a model where Y predicts X, or where both are driven by a third variable. Causal claims require experimental design, not statistical method.

22.10 Tips for interpretation

  1. Focus on p-values for inference, but report effect sizes (\(R^2\) or \(r\)) for the magnitude.
  2. The slope is what your audience cares about — it’s the substantive finding.
  3. The intercept is only meaningful when X = 0 is meaningful. Sometimes you’ll see analysts center X (subtract its mean) so the intercept is the predicted Y at the average X.
  4. \(R^2\) explains variance, not strength of relationship per se. A high-noise outcome can have a real, practically important slope and still produce \(R^2\) = .10.

22.11 Common mistakes

Wrong Right
Treating the overall F and the slope test as two pieces of evidence In simple regression they are one test (\(t^2 = F\)). Report both if you like, but the second tells you nothing new
Reporting just the p-value without the slope Always report the slope (\(b\)) and its 95% CI
Implying causation from a regression Regression alone doesn’t establish causation — same caveat as correlation
Extrapolating beyond the data Your model is reliable within the range of X you observed; extrapolation is risky
Forgetting to plot first Always inspect the scatter before fitting

22.12 Quick reference

Element R code
Fit simple regression model <- lm(y ~ x, data = data)
Summary table summary(model)
Coefficient confidence intervals confint(model)
Predicted values predict(model)
Residuals residuals(model)
Diagnostic plots par(mfrow = c(2, 2)); plot(model)
Visualize the line geom_smooth(method = "lm") in ggplot
TipReporting checklist for simple regression

22.13 The same test, different disciplines

Simple regression applies wherever you want to predict a continuous outcome from a single continuous predictor.

Discipline Typical prediction Predictor → Outcome
Psychology One psychological or behavioral predictor Hours studied → exam score; attachment style → relationship satisfaction
Biology One physiological or environmental predictor Temperature → enzyme activity; body mass → metabolic rate
Sociology One social or economic predictor Years of education → income; poverty rate → crime rate

Next: what happens when your predictor is categorical instead of continuous.


TipChapter Summary

Core idea: Simple regression predicts a continuous outcome (Y) from a continuous predictor (X). The slope tells you how much Y changes for a one-unit increase in X. The intercept is only meaningful when X = 0 is a real, interpretable value.

You should understand:

  • What the slope (b) and intercept mean in plain language
  • Why R² is not the same thing as the correlation coefficient r (though they are related: R² = r² for simple regression)
  • Why you check residuals for normality — not the raw Y variable
  • Why a significant slope does not imply causation

You should be able to do in R:

  • Fit the model: model <- lm(Y ~ X, data = data)
  • Summary: summary(model) — look for slope, p-value, R²
  • Diagnostic plots: plot(model)
  • Confidence intervals: confint(model)

Plain-language check: A regression gives b = 0.42, t(58) = 3.1, p = .003, R² = .14. Write one sentence interpreting the slope and one sentence interpreting R².

The one mistake to avoid: Extrapolating predictions beyond the range of your observed X values. The model is calibrated to your data; outside that range, the relationship may not hold.

Practice: Using the built-in cars dataset, regress stopping distance (dist) on speed (speed). What is the slope? What does it mean in plain language? What proportion of variance in stopping distance does speed explain?

Key terms from this chapter are defined in the Glossary.

NoteBaby Dataset Assignment

Practice the skills from this chapter using real data: Assignment 2 — Correlation and Simple Regression

TipWork through it with a partner

One interactive module covers this chapter. It is worked in pairs, with R alongside the page, and printed to PDF to hand in.

  • Regression: Signal and Noise — move the slope and the scatter, watch the variation split into explained and leftover, and see why R² measures how tightly points hug the line, not how steep it is.

Modules open in a new tab.