- A sample regression slope \(b\) is only an estimate of the true population slope \(\beta\). The t-test for slope asks whether \(\beta\) could plausibly be zero, meaning no linear relationship in the population.
- The test statistic is \(t = b / SE_b\), where \(SE_b = s/\sqrt{S_{xx}}\) and \(s\) is the standard deviation of the residuals. Compare it with a t distribution on \(n – 2\) degrees of freedom.
- In our case, 12 adults give \(b = -1.40\) beats per minute per weekly hour of exercise, \(SE_b = 0.247\), \(t = -5.67\), df = 10 and \(p \approx 0.0002\): strong evidence of a negative linear relationship.
- The matching 95% confidence interval is \(b \pm t^{*}SE_b = -1.40 \pm 0.55\), or about \(-1.95\) to \(-0.85\) beats per minute per hour.
- Exam point: check the conditions (linear, independent, normal residuals, equal spread, random) before the test, and conclude about \(\beta\), in context, not about \(b\).
The case: does more exercise go with a lower resting heart rate?
A health researcher selects 12 adults at random from members of a community sports centre. Each one reports their average hours of exercise per week, and a nurse measures their resting heart rate in beats per minute (bpm):
| Adult | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Exercise (hours/week), \(x\) | 0 | 1 | 1 | 2 | 3 | 3 | 4 | 5 | 5 | 6 | 7 | 8 |
| Resting heart rate (bpm), \(y\) | 78 | 74 | 76 | 71 | 72 | 74 | 75 | 71 | 68 | 66 | 66 | 67 |
The least-squares line is \(\hat y = 76.76 – 1.40x\). In this sample, each extra weekly hour of exercise goes with a resting heart rate about 1.4 bpm lower. (The figures are illustrative.)
But this is only 12 people. A different random sample of 12 would give a different slope. Could the true slope for all members be zero, with this sample’s pattern produced by chance? And if the slope is not zero, how big is it likely to be? Those are questions of inference, and they are answered by the t-test and confidence interval for the slope.
The concept: the slope as an estimate
Inference for regression starts with a model for the population. For each value of \(x\), the responses \(y\) vary around a true mean that lies on a straight line:
Here \(\beta\) (beta) is the population slope and \(\alpha\) is the population intercept. We never see them. The sample line \(\hat y = a + bx\) estimates them. If we took many random samples, the sample slopes \(b\) would vary around \(\beta\). Under the conditions listed below, their sampling distribution is approximately normal, with a standard deviation that we estimate by the standard error of the slope, \(SE_b\).[1]
The null hypothesis is usually \(H_0: \beta = 0\). A slope of zero means the mean of \(y\) does not change with \(x\): no linear relationship. If our sample slope is many standard errors away from zero, that would be very surprising under \(H_0\), so we reject it.
Here \(b\) is the sample slope and \(SE_b\) is its standard error. \(s\) is the standard deviation of the residuals: the typical distance of a point from the line. \(S_{xx} = \sum (x – \bar x)^2\) measures how spread out the \(x\) values are. \(n\) is the number of data pairs, and the degrees of freedom are \(n – 2\) because two parameters (slope and intercept) were estimated. The formula shows that the slope is estimated more precisely when the points lie close to the line (small \(s\)) and when the \(x\) values are widely spread (large \(S_{xx}\)).[2]
The matching confidence interval for \(\beta\) is
where \(t^{*}\) is the critical value from the t distribution with \(n – 2\) degrees of freedom (for 95% confidence and df = 10, \(t^{*} = 2.228\)). Computer output usually gives \(b\), \(SE_b\), \(t\) and the p-value in one row, so in exams you may only need to read and interpret them.
Why this method fits the case
The t-test for slope is the right tool because the researcher wants to generalise from a sample of pairs to a population relationship. Before using it, check the five conditions, often remembered as LINER:[3]
- Linear: the scatterplot shows a roughly straight pattern, and the residual plot shows no curve. Here the residuals have signs + − + − − + + + − − − +, with no U-shape.
- Independent: each adult’s measurements do not affect another’s. The 12 are sampled from a large membership (far more than 10 × 12 = 120 people), so independence is reasonable.
- Normal: the residuals should be roughly normal. A dot plot of the 12 residuals (from −2.95 to 3.85) is roughly symmetric with no outliers.
- Equal spread: the residual plot shows roughly the same vertical spread across all values of \(x\), with no fan shape.
- Random: the adults were randomly selected.
It is not the right tool when:
- The residual plot shows a curve; the slope of a straight line is then not a meaningful summary.
- The data are not from a random sample or randomised experiment, so there is no population to generalise to.
- You want to show cause and effect from observational data. A significant slope shows association, not causation.
- There are several explanatory variables. That needs multiple regression, which is beyond this post.
Setting it up
Let \(\beta\) be the true slope of the population regression line of resting heart rate on weekly exercise hours, for all members of the sports centre. The hypotheses are
The summary statistics are:
| Quantity | Value |
|---|---|
| \(n\) | 12 |
| \(\bar x\), \(\bar y\) | 3.75 hours, 71.5 bpm |
| \(S_{xx}\) | 70.25 |
| \(S_{xy}\) | −98.5 |
| \(S_{yy}\) | 181 |
| Slope \(b = S_{xy}/S_{xx}\) | −1.4021 |
| Intercept \(a = \bar y – b\bar x\) | 76.758 |
| Sum of squared residuals \(\sum e^2\) | 42.890 |
| Degrees of freedom | \(n – 2 = 10\) |
| Significance level | \(\alpha = 0.05\) |
A shortcut for the sum of squared residuals is \(\sum e^2 = S_{yy} – S_{xy}^2/S_{xx} = 181 – 9702.25/70.25 \approx 181 – 138.11 = 42.89\), which avoids computing every residual.
Solving it
Carry out the t-test for slope at the 5% significance level.
There is convincing evidence of a negative linear relationship between weekly exercise and resting heart rate for members of this sports centre.
Construct and interpret a 95% confidence interval for \(\beta\).
We are 95% confident that, for members of this centre, each extra weekly hour of exercise is associated with a mean resting heart rate between about 0.85 and 1.95 bpm lower.
Regression software prints the following for a study of 20 randomly chosen flats, with \(x\) = floor area (m²) and \(y\) = monthly rent (£). Test whether rent is linearly related to floor area. (The figures are illustrative.)
| Predictor | Coef | SE Coef | T | P |
|---|---|---|---|---|
| Constant | 310.5 | 95.2 | 3.26 | 0.004 |
| Area | 9.84 | 1.52 | 6.47 | 0.000 |
There is very strong evidence that rent rises with floor area; each extra square metre adds roughly £7 to £13 to the mean monthly rent.
What the answer tells us
Figure 1 shows where our test statistic falls. If the population slope were zero, \(t\) would follow the t distribution with 10 degrees of freedom shown below. Values beyond ±2.228 would happen only 5% of the time. Our \(t = -5.67\) is far into the left tail.
Interpreting the result. The test says the negative slope is very unlikely to be a fluke of sampling. The interval says how big the effect plausibly is: about 0.85 to 1.95 bpm per weekly hour. Both statements are about the population of sports-centre members, because that is where the random sample came from.
What it does not say. This is an observational study. People who exercise more may also differ in diet, age or smoking. A significant slope does not prove that exercise causes lower heart rates; only a randomised experiment could show that. See our post on correlation vs causation.
Reasonableness check. The t statistic can also be found from the correlation: \(t = r\sqrt{(n-2)/(1-r^2)}\). Here \(r = -0.874\), so \(t = -0.874 \times \sqrt{10/0.237} \approx -5.67\), matching our answer. Testing \(\beta = 0\) is the same as testing whether the population correlation is zero.[4]
Sensitivity to sample size. Suppose the researcher had stopped after the first six adults (0 to 3 hours). The slope is similar, \(b \approx -1.59\), but with so few points and a narrow range of \(x\), \(SE_b \approx 0.70\). Then \(t \approx -2.28\) with df = 4, and the two-sided p-value is about 0.085, not significant at 5%. Fewer points and less spread in \(x\) both make \(SE_b\) bigger. To estimate a slope precisely, collect more data and spread the \(x\) values widely.
For the full picture of regression, from scatterplots to inference, the Statistics Made Simple textbook explains each step with worked examples and annotated computer output. To practise reading output, checking conditions and writing conclusions, try the Statistics Made Simple Practice Questions book, where every inference question is fully worked.
Practice questions
Use \(\alpha = 0.05\) unless told otherwise.
EasyQ1. For a random sample of 20 pairs, the regression slope is \(b = 2.35\) with \(SE_b = 0.80\). Find the test statistic and degrees of freedom for testing \(H_0: \beta = 0\). Show worked answer
df \(= 20 – 2 = 18\).
(The two-sided p-value is about 0.009, so \(H_0\) would be rejected.)
EasyQ2. A regression uses 15 data pairs. State the degrees of freedom and the critical value \(t^{*}\) for a 95% confidence interval for \(\beta\). Show worked answer
\(t^{*} = 2.160\) (from t tables, 0.025 in each tail).
MediumQ3. A study of 22 towns gives a slope of 0.48 (extra cafés per 1,000 residents per £1,000 of median income) with \(SE_b = 0.12\). Construct a 95% confidence interval for \(\beta\) and interpret it. Show worked answer
Margin: \(2.086 \times 0.12 \approx 0.250\).
Interval: \(0.48 \pm 0.25 = (0.23,\ 0.73)\).
We are 95% confident that each extra £1,000 of median income is associated with between 0.23 and 0.73 more cafés per 1,000 residents, on average. The interval excludes 0, so there is evidence of a positive linear relationship.
MediumQ4. Data: \(x\) = 2, 4, 6, 8, 10 and \(y\) = 5, 9, 10, 14, 17, with \(b = 1.45\), \(S_{xx} = 40\) and \(\sum e^2 = 1.90\). Calculate \(s\), \(SE_b\) and \(t\). Show worked answer
\(SE_b = 0.796/\sqrt{40} = 0.796/6.325 \approx 0.126\).
\(t = 1.45/0.126 \approx 11.5\), df = 3. The two-sided p-value is about 0.001, so the slope is significant.
ExamQ5. An economist regresses monthly household spending on eating out (£, \(y\)) on monthly household income (£ hundred, \(x\)) for a random sample of 25 households. Output gives slope \(b = 3.12\) and \(SE_b = 1.40\). (a) State hypotheses to test whether spending increases with income. (b) Calculate the test statistic and find the p-value. (c) State your conclusion at the 5% level. (d) Construct a 95% confidence interval for \(\beta\). (e) Name two conditions that must be checked and how. [9] Show worked answer
(b) \(t = 3.12/1.40 \approx 2.23\), df \(= 23\). [1] One-sided p-value \(= P(t_{23} > 2.23) \approx 0.018\). [1]
(c) \(0.018 < 0.05\): reject \(H_0\). There is convincing evidence that eating-out spending increases with income. [1]
(d) \(t^{*} = 2.069\) (df = 23); \(3.12 \pm 2.069 \times 1.40 = 3.12 \pm 2.90\), so about (0.22, 6.02) pounds per £100 of income. [2]
(e) Any two, with method: linearity (residual plot with no curve) [1]; equal spread (residual plot with no fan) / normal residuals (histogram or normal plot of residuals roughly symmetric, no outliers) / independence (sample under 10% of population) [1]. [1 for method]
Frequently asked questions
Why are there n − 2 degrees of freedom?
Because two quantities, the slope and the intercept, are estimated from the data before the residuals are calculated. Each estimate uses up one degree of freedom, leaving \(n – 2\) for estimating the spread of the points around the line.
Is the t-test for slope the same as testing the correlation?
Yes, for simple linear regression. Testing \(H_0: \beta = 0\) gives exactly the same t statistic and p-value as testing whether the population correlation is zero, using \(t = r\sqrt{(n-2)/(1-r^2)}\).
Can I test whether the slope equals a value other than zero?
Yes. Use \(t = (b – \beta_0)/SE_b\), where \(\beta_0\) is the hypothesised value. For example, an economist might test whether a slope equals 1. The degrees of freedom are still \(n – 2\).
What if the conditions are not met?
If the residual plot is curved, try transforming a variable and refitting. If there are outliers, investigate them and report results with and without them. If the sample is not random, the test result does not generalise to a population. Our hypothesis testing guide covers the general logic of tests and p-values.
References
- Illowsky, B. & Dean, S. (2023) Introductory Statistics 2e. Houston, TX: OpenStax. https://openstax.org/details/books/introductory-statistics-2e
- Moore, D. S., McCabe, G. P. & Craig, B. A. Introduction to the Practice of Statistics. New York: W. H. Freeman.
- Starnes, D. S. & Tabor, J. The Practice of Statistics. New York: W. H. Freeman.
- Agresti, A., Franklin, C. & Klingenberg, B. Statistics: The Art and Science of Learning from Data. Boston: Pearson.
- College Board. AP Statistics Course and Exam Description. New York: College Board.

