Skip to content

Actuarial Statistics · Linear regression models

Confidence Intervals and t-Tests for Regression Slope

Updated 11 October 2026 · Fact-checked

In simple linear regression, the slope estimate β̂ is normal with variance σ²/Sxx. Because σ² is unknown, you estimate it by σ̂² = SSres/(n − 2) and use a t distribution with n − 2 degrees of freedom. The test statistic is t = β̂ ÷ se(β̂), and the interval is β̂ ± t × se(β̂).

Understand Inference: Confidence Intervals and Hypothesis Tests

In the model Y = α + βx + ε, the errors ε are independent, normal, with mean 0 and constant variance σ². Your data give one sample of Y values. A different sample would give different estimates α̂ and β̂. So the estimates are random variables, and inference means measuring how much they vary.

Because each Y is normal and each estimator is a linear combination of the Y values, α̂ and β̂ are also normal. Both are unbiased. The variance of β̂ is σ²/Sxx. A wider spread of x values makes Sxx larger and the slope more precise. The variance of α̂ is σ²(1/n + x̄²/Sxx).

The catch is that σ² is unknown. You estimate it from the residuals: σ̂² = SSres/(n − 2). You lose two degrees of freedom because two parameters (α and β) were estimated. The result (n − 2)σ̂²/σ² follows a chi-square distribution with n − 2 degrees of freedom, and it is independent of β̂. A standard normal divided by the square root of an independent chi-square over its degrees of freedom gives a t distribution. That is why t with n − 2 degrees of freedom appears.

The same idea gives three intervals. For the slope, you use β̂ ± t × se(β̂). For the intercept, you use α̂ ± t × se(α̂). For a value of x0, you can estimate the mean response E[Y | x0] or predict one new observation. The mean response has a smaller standard error. A new observation adds its own error variance σ², so its interval is always wider.

The key hypothesis test is H0: β = 0 against H1: β ≠ 0. It asks whether x helps explain Y at all. If the confidence interval for β excludes 0, the two-sided test rejects H0 at the matching level.

Key rules to remember

Model
Yi = α + β xi + εi, with εi independent N(0, σ²)
State these assumptions before using any t result.
Sums of squares
Sxx = Σx² − n x̄²; Sxy = Σxy − n x̄ ȳ; Syy = Σy² − n ȳ²
Most exam questions give these or the raw sums.
Least squares estimates
β̂ = Sxy ÷ Sxx; α̂ = ȳ − β̂ x̄
The fitted line always passes through (x̄, ȳ).
Variances of estimators
Var(β̂) = σ² ÷ Sxx; Var(α̂) = σ² (1/n + x̄²/Sxx); Cov(α̂, β̂) = −σ² x̄ ÷ Sxx
Both estimators are unbiased and normally distributed.
Error variance estimate
σ̂² = SSres ÷ (n − 2), where SSres = Syy − Sxy² ÷ Sxx
Unbiased for σ². Also (n − 2)σ̂²/σ² ~ χ² with n − 2 degrees of freedom.
t pivot for the slope
(β̂ − β) ÷ (σ̂ ÷ √Sxx) ~ t(n − 2)
For the test of H0: β = 0, the statistic is β̂ ÷ (σ̂ ÷ √Sxx).
Confidence interval for the slope
β̂ ± t(n − 2, 1 − γ/2) × σ̂ ÷ √Sxx
Here the confidence level is 1 − γ, for example 95% when γ = 0.05.
Confidence interval for the intercept
α̂ ± t(n − 2, 1 − γ/2) × σ̂ √(1/n + x̄²/Sxx)
Often the intercept is outside the data range, so interpret with care.
Confidence interval for the mean response at x0
(α̂ + β̂ x0) ± t × σ̂ √(1/n + (x0 − x̄)²/Sxx)
Estimates E[Y | x0], the average response.
Prediction interval for a new observation at x0
(α̂ + β̂ x0) ± t × σ̂ √(1 + 1/n + (x0 − x̄)²/Sxx)
The extra 1 is the variance of the new error. It is always wider than the mean-response interval.
Link with F
t² = F, with 1 and n − 2 degrees of freedom
For the slope test in simple regression, the t-test and ANOVA F-test agree.

