Tutorials › Introduction to Statistics › Worked Problems in Slope Tests and Intervals

Inference for the Regression Slope · Tutorial 920 of 996

Worked Problems in Slope Tests and Intervals

Learn to carry out and interpret complete tests and confidence intervals for a population regression slope.

Intermediate 9 min read

What You'll Learn

  • Set up hypotheses about a population regression slope.
  • Calculate a slope-test statistic and obtain its p-value from a t distribution.
  • Construct a confidence interval using the estimated slope and its standard error.
  • Check the relevant regression conditions before interpreting inference.
  • State conclusions in the predictor and response units, without confusing statistical and practical importance.

Putting Slope Inference Together

A regression slope summarizes how the mean response changes as a quantitative predictor increases. Inference about the population slope asks whether the observed sample slope is compatible with a specified population value, or how precisely the slope has been estimated. A complete analysis requires more than copying a number from a regression table: it identifies the model and hypotheses, checks the conditions for inference, calculates the statistic or interval, and gives a conclusion in the units of the variables.

The examples below use hypothetical regression summaries. In each case, the predictor values cover the range relevant to the question, and plots of the data and residuals show an approximately straight-line pattern, no conspicuous influential observations, and roughly constant residual spread. We also assume the observations are independent and the residual distribution is reasonably consistent with normality. These assumptions make the usual small-sample t inference appropriate; in an actual analysis, they must be justified from the study design and diagnostic evidence rather than inferred from the regression output alone.

Model and notation: In simple linear regression, the conditional mean response at predictor value \(x_i\) is modeled as \(\beta_0+\beta_1x_i\). The observed response is \(Y_i=\beta_0+\beta_1x_i+\varepsilon_i\), where the errors are independent, normally distributed with mean 0 and common variance \(\sigma^2\), conditional on the predictor values. The population slope \(\beta_1\) is the change in mean response for a one-unit increase in the predictor. The fitted sample slope is \(b_1\), and its standard error is \(SE(b_1)\). With \(n\) observations, the slope t procedures use \(df=n-2\).

The t procedures require a linear mean relationship, independent errors, constant error variance, and normally distributed errors for exact small-sample inference. A random sample supports generalization to a population; a randomized experiment can support causal interpretation if its design and conduct justify that claim. Neither a small p-value nor a slope interval by itself establishes causation.

Testing a Population Slope

A slope test compares a null value \(\beta_{1,0}\) with an alternative. The common test of whether there is a linear association in the population uses \(H_0:\beta_1=0\), but other null values can be tested as well. The test statistic measures how many estimated standard errors separate the observed slope from the null value.

Test statistic: For \(H_0:\beta_1=\beta_{1,0}\), calculate $$ t=\frac{b_1-\beta_{1,0}}{SE(b_1)}, \qquad df=n-2. $$ Under the null hypothesis and the regression assumptions, this statistic follows a t distribution with \(n-2\) degrees of freedom. The p-value is the probability, assuming the null hypothesis is true, of a test statistic at least as far in the direction specified by \(H_a\) as the observed statistic.

For a two-sided alternative, \(H_a:\beta_1\ne\beta_{1,0}\), the p-value is \(2P(T\ge |t|)\), where \(T\) has a t distribution with \(n-2\) degrees of freedom. For a positive-direction alternative, \(H_a:\beta_1>\beta_{1,0}\), it is \(P(T\ge t)\); for a negative-direction alternative, \(H_a:\beta_1<\beta_{1,0}\), it is \(P(T\le t)\). The alternative must be selected based on the research question before examining the result.

Worked Example: Testing for a Positive Slope

A hypothetical study examines the association between daily practice time and a performance score. Practice time is measured in hours per day, and the score is measured in points. A regression analysis of \(n=20\) independent observations gives \(b_1=0.18\) points per practice hour and \(SE(b_1)=0.07\) points per practice hour. The conditions described above are considered reasonable from the study design and diagnostics. Test at \(\alpha=0.01\) whether the population slope is positive.

The hypotheses are \(H_0:\beta_1=0\) and \(H_a:\beta_1>0\), where \(\beta_1\) is measured in score points per practice hour. The degrees of freedom are \(20-2=18\). The test statistic is

