---
title: "Simple Linear Regression and Inference on the Slope"
description: "Model the mean response with a line, estimate its coefficients by least squares, and test or form an interval for the slope under stated assumptions. Use residual patterns to check for curvature and u"
canonical: https://lightmysky.com/learn/mathematics/simple-linear-regression-and-inference-on-the-slope-mt_W2huNTKsMj
source: https://lightmysky.com/learn/mathematics/simple-linear-regression-and-inference-on-the-slope-mt_W2huNTKsMj.md
retrieved: 2026-11-12
---

> **Agent view.** This is the Markdown twin of the page, for tools and assistants.
> When to use this site, and the call that answers each job: https://lightmysky.com/agent-instructions.md
> API description (OpenAPI 3.1): https://lightmysky.com/openapi.json · Authentication: https://lightmysky.com/auth.md
> Pricing: https://lightmysky.com/pricing.md · Catalog: https://lightmysky.com/llms.txt · Full catalog: https://lightmysky.com/llms-full.txt
> Every machine-readable file on this domain: https://lightmysky.com/.well-known/ai-catalog.json
> Ask for Markdown with `Accept: text/markdown`, a `.md` address, or `?mode=agent`.

# Simple Linear Regression and Inference on the Slope

Model the mean response with a line, estimate its coefficients by least squares, and test or form an interval for the slope under stated assumptions. Use residual patterns to check for curvature and unequal spread.

Subject: Mathematics · Area: Data & Statistics · Ages 21 to 22
Page: https://lightmysky.com/learn/mathematics/simple-linear-regression-and-inference-on-the-slope-mt_W2huNTKsMj

## Ready when they can

- Write the model, state its error assumptions and estimate its coefficients by least squares
- Test whether a slope differs from zero and give an interval for it
- Read a residual plot for curvature and changing spread

## Lesson: Lines that learn from data

You have used fitted lines for prediction. The population model is y = a + bx + e. Here a + bx is the mean response at x; e is a random departure from that mean. Assume errors have mean zero at each x, constant variance and independence across observations. Exact t inference also assumes normally distributed errors at each x. The pooled response values need not be normally distributed.

Least squares minimises SSE, the sum of squared residuals. A residual is observed y minus fitted y. Let Sxx be the sum of (x minus mean x) squared, and Sxy the sum of (x minus mean x)(y minus mean y). When Sxx > 0, the slope estimate b1 = Sxy/Sxx. The intercept estimate is mean y minus b1 times mean x. Insert x into the fitted equation to calculate fitted y.

*(drawing: Multiply before adding the intercept. Find the residual by subtracting fitted y from observed y.)*

Different samples give different slope estimates. SE(b1) estimates their standard deviation. For H0: b = 0 against b != 0, use t = b1/SE(b1). With n observations, under H0 and the model assumptions, t follows a t distribution with n - 2 degrees of freedom. The two-sided p value is the probability under H0 of an absolute t at least as large as observed. Reject H0 if p < the chosen significance level; otherwise do not reject. Nonrejection does not establish a zero slope.

Under the assumptions, a 95% confidence procedure covers the fixed population slope in 95% of repetitions in the long run. A two-sided t interval for b is b1 plus or minus t* times SE(b1); choose t* using n - 2 degrees of freedom and the confidence level. Subtract and add the margin to b1, rounding endpoints last. A valid 95% interval excluding zero matches rejection in the two-sided 5% test. This is evidence, not proof; including zero does not establish a zero slope.

*(drawing: Use the supplied critical value to calculate the margin before finding both endpoints.)*

Plot residuals against x or fitted y. A clear curve suggests the linear mean model misses structure. A widening fan suggests increasing error variance. Investigate these warnings before relying on the usual t inference. A pattern-free plot does not verify all assumptions: check sampling design and observation order for dependence, and inspect normality separately. Normal errors are needed for exact t inference, not for calculating a least-squares fit.

Prediction outside the observed x range is extrapolation: the relationship may change there. Interpolation stays inside the range, but accuracy still depends on the model and data. At the same x and confidence level, a usual prediction interval for one new observation is wider than a confidence interval for the mean response. It includes uncertainty in the estimated mean and the new observation's random departure from it.

**Recap.** Model the line, test the slope, and let the residuals check your work.

*Lesson, questions and flashcards written for this dataset.*

## Practice

14 questions on this page, each with its working shown.

## Needs first

- [The Regression Line and Making Predictions](https://lightmysky.com/learn/mathematics/the-regression-line-and-making-predictions-mt_tsjctRmkyE)
- [One-Way Analysis of Variance](https://lightmysky.com/learn/mathematics/one-way-analysis-of-variance-mt_WYGK3Ktnqz)

## Optional connections

- [Orthogonal Projection and Least Squares](https://lightmysky.com/learn/mathematics/orthogonal-projection-and-least-squares-mt_kGvRrYJrat)

## Opens up

- [Galaxies, Redshift and the Expanding Universe](https://lightmysky.com/learn/science/galaxies-redshift-and-the-expanding-universe-mt_-POhqrng-Q)
- [Fitting a Model to Data: Least Squares, Chi-Square and Goodness of Fit](https://lightmysky.com/learn/science/fitting-a-model-to-data-least-squares-chi-square-and-goodness-of-fit-mt_NN0WYlp0md)
- [Multiple Regression and Model Diagnostics](https://lightmysky.com/learn/mathematics/multiple-regression-and-model-diagnostics-mt_TUx1tDF0jv)
