Determining t values from R output

34 Views Asked by At

I have the following R output with several values omitted. I am trying to find what the t value of two estimates, $\widehat{B}_0$, $\widehat{B}_1$

1 > summary(lm(y ~ x))
2 Coefficients:
3             Estimate  Std. Error   t value    Pr(>|t|)
4 (Intercept) -10.805   XXXXX        XXXXX      XXXXX
5 x             3.463   XXXXX        XXXXX      XXXXX
6 ---
7 Signif. codes: 0 ’***’ 0.001 ’**’ 0.01 ’*’ 0.05 ’.’ 0.1 ’ ’ 1
8
9 Residual standard error: 38.82 on 45 degrees of freedom
10 Multiple R-squared: XXXXX, Adjusted R-squared: XXXXX
11 F-statistic: XXXXX on 1 and 45 DF, p-value: 0.01027
12
13 > sig.hat<-summary(lm(y  x))$sigma
14 > X<-cbind(1,x)
15 > sig.hatˆ2*solve(t(X) %*% X)
16                       x
17    32.4213203  0.7787438
18 x  0.7787438   1.6709619
19 > (SST<-sum((y-mean(y))ˆ2))
20 [1] 78620.22

I know that $t_j = \dfrac{\widehat{B}_j}{\operatorname{e.s.e}(\widehat{B}_j)}$, but since $\operatorname{e.s.e}(\widehat{B}_j)$ is missing as well, I am not sure how to calculate the t values.

1

There are 1 best solutions below

3
On

The standard errors that you seek can be found by taking the square roots of the diagonal entries of the output sig.hat^2 * solve(t(X) %*% X). However, we do not know


If $y_i \sim N(\beta_0 + \beta_1 x_i, \sigma^2)$ is your model, then the covariance matrix of $(\hat{B}_0, \hat{B}_1)$ is $\sigma^2 (X^\top X)^{-1}$ where $X$ is an $n \times 2$ matrix obtained by the cbind(1, x) code (e.g. see here). In particular, the variances of $\hat{B}_0$ and $\hat{B}_1$ are the diagonal entries of $\sigma^2 (X^\top X)^{-1}$ respectively.

However, we do not know $\sigma^2$. If we instead use $\hat{\sigma}^2 := \frac{1}{n - 2} \sum_{i=1}^n (y_i - \hat{B}_0 - \hat{B}_1 x_i)^2$ to compute $\hat{\sigma}^2 (X^\top X)^{-1}$, then the square root of the diagonal entries are the standard errors of $\hat{B}_0$ and $\hat{B}_1$ respectively, and can be used to perform $t$-tests.