$$ t=\frac{0.18-0}{0.07}=2.5714286 \approx 2.571. $$

For the positive-direction alternative, the p-value is \(P(T\ge 2.5714286)\) for \(T\) with 18 degrees of freedom, which is approximately \(0.009609\). Since \(0.009609<0.01\), reject \(H_0\) at the 1% significance level. The data provide evidence that the population mean score increases with practice time. The estimated increase is 0.18 score points per additional practice hour, but the test does not establish that practice causes the increase.

Constructing a Slope Confidence Interval

A confidence interval combines the estimated slope with a margin of error determined by its standard error and a t critical value. For a confidence level \(1-\alpha\), the critical value \(t^*\) is chosen so that the central area under the t distribution with \(n-2\) degrees of freedom is \(1-\alpha\).

Confidence interval for a population slope: Under the simple linear regression assumptions, a two-sided confidence interval for \(\beta_1\) is $$ b_1 \pm t^*SE(b_1), $$ where \(t^*\) is the positive critical value with \(n-2\) degrees of freedom that leaves area \(\alpha/2\) in each tail. The interval endpoints have the same units as the slope: response units per predictor unit.

The standard error describes the estimated sampling variability of the slope. In simple linear regression it is calculated as \(SE(b_1)=s/\sqrt{S_{xx}}\), where \(s=\sqrt{SSE/(n-2)}\) is the residual standard deviation and \(S_{xx}=\sum_i(x_i-\bar{x})^2\) measures the spread of the predictor values. A more spread-out set of predictor values can, all else equal, provide a more precise slope estimate.

Worked Example: A 95% Interval for a Change in Response

A hypothetical environmental analysis relates a chemical concentration in water, measured in milligrams per liter, to a response measured in micrograms per liter. For \(n=16\) observations, the estimated slope is \(b_1=0.84\) micrograms per liter of response for each 1 milligram per liter increase in concentration, with \(SE(b_1)=0.25\) in the same slope units. Assume the regression conditions are reasonably supported by the design and diagnostics. Construct a 95% confidence interval for the population slope.

There are \(16-2=14\) degrees of freedom. The 95% critical value is approximately \(t^*=2.145\). The margin of error is

$$ 2.145(0.25)=0.53625. $$

Using this unrounded margin consistently, the interval is

$$ 0.84 \pm 0.53625 =(0.84-0.53625,\ 0.84+0.53625) =(0.30375,\ 1.37625) \approx (0.3038,\ 1.3763). $$

We are 95% confident that the population mean response changes by between 0.3038 and 1.3763 micrograms per liter for each 1 milligram per liter increase in concentration, over the predictor range represented by the data. The interval is entirely positive, indicating evidence of a positive population slope at the corresponding two-sided 5% level. The interpretation concerns the mean response, not the response of every individual observation.

Why the Test and Interval Agree

A two-sided slope test at significance level \(\alpha\) and a two-sided confidence interval with confidence level \(1-\alpha\) use the same t distribution and standard error. This is why testing whether \(\beta_1=\beta_{1,0}\) agrees with checking whether \(\beta_{1,0}\) lies in the corresponding interval.

Justification: Under the model assumptions, the standardized slope estimate has a t distribution centered at the true slope when written as \((b_1-\beta_1)/SE(b_1)\). Therefore, $$ P\left(-t^* \le \frac{b_1-\beta_1}{SE(b_1)} \le t^*\right)=1-\alpha. $$ Because \(SE(b_1)>0\), multiplying through by it preserves the inequality. Rearranging for \(\beta_1\) gives $$ P\left(b_1-t^*SE(b_1)\le\beta_1\le b_1+t^*SE(b_1)\right)=1-\alpha. $$ The endpoints are the stated confidence interval. In a two-sided test of \(H_0:\beta_1=\beta_{1,0}\), the null value is rejected at level \(\alpha\) exactly when it falls outside this interval.

The confidence level describes the long-run coverage of the interval-building procedure: if the same sampling and modeling process were repeated many times, approximately 95% of intervals constructed by the 95% procedure would contain the fixed population slope. It does not mean that, after observing one interval, there is a 95% probability that the fixed slope lies in it.

