Suppose that in the whole population there is no relationship: the true slope is β1=0. Draw a sample of 22 points and fit a line anyway. Random scatter will tilt it a little up or down. Repeat the sampling many times and the sample slopes form a distribution centered at 0, with spread SEb. The test asks whether your actual slope sits far out in that distribution.
Measure the distance in standard errors: t=SEbb−0. For b=2.3 and SEb=0.8, that gives t=2.875. Because SEb is estimated from the residuals, use the t distribution with df=n−2; two degrees of freedom are used up because the line estimated both a slope and an intercept. For n=22, df=20 and the two-sided p-value is about 0.009, so a slope this steep would be rare if β1 were 0.
The same pieces build a confidence interval, b±t∗SEb, with t∗=2.086 for 95% and df=20. That gives 2.3±1.67, about 0.63 to 3.97: a range of plausible true slopes that excludes 0, matching the test. All of this relies on the regression conditions: a straight-line pattern, independent observations, residuals with similar spread at every x, and roughly normal residuals.
Writing y^=a+bx for the sample is description, not inference; no test is needed to report the sample's own line. Inference begins when you claim something about the population the sample came from.
Think of it like this. Testing a slope is like checking whether a table is level by rolling a marble across it. A small drift might come from bumps in the wood, the random scatter; a steady roll toward one edge is a real tilt. The t-statistic compares the drift you saw with the drift that bumps alone usually produce.
Core idea. Inference for regression tests whether the population slope β1 differs from zero using a t-test on the sample slope.