Prob and StatsInference

Inference for the Slope of a Regression Line

Test and estimate the true slope from sample data.

Not started Jump to practice

A least-squares line fitted to a sample is an estimate. Another sample would give a different slope. Interpreting a slope is only half the job; we also need to know how much it could vary, and whether a "relationship" might be nothing but chance. This lesson uses the t procedures you already know, and it is the doorway to econometrics.

Key idea

Model: $y = \alpha + \beta x + \varepsilon$, where $\beta$ is the true slope. The sample slope $b$ has standard error $SE_b$ (from software). To test $H_0: \beta = 0$ (no linear relationship): $t = \frac{b}{SE_b}$ with $df = n - 2$. A confidence interval for $\beta$: $b \pm t^* SE_b$. Conditions: linear form, independent observations, roughly normal residuals with equal spread, random sample or experiment.

Why it works

Imagine drawing many samples from the same population and fitting a line to each. The slopes $b$ pile up around the true slope $\beta$, with a spread that shrinks with more data and with x-values that are more spread out (a wide base makes a line steadier). $SE_b$ estimates that spread. Standardizing, $(b - \beta)/SE_b$ follows a t distribution, with $n - 2$ degrees of freedom because two numbers, the intercept and the slope, were estimated from the data before the residual spread could be measured.
A sample and its least-squares line. Drag a few points: the slope moves, just as it would from sample to sample.
Typical software output, for n = 20 observations.
PredictorCoefficientSEtp
Constant12.03.13.870.001
hours of practice2.40.83.000.008

Worked example: Reading the output

Use the output for $n = 20$ players (score against hours of practice). Test $H_0: \beta = 0$.
  1. $t = \dfrac{b}{SE_b} = \dfrac{2.4}{0.8} = 3.0$ with $df = 20 - 2 = 18$.
  2. The two-sided p-value is about $0.008$ (the output's "p" column).
  3. $0.008 < 0.05$: reject $H_0$. There is convincing evidence of a positive linear relationship between practice and score in the population.

Answer: t = 3.0, p ≈ 0.008.

Worked example: An interval for the slope

Build a 95% confidence interval for $\beta$. ($t^* = 2.101$ for 18 df.)
  1. $2.4 \pm 2.101 \times 0.8 = 2.4 \pm 1.68$.
  2. From about $0.72$ to $4.08$ points per hour.
  3. Each extra hour of practice is associated with between about 0.7 and 4.1 more points, on average. The interval excludes 0, matching the test.

Answer: $(0.72, 4.08)$

Worked example: No convincing evidence

Another regression with $n = 20$ has $b = 0.5$ and $SE_b = 0.4$. What do you conclude?
  1. $t = 0.5/0.4 = 1.25$, df $= 18$; two-sided p-value about $0.23$.
  2. Fail to reject: the sample slope could easily come from a population with no linear relationship.

Answer: Not convincing evidence.

Common mistake

Two overreaches. A significant slope from observational data does not prove that x causes y (lurking variables still apply), and failing to reject does not prove the slope is 0, only that this sample cannot tell. Check what was randomized, and phrase conclusions about the population slope.
The econometrics course picks up exactly here: Inference in Regression shows thousands of sample slopes piling up around the true one, then multiple regression adds more x-variables.

Practice

Pass with 3 right answers, the last 2 in a row. Each right answer earns 3 XP.

Loading practice…

Builds on

Leads to

This is one of the top rungs of Probability and Statistics.

Sources and further reading

  • OpenStax, Introductory Statistics 2e, section 12.4 Testing the Significance of the Correlation Coefficient
  • OpenStax, Introductory Statistics 2e, section 12.3 The Regression Equation
@teddyrookbook GitHub