How to solve Inference: Confidence Intervals and Hypothesis Tests questions

Use this order for any question on inference in simple linear regression. It keeps the working clear for the written paper.

  1. 1Write the model and assumptions: normal, independent errors with constant variance σ².
  2. 2Compute Sxx, Sxy and Syy from the data or the sums given. Then find β̂ and α̂.
  3. 3Find SSres = Syy − Sxy² ÷ Sxx and σ̂² = SSres ÷ (n − 2). Note the degrees of freedom n − 2.
  4. 4Compute the standard error you need: σ̂ ÷ √Sxx for the slope, the intercept formula for α, or the x0 formula for the mean or a new response.
  5. 5For a test, state H0 and H1, compute t = (estimate − hypothesised value) ÷ standard error, and compare with the t(n − 2) critical value or p-value.
  6. 6For an interval, take estimate ± t critical value × standard error. Use the correct tail point, for example 0.975 for a 95% two-sided interval.
  7. 7State the conclusion in words, in the context of the question. Say whether the slope is significantly different from 0 and what the interval tells you.

Quickest way: Slope t-test and interval in four lines

When to use it: Use this when you are given Sxx, Sxy and Syy, or summary statistics, and must test or bound the slope quickly.

  1. Compute β̂ = Sxy ÷ Sxx and SSres = Syy − Sxy² ÷ Sxx.
  2. Compute se(β̂) = √(SSres ÷ (n − 2) ÷ Sxx).
  3. Compute t = β̂ ÷ se(β̂). Compare with the t(n − 2) table value.
  4. Interval: β̂ ± t critical × se(β̂). For intervals at x0, only change the square root term: add 1 for a prediction, and use (x0 − x̄)²/Sxx for distance from the mean.

Common mistakes in Inference: Confidence Intervals and Hypothesis Tests

  • Using n − 1 or n as the degrees of freedom for the t distribution.

    Students carry over the one-sample t-test rule.

    Fix: In simple linear regression two parameters are estimated, so use n − 2 for both σ̂² and the t critical value.

  • Using the mean-response interval when the question asks for a prediction interval, or the reverse.

    The two formulas look almost identical.

    Fix: Check the wording. Average or expected response means no extra 1. A single new observation means include the 1 inside the square root.

  • Forgetting to divide σ̂² by Sxx, or using σ̂ instead of σ̂ ÷ √Sxx, for the slope standard error.

    Students remember σ̂ but not how Sxx enters.

    Fix: Write Var(β̂) = σ² ÷ Sxx first. Replace σ² by σ̂², then take the square root.

  • Using SSres ÷ n or SSres ÷ (n − 1) as σ̂².

    Confusion with the sample variance formula or the maximum likelihood estimate.

    Fix: The unbiased estimate used in regression inference is SSres ÷ (n − 2).

  • Concluding that a significant slope proves x causes Y, or that failing to reject H0 proves β = 0.

    Misreading what the test shows.

    Fix: A significant slope shows a linear association supported by the data. A non-significant slope means there is not enough evidence of a linear relationship.

  • Using x0 far outside the observed x range and treating the interval as reliable.

    The formula still produces a number.

    Fix: State that the interval assumes the linear model holds at x0. Extrapolation is risky even when the interval is narrow.

Worked examples

Example 1

A simple linear regression model Y = α + βx + ε is fitted to n = 10 points. Given x̄ = 5, ȳ = 20, Sxx = 40, Sxy = 60, Syy = 120. (a) Find the least squares estimates. (b) Estimate σ². (c) Test H0: β = 0 against H1: β ≠ 0 at the 5% level, and find a 95% confidence interval for β. Use t(8) 0.975 point = 2.306.

