From a Slope Estimate to a Test Statistic
A fitted regression line gives a sample slope, but a sample slope varies from sample to sample. To assess whether the data are compatible with a specified population slope, we compare the estimated slope with the hypothesized value relative to the estimate’s standard error. The resulting t statistic measures the difference in standard-error units. Its p-value tells us how unusual a statistic at least as extreme would be if the null hypothesis and the regression model were correct.
This tutorial focuses on carrying out that calculation and interpreting its result. The regression-slope inference material already establishes the linear model conditions, how to calculate the slope standard error, and why the test uses \(n-2\) degrees of freedom. We will state the relevant assumptions before using the test, then apply the calculation to hypothetical examples.
Model and Hypotheses Before Calculating
The usual exact t procedure assumes a simple linear regression model in which the mean response changes linearly with the predictor, observations are independent, and errors have constant variance and a normal distribution around the regression line. The model is commonly written \(Y_i=\beta_0+\beta_1x_i+\varepsilon_i\), where \(\varepsilon_i\) is the error for observation \(i\). The predictor values are treated as fixed, or the analysis is understood conditionally on the observed predictor values. The way observations were sampled or assigned must also support the intended inference.
Under these conditions, the estimated slope is centered at the population slope, and its standard error measures the sampling variability of that estimate. If the null hypothesis specifies \(\beta_{1,0}\), subtracting that value and dividing by the standard error places the observed difference on a common scale. Under \(H_0\), the resulting statistic follows a t distribution with \(n-2\) degrees of freedom. This tutorial uses that distribution; it does not replace checking whether the model conditions are reasonable.
The alternative hypothesis determines which outcomes count as evidence against the null. For a two-sided alternative \(H_a:\beta_1\ne\beta_{1,0}\), values far from zero in either direction count, so the p-value is the probability of a t statistic whose absolute value is at least the observed absolute value. For an upper-sided alternative, the relevant probability is the upper tail; for a lower-sided alternative, it is the lower tail. The alternative must be the one specified for the test, not selected to fit the observed sign.
Why the Statistic Is Standardized This Way
The numerator \(b_1-\beta_{1,0}\) is the observed distance between the sample slope and the null value. A distance alone is hard to judge: a difference of 0.5 slope units might be substantial when the standard error is 0.1, but modest when the standard error is 1. The standard error provides the scale for comparison.
The standardization follows directly from dividing the difference by its estimated sampling spread. If the standard error is \(SE(b_1)\), then a difference equal to one standard error gives \(t=1\), a difference of two standard errors gives \(t=2\), and a difference below the null value gives a negative t statistic. The reference t distribution accounts for the uncertainty involved in estimating the error variance from the regression data.
The calculation itself is the same for any specified null slope. What changes from test to test is the null value, the alternative, the sample size and hence the degrees of freedom, and the direction or directions of the p-value tail.
Worked Calculations
Worked Example: A Two-Sided Test With 18 Degrees of Freedom
Suppose a hypothetical study records weekly practice time \(x\), in hours, and a performance score \(y\), in points, for \(n=20\) participants. The estimated slope is \(b_1=0.70\) points per hour, with \(SE(b_1)=0.3571\) points per hour. The stated test is \(H_0:\beta_1=0.20\) against \(H_a:\beta_1\ne0.20\). Assume the sampling design and regression diagnostics support the model conditions stated above.
The degrees of freedom are \(n-2=20-2=18\). The observed statistic is
Because the alternative is two-sided, the p-value includes outcomes at least as far from zero in either direction:
If the significance level is \(\alpha=0.05\), then \(0.1785>0.05\), so this test does not reject \(H_0\). The data do not provide strong evidence that the population slope differs from 0.20 points per hour. This result does not establish that the slope equals 0.20; it says that this sample does not give sufficiently unusual evidence against that specified value at the chosen level.
Worked Example: A Small Sample and a Two-Sided P-Value
In a separate hypothetical regression, researchers relate a laboratory measurement \(y\), in units, to a dose \(x\), in milligrams. There are \(n=9\) observations. The estimated slope is \(b_1=1.20\) units per milligram, and its standard error is \(SE(b_1)=0.3333\) units per milligram. Test \(H_0:\beta_1=0.40\) against \(H_a:\beta_1\ne0.40\). For this example, assume the data collection supports independent observations and the regression model conditions are reasonable.
There are \(n-2=9-2=7\) degrees of freedom. The difference between the estimate and the null slope is \(1.20-0.40=0.80\) units per milligram, so
For the stated two-sided alternative, the p-value is
At \(\alpha=0.05\), \(0.04747<0.05\), so the test rejects \(H_0\). Under the model and null hypothesis, a t statistic at least this far from zero in either direction would occur with probability about 0.04747. In context, the observations provide evidence that the population slope relating dose to the laboratory measurement differs from 0.40 units per milligram. The result alone does not show that dose causes the measurement to change.
Worked Example: A Negative Estimate Under a Zero-Slope Null
Suppose a hypothetical sample of \(n=12\) adults is used to relate a sleep measure \(y\), in points, to nightly screen time \(x\), in hours. The fitted slope is \(b_1=-0.80\) points per hour and \(SE(b_1)=0.40\) points per hour. Test \(H_0:\beta_1=0\) against the two-sided alternative \(H_a:\beta_1\ne0\). Assume the study design and model checks support the conditions for this t procedure.
The degrees of freedom are \(12-2=10\). The t statistic retains the negative sign because the estimate is below the null value:
For a two-sided test, a statistic of \(-2.00\) is as extreme as \(+2.00\); both tails are counted. Thus
At the 0.05 significance level, the p-value is larger than \(\alpha\), so the test does not reject the zero-slope null. Although the estimated relationship in this sample is negative, the test does not provide sufficiently strong evidence at this level that the population slope differs from zero. The p-value is not a measure of the probability that the observed direction is correct.
A Reliable Calculation Sequence
Write \(H_0:\beta_1=\beta_{1,0}\) and the given alternative. Confirm that the alternative identifies the correct tail or tails.
Ensure the sampling or assignment supports the inference and the simple linear regression conditions are appropriate for the t procedure.
Substitute \(b_1\), \(\beta_{1,0}\), and \(SE(b_1)\) into the formula, and compute \(df=n-2\).
Use the t distribution with the calculated degrees of freedom and the tail area specified by \(H_a\). Compare the p-value with \(\alpha\) and state the conclusion about the population slope in context.
Common Mistakes and Why the P-Value Matters
The t statistic and p-value answer related but distinct questions. The statistic records the signed distance from the null in estimated standard errors. The p-value translates that statistic into a probability under the null reference model, taking account of the degrees of freedom and alternative hypothesis. A statistic of 2.4 does not have one universal p-value: the p-value depends on the t distribution’s degrees of freedom and whether the test is one- or two-sided.
- Using the wrong difference. The numerator is the estimated slope minus the hypothesized slope, \(b_1-\beta_{1,0}\). Subtracting in the reverse order changes the sign and can lead to the wrong tail for a one-sided test.
- Ignoring the standard error. The difference between slopes is not itself the t statistic. It must be divided by \(SE(b_1)\), expressed in the same slope units.
- Using the wrong degrees of freedom. For this simple linear regression slope test, use \(n-2\), not \(n-1\). The fitted intercept and slope account for two estimated regression parameters.
- Counting just one tail for a two-sided alternative. If \(H_a:\beta_1\ne\beta_{1,0}\), equally extreme negative and positive statistics both count. The p-value is the probability involving \(|T|\), not just the upper-tail probability.
- Calling the p-value the chance the null is true. The p-value is computed under the null and describes the probability of a statistic at least as extreme as observed. It is not \(P(H_0\mid\text{data})\).
- Treating non-rejection as proof of equality. A large p-value means the test did not find sufficiently strong evidence against the specified null at the chosen significance level. It does not prove that the population slope equals the null value.
Slope tests matter because they put the observed regression trend into a sampling-uncertainty framework. A slope estimate alone describes the fitted sample; the test evaluates how compatible that estimate is with a particular population value. A correct conclusion reports the tested value, the direction of the alternative, and the interpretation in the units of the response per unit of predictor. It also keeps statistical evidence separate from a claim of cause and effect.
Check Your Understanding
For each question, identify the relevant calculation or interpretation before checking a calculator or t table.
- A simple regression uses \(n=16\), has \(b_1=2.1\), \(SE(b_1)=0.7\), and tests \(H_0:\beta_1=1.4\). What are the t statistic and degrees of freedom?
- For a two-sided test, why does the p-value for a negative observed t statistic include outcomes in both tails?
- A researcher reports \(p=0.03\) for a slope test. Explain what probability this represents under the null hypothesis and model.
- What is the degrees-of-freedom value for a simple regression slope test with \(n=25\) observations?
- A test fails to reject \(H_0:\beta_1=0\). Does this prove that the population slope is zero? Explain.