[Math] Degrees of freedom of t-test in multiple regression .

regressionstatistics

Formula of t-test in regression is,
$ t=\frac{\hat{\beta}-\beta}{se (\hat{\beta})} $
and the degrees of freedom of t-test is (n-k) because we estimate $\hat{\sigma}^2$ from RSS and the RSS has (n-k) degrees of freedom (the model has k number of parameters including intercept term.).But what i am not understand, is that we also estimate$\hat{\beta}$ from $$\hat{\beta}=\frac{\sum (x_i-\bar{x})(y_i-\bar{y})}{\sum (x_i-\bar{x})^2} $$ Here we lost 1 degrees of freedom for estimating $\bar{y}$.
That tells us that we lost k degrees of freedom for calculating residuals and 1 for estimating $\hat{\beta}$. So the degrees of freedom should be n-k-1 instead of (n-k).What i am missing here?

Best Answer

Note that for multiple regression model, where $k\ge 3$, the general formula for the coefficients is $$ \hat{\beta} = (X'X)^{-1}X'y, $$ such that only for the $y=\beta_0 +\beta_1x+\epsilon$ case you get for $\hat{\beta}_1=\frac{\sum(x_i - \bar{x})(y_i - \bar{y})}{\sum(x_i - \bar{x})^2}$, otherwise $\beta_1$, and each one of the other coefficients will differ according to $k$. As such, intuitively, the model loses $1$ df for every estimated coefficient. So, in particular, for the $\hat{\sigma}^2 = \frac{1}{n-k}\sum(y_i - \hat{y}_i)^2 $ estimator, you are using $\hat{\mathrm{\beta}} = (\hat{\beta}_1, ..., \hat{\beta}_k )$, where $\mathrm{dim(\hat{\beta})}=k\times 1$, hence the total number of df for the $t$-test is $n-k$.

Related Question