# t test vs. F test

In linear regression, I have heard that the t test is more versatile than the F test because the t test can test the null hypothesis $H_0:{\beta_1}=k$ for $k$ a constant, whilst the F test can only test the null hypothesis $H_0:{\beta_1}=0$.

Is this true? What does this mean?

• I removed the hats and added some tags and other formatting Feb 13, 2015 at 3:17
• An $F$ test can only be used on two tailed tests even though the F distribution is one tailed in nature. If you had a one tailed test then a $T$ distribution has to be used. Feb 13, 2015 at 3:44

It really depends on what you mean by "the" F-test.

Certainly an F-test can test $H_0:\beta_1=k$. One simply nests the restricted hypothesis in the unrestricted one, and computes the relevant F statistic.

The advantage of the t-test is you can do it directly from the usual regression output, even if one didn't think to prepare the output to test that hypothesis.

Example, in R (some unnecessary parts of output removed):

[The data are the Davis data in the car package, on reported vs actual heights and weights. The height and weight values for subject 12 have been interchanged (to restore them to their correct place since they had been swapped), and the result put into a new data set, Davisfixed.]

This is the regression of reported on actual weight. An obvious hypothesis test of interest here is whether $\beta_1$ differs from 1:

summary(lm(repwt~weight,Davisfixed))

Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept)  -0.9480     0.8575  -1.106     0.27
weight        1.0144     0.0128  79.222   <2e-16 ***

Residual standard error: 2.313 on 181 degrees of freedom
(17 observations deleted due to missingness)
Multiple R-squared:  0.972,     Adjusted R-squared:  0.9718
F-statistic:  6276 on 1 and 181 DF,  p-value: < 2.2e-16


So we can test $H_0: \beta_1=1$ vs $H_1: \beta_1\neq1$ via a t-test. Consider this row of the output:

            Estimate Std. Error t value Pr(>|t|)
weight        1.0144     0.0128  79.222   <2e-16 ***


We construct the t-statistic $\frac{\hat{\beta}-\beta_0}{\text{se}(\hat\beta)}=\frac{1.01436-1}{0.012804}=1.1217$, which under the null should have a t-distribution with $\nu=181$. The p-value is 0.2635.

To get the F, we can fit the full model like so:

> anova(lm(repwt~weight,Davisfixed))
Analysis of Variance Table

Response: repwt
Df Sum Sq Mean Sq F value    Pr(>F)
weight      1  33575   33575  6276.2 < 2.2e-16 ***
Residuals 181    968       5


So the SSresidual for the full model is 968. Then we fit the model with the coefficient of weight set to $1.$ :

> anova(lm(I(repwt-1.*weight)~1,Davisfixed))
Analysis of Variance Table

Response: I(repwt - weight)
Df Sum Sq Mean Sq F value Pr(>F)
Residuals 182 974.99  5.3571


And the SSResidual is 974.99

So (here adding in more figures for sufficient accuracy) F for the hypothesis $\beta_1=1$ is $\frac{(974.9945-968.2643)/1}{968.2643/181}=1.2581$

However, if we have offsets available, we can do something much simpler:

> anova(lm(repwt~weight+offset(1.*weight),Davisfixed))
Analysis of Variance Table

Response: repwt
Df Sum Sq Mean Sq F value Pr(>F)
weight      1   6.73  6.7302  1.2581 0.2635
Residuals 181 968.26  5.3495


And we see the correct F and the p-value for the F there.

Of course, the really easy way to get that $F$ is simply to square the t-value we had before: $1.1217^2 = 1.2582$ (and in that sense, we actually can do an F-test as easily as we can do a t-test).

• Thanks for that info. I really lack the necessary background for this and I'm trying to learn on the fly as fast as possible. If we have not learned about nesting hypotheses yet, would the statement above be true? And more importanty, why? Feb 13, 2015 at 2:07
• The truth of a statement is not a function of what you've learned. When considering whether it can be done by an F-test, the statement is false. If you restrict consideration to what can easily be done directly from the usual regression tables, then it's true. Feb 13, 2015 at 2:12
• Thank you, but I guess what I am trying to find out is WHY the t test can easily test $\beta_1=k$ from the usual regression tables, and the $F$ test cannot. Feb 13, 2015 at 2:16
• Because the numbers you need to do the t-test can be found in the output; the ones for the F require more calculation. Actually, if your regression program includes an offset, you don't even need to fit two regressions to do it with an F. I just need to find a suitable data set to demonstrate it all on Feb 13, 2015 at 2:19
• See the updated answer, where full details are given on how to compute the t-statistic, as well as three different - and progressively easier - ways to compute the F Feb 13, 2015 at 3:14