AP Statistics · Inference for quantitative data: slopes
Significance tests for slope
1Hypotheses for slope
To test whether there is a linear relationship between $x$ and $y$ in the population:
- $H_0: \beta = 0$ (no linear relationship: the mean of $y$ does not change with $x$).
- $H_a: \beta \ne 0$, $\beta > 0$ or $\beta < 0$.
Test statistic:
$$t = \frac{b - \beta_0}{SE_b} = \frac{b - 0}{SE_b}, \qquad df = n - 2$$
Check yourself
The usual null hypothesis for slope is:
Show the answer
β = 0
No linear relationship.
2Carrying out the test
a random sample of 20 shops gives this output for weekly sales (\$000) against advertising spend (\$00): slope $b = 2.4$, $SE_b = 0.6$. Test at $\alpha = 0.05$ whether there is a linear relationship.
- $H_0: \beta = 0$, $H_a: \beta \ne 0$, where $\beta$ = the true slope relating sales to advertising for all shops.
- Conditions (LINER): the scatterplot is roughly linear; the residual plot shows no curve or fanning; residuals roughly normal; random sample of fewer than 10% of shops.
- $t = \frac{2.4}{0.6} = 4.0$, $df = 18$.
- Two-sided P-value $\approx 0.0008$.
- $0.0008 < 0.05$: reject $H_0$. There is convincing evidence of a linear relationship between advertising and sales.
Computer output usually reports $t$ and a two-sided P-value; halve it for a one-sided test (if $b$ is in the direction of $H_a$).
The fitted slope, its 95% interval (dashed green) and the flat line H₀ claims
Check yourself
Output gives P = 0.034 (two-sided) for a slope with b > 0. The one-sided P-value for Hₐ: β > 0 is:
Show the answer
0.017
Halve it.
3Interpreting the results
- Rejecting $H_0$ shows a linear association; causation needs a randomised experiment.
- Failing to reject does not mean no relationship at all: there could be a curved relationship, or the sample may be too small.
- A significant slope is not the same as a strong relationship: with a large $n$, even a weak relationship (small $r^2$) can be significant.
for $n = 500$, $r = 0.12$, the slope test gives P ≈ 0.007. The relationship is statistically significant, but $r^2 = 0.014$: $x$ explains only 1.4% of the variation in $y$.
Check yourself
Failing to reject H₀: β = 0 means:
Show the answer
Not convincing evidence of a linear relationship
Not proof of none.
4Tests and intervals together
A 95% interval for $\beta$ that excludes 0 corresponds to rejecting $H_0: \beta = 0$ at $\alpha = 0.05$ (two-sided). The interval also shows how large the slope plausibly is.
$b = 2.4$, $SE_b = 0.6$, $df = 18$, $t^* = 2.101$: interval $2.4 \pm 1.26 = (1.14, 3.66)$. Each extra \$100 of advertising is associated with \$1,140 to \$3,660 more in mean weekly sales.
Check yourself
b = 1.5 and SE_b = 0.5 with n = 30. The t statistic is:
Show the answer
3.0
1.5/0.5.
5Going deeper: testing for a linear relationship, start to finish
The question: is there convincing evidence of a linear relationship between x and y in the population, or could the slope seen in the sample be due to chance?
Hypotheses
- H₀: β = 0: there is no linear relationship; x is of no use in predicting y with a line.
- Hₐ: β ≠ 0 (a linear relationship), or β > 0 (positive), or β < 0 (negative).
β is the slope of the true (population) regression line.
Test statistic
$$t = \frac{b - 0}{SE_b}, \qquad \text{df} = n - 2$$
Conditions: the same as for the interval: Linear, Independent, Normal (residuals), Equal standard deviation, Random.
From computer output: the T and P values in the row for the explanatory variable are for exactly this test, with a two-sided alternative.
- For a one-sided alternative, halve the P-value, provided the sample slope is in the direction of Hₐ.
a random sample of 20 students gives the regression output: Hours: Coef 6.0, SE Coef 1.5, T 4.00, P 0.001 (x = hours studied, y = exam score). The scatterplot is linear, the residual plot shows random scatter of roughly equal spread, and a dotplot of residuals shows no strong skewness or outliers. Is there convincing evidence of a positive linear relationship, at α = 0.05?
- State: H₀: β = 0; Hₐ: β > 0, where β = the slope of the true regression line relating exam score to hours studied.
- Plan: t test for the slope. Linear: scatterplot linear, no pattern in the residual plot. Independent: 20 students is less than 10% of all students. Normal: dotplot of residuals shows no strong skewness or outliers. Equal SD: residual plot shows similar scatter throughout. Random: random sample.
- Do: t = 6.0 ÷ 1.5 = 4.00; df = 18. Two-sided P-value from the output ≈ 0.001; one-sided P-value ≈ 0.0005.
- Conclude: since the P-value of about 0.0005 is less than 0.05, reject H₀. There is convincing evidence of a positive linear relationship between hours studied and exam score for students in this population.
Interpreting the P-value: "If there were no linear relationship between hours studied and exam score (β = 0), there would be about a 0.0005 probability of getting a sample slope of 6.0 or greater by chance."
Worked example (a non-significant result): another study of 15 people gives a slope of 0.42 with $SE_b$ = 0.35.
- t = 0.42 ÷ 0.35 = 1.20; df = 13.
- Two-sided P-value ≈ 0.25.
- Fail to reject H₀: there is not convincing evidence of a linear relationship. That is not proof that no relationship exists: the sample is small, and a non-linear relationship would not be detected by this test at all.
Link to the confidence interval: a two-sided test at α = 0.05 rejects H₀: β = 0 exactly when the 95% confidence interval for β does not contain 0. For the first example the interval was (2.85, 9.15): no zero, so significant.
Link to correlation: testing β = 0 is equivalent to testing whether the population correlation is 0. A slope of zero means r = 0.
Testing a slope other than zero: to test H₀: β = β₀, use $t = \frac{b - \beta_0}{SE_b}$. For example, to test whether each extra hour adds more than 2 points: t = (6.0 − 2) ÷ 1.5 = 2.67.
What the test does and does not tell you
- Significant means "we have evidence the slope is not zero." It does not mean the relationship is strong (check r²), nor that predictions are precise (check s).
- A large sample can make a tiny, useless slope significant.
- Association, not causation, unless the data come from a randomized experiment.
- The test addresses only linear relationships: always look at the scatterplot and residual plot first.
- Do not extrapolate beyond the range of x in the data.
Checklist for a free-response answer
- Hypotheses with β defined in context.
- Name of the test and conditions (or a statement that they are given as met).
- t, df and P-value, taken from the output where possible.
- Decision linked to α, and a conclusion in context about the population relationship.
Common mistakes
- Hypotheses about b (the sample slope) or about r.
- Using the "Constant" row.
- Forgetting to halve the P-value for a one-sided test, or halving when the alternative is two-sided.
- df = n − 1.
- Concluding that x causes y.
- "Accepting" that the slope is zero.
Check yourself
In a test of H₀: β = 0, regression output shows a slope of 2.4 with standard error 0.8. What is the test statistic?
Show the answer
3.0
t is the slope divided by its standard error.
6For top marks
- Define $\beta$ in context and state hypotheses with it.
- Check all LINER conditions using the plots provided.
- Read $b$, $SE_b$, $t$ and P from output correctly, noting that P is usually two-sided.
- Conclude in context about a linear relationship in the population; avoid causal language for observational data.
"Because P = 0.0008 < 0.05, we reject H₀. There is convincing evidence of a linear relationship between advertising spend and weekly sales for all shops in the chain."
Check yourself
A significant slope from an observational study shows:
Show the answer
A linear association, not causation
No random assignment.
Now test yourself
This lesson has a 8-question quiz and 5 exam-style questions with mark schemes in Impera. Free, with your progress saved.
Practise in Impera