Why Test a Linear Combination?
A regression question often concerns more than one coefficient at a time. For example, a researcher might ask whether two adjusted group effects differ, or whether their average equals a specified benchmark. These questions are about a linear combination of regression coefficients, not necessarily about any single coefficient.
Once the combination and its standard error have been specified, the test follows the same basic logic as a coefficient t test: compare the estimate with the value asserted by the null hypothesis, measured in standard-error units. The reference distribution and the tail area depend on the regression model’s residual degrees of freedom and on the alternative hypothesis.
The Model and the Test Statistic
Use the ordinary least-squares regression model with \(n\) observations and \(q\) fitted coefficients, including the intercept if the model has one. For the classical t test, the model must be correctly specified for the question, the errors must have mean zero and constant variance, observations’ errors must be independent, and the errors must be normally distributed for the exact small-sample t reference distribution. The design matrix must have full column rank so the coefficients and requested contrast can be estimated. In symbols, the error assumption is \(\varepsilon\sim N(0,\sigma^2 I)\) conditional on the predictors.
The contrast standard error \(SE(\hat{\theta})\) measures the estimated sampling variability of the whole linear combination. It is not generally obtained by separately testing each coefficient and then combining the test statistics. Use the standard error for the specified contrast, as defined when estimating contrasts.
Under \(H_0\) and the stated classical regression assumptions, this statistic follows a t distribution with \(n-q\) degrees of freedom. The sign of \(t\) indicates whether the estimate is above or below the null value; the alternative determines which part of the t distribution supplies the p-value.
Why the Reference Distribution Is a t Distribution
The t reference distribution accounts for estimating the error variance from the same data. A short derivation shows why the numerator is centered at zero under the null and why the residual degrees of freedom enter the denominator.
Write the regression in matrix form as \(Y=X\beta+\varepsilon\), where \(X\) is the design matrix and \(\beta\) contains the \(q\) coefficients. Under the model assumptions, the least-squares estimate has mean \(\beta\) and covariance matrix \(\sigma^2(X^\mathsf{T}X)^{-1}\). For a fixed contrast vector \(a\), \(\hat{\theta}=a^\mathsf{T}\hat{\beta}\), so it is normally distributed with mean \(\theta=a^\mathsf{T}\beta\) and variance \(\sigma^2a^\mathsf{T}(X^\mathsf{T}X)^{-1}a\).
Under \(H_0\), the contrast is \(\theta_0\). Therefore, if the true \(\sigma\) were known, the difference \(\hat{\theta}-\theta_0\), divided by its true standard deviation, would be standard normal. In practice, \(\sigma^2\) is replaced by the residual mean square \(s^2=SSE/(n-q)\). Under normal errors, \(SSE/\sigma^2\) has a chi-square distribution with \(n-q\) degrees of freedom and is independent of the estimated coefficient vector. Dividing the standard normal quantity by the square root of this independent chi-square quantity divided by its degrees of freedom gives a t statistic. Replacing the true standard deviation with the estimated contrast standard error therefore gives the stated t distribution.
Worked Tests
Worked Example: Testing a Difference Between Two Adjusted Effects
Suppose a hypothetical regression estimates the adjusted effects of two programs, A and B, on change in systolic blood pressure, measured in mmHg, relative to a reference group. The estimated coefficients are \(\hat{\beta}_A=2.4\) mmHg and \(\hat{\beta}_B=-0.6\) mmHg. The research question is whether the program effects differ. The estimated contrast is \(\hat{\theta}=\hat{\beta}_A-\hat{\beta}_B\), its standard error is \(1.149\) mmHg, and the fitted model has \(n=22\) observations and \(q=5\) coefficients. Assume the model’s conditional mean is appropriate, the observations are independent, and hypothetical residual checks show no important nonconstant spread or strong departure from normality.
The hypotheses are \(H_0:\beta_A-\beta_B=0\) and \(H_a:\beta_A-\beta_B\ne0\). First calculate the contrast estimate:
The residual degrees of freedom are \(df=n-q=22-5=17\). Thus,
For the two-sided alternative, the p-value is \(2P(T_{17}\ge |2.61097|)\approx0.01826\). At \(\alpha=0.05\), this is below the significance level, so reject \(H_0\). The data provide evidence, under the model, that the adjusted effects of programs A and B differ. The estimated difference is 3.0 mmHg, with A’s estimated effect higher; this is an association described by the fitted model, not by itself evidence that program assignment caused the difference.
Worked Example: Testing a Contrast Against a Nonzero Value
In a hypothetical model for change in a health score, two group coefficients are estimated as \(\hat{\beta}_A=6.0\) points and \(\hat{\beta}_B=4.4\) points relative to a reference group. The question concerns their average adjusted effect, \(\theta=(\beta_A+\beta_B)/2\), and whether it equals 4.0 points. The estimated contrast is 5.2 points, with \(SE(\hat{\theta})=0.7\) points. There are \(n=24\) observations and \(q=6\) fitted coefficients. Suppose independent observations and residual checks support the classical model assumptions, including roughly constant residual spread and no severe nonnormality.
The hypotheses are \(H_0:(\beta_A+\beta_B)/2=4.0\) and \(H_a:(\beta_A+\beta_B)/2\ne4.0\). The estimated contrast agrees with the coefficient estimates:
The degrees of freedom are \(24-6=18\). The test statistic is
The two-sided p-value is \(2P(T_{18}\ge1.71429)\approx0.1036\). Because this exceeds \(0.05\), do not reject \(H_0\) at the 5% level. The result does not provide sufficient evidence that the average adjusted effect differs from 4.0 points. It does not establish that the average equals 4.0; a nonsignificant test can also arise when the estimate is too imprecise to distinguish from that benchmark.
Worked Example: An Upper-Tailed Contrast Test
Suppose a hypothetical regression estimates a contrast \(\theta\) representing the adjusted difference between two groups in a laboratory measurement, in units. The estimate is \(1.5\) units, its standard error is \(0.4\) units, and the specified benchmark is \(0.5\) units. With \(n=27\) observations and \(q=6\) coefficients, the residual degrees of freedom are 21. Assume the regression form and classical error conditions are plausible: measurements are independent, residual spread is reasonably stable, and residuals show no serious departure from normality.
The directional question is whether the contrast exceeds the benchmark, so the hypotheses are \(H_0:\theta=0.5\) and \(H_a:\theta>0.5\). Calculate:
For this upper-tailed alternative, the p-value is \(P(T_{21}\ge2.500)\approx0.01039\). Since \(0.01039<0.05\), reject \(H_0\) in favor of the specified greater-than alternative. The result is evidence, in the model, that the population contrast exceeds 0.5 units. The alternative must be chosen to match the research question before looking at the observed result. If the alternative had instead been two-sided, the p-value would be \(2P(T_{21}\ge2.500)\approx0.02078\); that test asks a different question.
Choosing and Interpreting the P-Value
The p-value is the probability, assuming the null hypothesis and model assumptions are true, of observing a test statistic at least as extreme as the one calculated, in the direction or directions specified by \(H_a\). For a t statistic \(t\) and \(df=n-q\), the common forms are:
- For \(H_a:\theta\ne\theta_0\), use \(2P(T_{df}\ge |t|)\).
- For \(H_a:\theta>\theta_0\), use \(P(T_{df}\ge t)\).
- For \(H_a:\theta<\theta_0\), use \(P(T_{df}\le t)\).
A p-value is not the probability that \(H_0\) is true, nor is it the probability that random error alone produced the result. It describes how unusual the statistic would be under the null model. A small p-value provides evidence against the null in favor of the stated alternative; it does not measure the practical importance of the contrast.
Common Mistakes
- Testing the wrong quantity. A question about \(\beta_A-\beta_B\) is not answered by testing \(\beta_A=0\) and \(\beta_B=0\) separately. Form the requested contrast and test it directly.
- Using the estimate instead of its distance from the null. The numerator is \(\hat{\theta}-\theta_0\), not merely \(\hat{\theta}\), unless the reference value is zero.
- Using the wrong tail. A directional alternative uses one tail; a two-sided alternative uses both. The p-value must match the alternative stated before examining the data.
- Using the wrong degrees of freedom. In the classical regression t test, use residual degrees of freedom \(n-q\), where \(q\) counts all fitted coefficients, including the intercept when present.
- Treating failure to reject as proof of equality. A p-value above \(\alpha\) means the data do not provide sufficient evidence against the null at that level; it does not prove the null is correct.
Check Your Understanding
For each question, identify the relevant test step or interpretation.
- A researcher asks whether \(\beta_1-\beta_2=0\). What is the contrast estimate in terms of \(\hat{\beta}_1\) and \(\hat{\beta}_2\), and what numerator belongs in the t statistic?
- A model has 31 observations and 7 fitted coefficients. What residual degrees of freedom should be used for the classical regression contrast t test?
- A specified upper-tailed test has \(t=1.8\). Should its p-value be one-sided or two-sided, and why?
- A two-sided test at \(\alpha=0.05\) gives \(p=0.12\). What conclusion is justified, and what conclusion is not justified?
- Explain why a small p-value for a contrast does not, by itself, establish that the contrast is practically important or causal.