# How we can compare two coefficients of one linear regression?

I have this regression model,

$$\hat{Y}=\hat{a}X_1+\hat{b}X_2+\hat{c}$$

Both $X_1$ and $X_2$ are significant at 0.01 level. $X_1$ and $X_2$ have a same unit. Now I want to find a test that tells me whether $\hat{a}$ is significantly higher than $\hat{b}$ or not? Can I use a simple t-test for this comparison?

Yes, you can use a t-test!

Since regression coefficients are asymptotically Normal, their linear combination is also asymptotically Normal. First, notice that the test $H_0: \hat{a} = \hat{b}$ is equivalent to $H_0: \hat{a} - \hat{b} = 0$. Then you can get a null distribution on $\hat{a}-\hat{b}$,

$$\hat{a} - \hat{b} \sim N(0, Var(\hat{a}) + Var(\hat{b}) - 2Cov(\hat{a},\hat{b}))$$

Which means you can use a t-test with $n-3$ degrees of freedom on the test statistic,

$$\frac{\hat{b} - \hat{a}}{\sqrt{Var(\hat{a}) + Var(\hat{b}) - 2Cov(\hat{a},\hat{b}))}}$$.

• It may be a dump question but how can I find Cov of these two? Aug 25, 2015 at 17:32
• That's not the correct result in R: cov.unscaled equals $(X^\prime X)^{-1}$. That matrix needs to be multiplied by an estimate of the residual variance in order to be an estimated covariance matrix. Instead, use vcov(object) to extract the variance-covariance matrix of the parameter estimate contained in object. If you would like to confirm this, compare sqrt(diag(vcov(fit))) to the "Std. Error" column produced by summary.
– whuber
Aug 25, 2015 at 18:13
• You can do this in R. If object is the name of your lm object, vcov(object). Aug 25, 2015 at 18:15
• @TrynnaDoStat thank you for your help. just one more question. 'n' is the number of original observations? Aug 26, 2015 at 7:13