Show the solution
  1. β̂ = Sxy ÷ Sxx = 60 ÷ 40 = 1.5.
  2. α̂ = ȳ − β̂ x̄ = 20 − 1.5 × 5 = 12.5.
  3. SSres = Syy − Sxy² ÷ Sxx = 120 − 3,600 ÷ 40 = 120 − 90 = 30.
  4. σ̂² = 30 ÷ (10 − 2) = 3.75.
  5. se(β̂) = √(σ̂² ÷ Sxx) = √(3.75 ÷ 40) = √0.09375 = 0.3062.
  6. Test statistic t = 1.5 ÷ 0.3062 = 4.90, with 8 degrees of freedom.
  7. Since 4.90 > 2.306, reject H0 at the 5% level.
  8. 95% interval: 1.5 ± 2.306 × 0.3062 = 1.5 ± 0.706, so (0.794, 2.206). The interval excludes 0, which agrees with the test.

Answer: β̂ = 1.5, α̂ = 12.5, σ̂² = 3.75. The t statistic is 4.90 on 8 degrees of freedom, so the slope is significant at 5%. The 95% confidence interval for β is about (0.79, 2.21).

Example 2

Using the fitted model from the previous example (α̂ = 12.5, β̂ = 1.5, σ̂² = 3.75, n = 10, x̄ = 5, Sxx = 40), find (a) a 95% confidence interval for the mean response at x0 = 7, and (b) a 95% prediction interval for a new observation at x0 = 7. Use t(8) 0.975 point = 2.306.

Show the solution
  1. Fitted value at x0 = 7: 12.5 + 1.5 × 7 = 23.
  2. Distance term: (x0 − x̄)² ÷ Sxx = 4 ÷ 40 = 0.1. Also 1/n = 0.1.
  3. Mean response: se = √(3.75 × (0.1 + 0.1)) = √0.75 = 0.8660.
  4. Margin = 2.306 × 0.8660 = 1.997. Interval: 23 ± 1.997, so (21.00, 25.00) to two decimals.
  5. Prediction: se = √(3.75 × (1 + 0.1 + 0.1)) = √4.5 = 2.1213.
  6. Margin = 2.306 × 2.1213 = 4.892. Interval: 23 ± 4.892, so (18.11, 27.89).
  7. The prediction interval is wider because it includes the variance of the new observation's own error.

Answer: The 95% confidence interval for the mean response at x0 = 7 is about (21.00, 25.00). The 95% prediction interval for a new observation is about (18.11, 27.89).

Exam tips

  • Always state the degrees of freedom, n − 2, and the table value you use. Marks are often given for these.
  • Show the standard error as a formula with numbers substituted before giving the value. Method marks survive arithmetic slips.
  • Read whether the question asks about a parameter, a mean response, or a new observation. This decides the square root term.
  • In computer-based questions in R, you can check your hand result using summary(lm(y ~ x)) and confint(). Know which output columns give the estimate, standard error and t value.
  • Finish with a sentence in context. A bare number rarely earns full marks.

Practice questions from Linear regression models

Inference: Confidence Intervals and Hypothesis Tests in other exams

The same ground in other exams, if you are preparing for more than one or want another angle on it.

Inference: Confidence Intervals and Hypothesis Tests: frequently asked questions

What is the difference between a confidence interval and a prediction interval in regression?

A confidence interval for the mean response estimates the average Y at a given x. A prediction interval covers one new observation at that x. The prediction interval is wider because it adds the new observation's own error variance, shown as the extra 1 under the square root.

Why do we use the t distribution and not the normal for the slope?

The true error variance σ² is unknown and replaced by σ̂². This adds extra uncertainty, so the standardised slope follows a t distribution with n − 2 degrees of freedom. As n grows, the t distribution approaches the normal.

How do I test whether the slope is significant?

Set H0: β = 0 and H1: β ≠ 0. Compute t = β̂ ÷ se(β̂) and compare it with the t(n − 2) critical value. If the absolute value of t exceeds it, or the p-value is below your significance level, reject H0.

Is the slope t-test the same as the ANOVA F-test?

In simple linear regression, yes. The F statistic equals t² with 1 and n − 2 degrees of freedom, and both tests give the same conclusion for a two-sided test of β = 0.