a. Hypothesis Test for the Slope
Math 115
Topic 17 fit a line to a sample: \hat{y} = b_0 + b_1 x. Behind that sample sits a population, where every individual follows
y = \beta_0 + \beta_1 x + \varepsilon
\beta_0 and \beta_1 are the population intercept and slope — fixed, unknown, never observed. \varepsilon is how far one individual falls above or below that line.
b_0 and b_1 estimate \beta_0 and \beta_1. A different sample gives different estimates — so what can one sample’s b_1 tell us about \beta_1? That question is inference for the slope.
A different population — this time x tells you nothing about y:
Try it — in y = \beta_0 + \beta_1 x + \varepsilon, what must \beta_1 be?
\beta_1 = 0, and the model collapses to y = \beta_0 + \varepsilon. x is gone from the equation. Every x gives the same predicted y, so the population line is flat. Here \beta_0 = 50.
Draw a sample of 20 from that population — the one where \beta_1 = 0.
Same population every time, with \beta_1 = 0. But the sample slope b_1 never comes out zero.
So the question: is b_1 far enough from zero to rule out \beta_1 = 0?
Research question: Is the price of dinner at an NYC Italian restaurant related to its food-quality rating?
Fitted line: \widehat{Price} = -17.8 + 2.94 \times Food — higher ratings track higher prices. But is there a linear relationship between food rating and price in the population, or is b_1 just sampling noise?
Try it — the research question is whether food rating is related to price. Write H_0 and H_A in terms of \beta_1.
H_0: \beta_1 = 0 — the true slope is zero; a restaurant’s food rating tells you nothing about its price, linearly.
H_A: \beta_1 \neq 0 — there is a linear relationship; food rating and price move together.
Two-sided is the default. One-sided versions (\beta_1 > 0 or \beta_1 < 0) exist when the research question commits to a direction.
Same T-statistic shape we’ve used since topic 11:
T = \frac{\text{statistic} - \text{null value}}{SE} = \frac{b_1 - 0}{SE_{b_1}} = \frac{b_1}{SE_{b_1}}
Software reports b_1 and SE_{b_1} — you can always verify T by hand.
Reference distribution: under H_0, T follows a t-distribution with
df = n - 2
Why n - 2? Fitting the line uses up two degrees of freedom — one for the intercept b_0, one for the slope b_1.
Four conditions for the t-distribution to be a valid reference for T:
| Condition | Rule | Check with |
|---|---|---|
| Linearity | True relationship between x and y is approximately linear. | Residual plot |
| Constant variance | Residual spread is about the same across all \hat{y}. | Residual plot |
| Normality | n \geq 30: mild skew is fine, but no extreme outliers. n < 30: residuals should look roughly normal. | Residual plot |
| Independence | Observations are independent of each other. | Study design |
Conditions met — proceed with the t-test.
The regression output (Jamovi):
| Term | Estimate (b) | Std. Error (SE) | T | p-value |
|---|---|---|---|---|
| (Intercept) | -17.83 | 5.863 | -3.04 | 0.003 |
| Food | 2.94 | 0.283 | 10.37 | < 0.001 |
Read the Food row (the slope):
The output gives you b_1 and SE_{b_1}. You should always be able to compute T yourself — the software is just doing the arithmetic.
Recall: b_1 = 2.94, SE_{b_1} = 0.283. Try it: compute T and compare to the output.
T = \dfrac{b_1}{SE_{b_1}} = \dfrac{2.94}{0.283} \approx 10.39 — matches the output’s T = 10.37 (the tiny difference is rounding) ✓. The slope sits more than 10 standard errors above zero.
Two-sided p-value = 2 × (smaller-tail area) ≈ < 0.0001 — software reports < 0.001.
Results: T = 10.37, df = 166, p-value < 0.001 → reject H_0.
In context: there is convincing evidence that food-quality rating is associated with meal price at NYC Italian restaurants. Higher food ratings are associated with higher prices.
Scope of inference.
The slope is statistically distinguishable from zero, but how big is the population slope? “More than zero” is a weak summary — we’d like a range of plausible values.
Next (18b): the matching confidence interval for \beta_1 — same b_1, same SE_{b_1}, same t-critical-value machinery as topic 11b, applied to the regression slope.
restNYC data.)