Worked Example: Testing a Nonzero Null Slope

A hypothetical laboratory analysis relates a measured input to an outcome in units where a slope of 1.00 outcome unit per input unit is a scientifically specified benchmark. For \(n=12\) independent observations, the fitted slope is \(b_1=1.12\) outcome units per input unit and \(SE(b_1)=0.20\) outcome units per input unit. Suppose the linearity, independence, constant variance, and approximate normality conditions are reasonable based on the study design and diagnostics. Test \(H_0:\beta_1=1.00\) against \(H_a:\beta_1\ne1.00\) at \(\alpha=0.05\).

The degrees of freedom are \(12-2=10\), and the statistic is

$$ t=\frac{1.12-1.00}{0.20}=0.600. $$

The two-sided p-value is \(2P(T\ge0.600)\) for 10 degrees of freedom, approximately \(0.562\). Since \(0.562>0.05\), do not reject \(H_0\). The data do not provide strong evidence that the population slope differs from 1.00 outcome unit per input unit. This is not proof that the slope equals 1.00; the result indicates that this sample does not distinguish the observed slope from the benchmark with strong evidence.

The same conclusion can be checked with the 95% interval. For 10 degrees of freedom, \(t^*\approx2.228\), so

$$ 1.12\pm2.228(0.20) =1.12\pm0.4456 =(0.6744,\ 1.5656). $$

The benchmark value 1.00 lies inside this interval, consistent with not rejecting the two-sided test at the 5% level.

Writing Conclusions in Context

A complete conclusion identifies the population parameter, the direction or benchmark being tested, the evidence, and the units. The slope units always combine the response units in the numerator with the predictor units in the denominator. For example, if response is measured in points and predictor in hours, the slope is in points per hour. Saying only “the slope is 0.18” leaves out what the number describes.

Statistical evidence and practical importance are separate questions. A small p-value can indicate that a slope differs from a null value without showing that the change matters in practice. Conversely, a wide interval that includes zero or a benchmark may reflect imprecision rather than evidence that the effect is exactly absent. Consider the interval’s endpoints, the predictor range, and the consequences of the response change in the actual setting.

Common Mistakes

  • Using the wrong tail. A positive-direction alternative uses an upper-tail probability; a two-sided alternative counts extreme results in both tails. Choose the alternative from the question, not from the sign of the observed slope.
  • Describing the p-value as the probability that the null is true. The p-value is calculated assuming the null is true; it measures how unusual the observed test statistic or one more extreme would be under that assumption.
  • Forgetting the units. A slope is expressed in response units per predictor unit, not merely in response units. Keep those units in the interval and conclusion.
  • Claiming “no effect” when a test is not significant. Failure to reject means the data do not supply sufficient evidence against the null at the chosen level. It does not establish the null as true.
  • Interpreting an association as a cause. A regression slope describes a relationship. A causal conclusion needs an appropriate design, such as a well-conducted randomized experiment, as well as valid analysis.
  • Rounding inconsistently. Carry extra digits through the margin and endpoint calculations, then round the reported interval. For example, \(0.84\pm0.53625\) gives endpoints \(0.30375\) and \(1.37625\), reported as \(0.3038\) and \(1.3763\).
Key takeaway: For slope inference, identify the null and alternative, verify the regression assumptions, use \(df=n-2\), and calculate with the slope’s standard error. Then report the test or interval in response units per predictor unit and limit the conclusion to what the design and evidence support.

Check Your Understanding

Try these questions without looking back.

  1. A simple regression uses 24 observations. What degrees of freedom are used for the usual slope t test?
  2. A test of \(H_0:\beta_1=0\) has \(b_1=0.30\), \(SE(b_1)=0.10\), and \(n=18\). Calculate the test statistic and state the degrees of freedom.
  3. For a two-sided slope test, what determines whether the p-value is one-tail or two-tail?
  4. A 95% slope interval is reported as 2 to 5 millimeters per degree. State its interpretation in context without assigning a probability to the fixed slope.
  5. Why does a nonsignificant test of \(H_0:\beta_1=1\) not establish that the population slope is exactly 1?
  6. What design feature is needed before an observed regression slope can support a causal conclusion?