Tutorials › Introduction to Statistics › Computing the Slope T Statistic and P-Value

Inference for the Regression Slope · Tutorial 903 of 996

Computing the Slope T Statistic and P-Value

Calculate a regression-slope t statistic and use its t distribution to obtain and interpret the p-value for a specified alternative.

Intermediate 9 min read

What You'll Learn

  • Identify the estimated slope, hypothesized slope, and slope standard error needed for the test statistic.
  • Calculate the slope t statistic as the estimate-minus-null difference divided by its standard error.
  • Use \(n-2\) degrees of freedom to locate the appropriate t distribution.
  • Match the p-value tail or tails to the stated alternative hypothesis.
  • Interpret a p-value in context without treating it as the probability that the null hypothesis is true.
  • Connect a test result to the chosen significance level without claiming that the data prove a slope value.

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.

Definition: Let \(\beta_1\) be the population regression slope, \(b_1\) the estimated sample slope, and \(SE(b_1)\) its standard error. To test \(H_0:\beta_1=\beta_{1,0}\), the slope t statistic is $$ t=\frac{b_1-\beta_{1,0}}{SE(b_1)}. $$ For the usual t test in simple linear regression, the reference distribution under \(H_0\) is a t distribution with \(df=n-2\) degrees of freedom.

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.

Key result: For a two-sided slope test, with \(T\sim t_{n-2}\) under \(H_0\), the p-value is $$ P\left(|T|\ge |t_{\text{obs}}|\right). $$ A p-value is calculated assuming the null hypothesis and model conditions hold. It is not the probability that \(H_0\) is true.

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.

$$ b_1-\beta_{1,0}=t_{\text{obs}}\,SE(b_1) \quad\Longrightarrow\quad t_{\text{obs}}=\frac{b_1-\beta_{1,0}}{SE(b_1)}. $$

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

$$ t_{\text{obs}} =\frac{0.70-0.20}{0.3571} =\frac{0.50}{0.3571} \approx 1.400. $$

Because the alternative is two-sided, the p-value includes outcomes at least as far from zero in either direction:

$$ p=P\left(|T|\ge1.400\right),\qquad T\sim t_{18} \approx 0.1785. $$

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

$$ t_{\text{obs}} =\frac{1.20-0.40}{0.3333} =\frac{0.80}{0.3333} \approx 2.400. $$

For the stated two-sided alternative, the p-value is

$$ p=P\left(|T|\ge2.400\right),\qquad T\sim t_7 \approx 0.04747. $$

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:

$$ t_{\text{obs}} =\frac{-0.80-0}{0.40} =-2.00. $$

For a two-sided test, a statistic of \(-2.00\) is as extreme as \(+2.00\); both tails are counted. Thus

$$ p=P\left(|T|\ge2.00\right),\qquad T\sim t_{10} \approx 0.07339. $$

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

1
State the test.
Write \(H_0:\beta_1=\beta_{1,0}\) and the given alternative. Confirm that the alternative identifies the correct tail or tails.
2
Check the setting.
Ensure the sampling or assignment supports the inference and the simple linear regression conditions are appropriate for the t procedure.
3
Calculate the statistic and degrees of freedom.
Substitute \(b_1\), \(\beta_{1,0}\), and \(SE(b_1)\) into the formula, and compute \(df=n-2\).
4
Find and interpret the p-value.
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.

Key takeaway: For a specified population slope, calculate \(t=(b_1-\beta_{1,0})/SE(b_1)\), use \(n-2\) degrees of freedom, and obtain the p-value from the tail or tails required by the stated alternative. Interpret that probability under the null and the model assumptions, not as the probability that the null is true.

Check Your Understanding

For each question, identify the relevant calculation or interpretation before checking a calculator or t table.

  1. 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?
  2. For a two-sided test, why does the p-value for a negative observed t statistic include outcomes in both tails?
  3. A researcher reports \(p=0.03\) for a slope test. Explain what probability this represents under the null hypothesis and model.
  4. What is the degrees-of-freedom value for a simple regression slope test with \(n=25\) observations?
  5. A test fails to reject \(H_0:\beta_1=0\). Does this prove that the population slope is zero? Explain.