R中多元线性回归中每个回归假设(Beta = 0)的t检验

t test for each regressor hypothesis (Beta=0) in multiple linear regression in R

我有这样的数据 table (table.b1):

    y   x1   x2   x3
1  10 2113 1985 38.9
2  11 2003 2855 38.8
3  11 2957 1737 40.1

我对此进行了多元回归:

fit <- lm( y ~ x1 + x2 + x3 , table.b1 )

现在我想计算 t 统计量以检验 R 中的假设个体 Beta1=0、Beta2=0、Beta3=0。

如@ekstroem 所述:使用 summary(fit).

dat <- data.frame(
  "y"  = rnorm(100),
  "x1" = rnorm(100),
  "x2" = rnorm(100),
  "x3" = rnorm(100)
)

fit <- lm( y ~ x1 + x2 + x3 , dat)

summary(fit)

输出为

Call:
lm(formula = y ~ x1 + x2 + x3, data = dat)

Residuals:
    Min      1Q  Median      3Q     Max 
-1.8146 -0.6099  0.0218  0.5469  3.1833 

Coefficients:
             Estimate Std. Error t value Pr(>|t|)
(Intercept)  0.036911   0.099474   0.371    0.711
x1          -0.008111   0.092547  -0.088    0.930
x2           0.031866   0.089083   0.358    0.721
x3           0.081973   0.101729   0.806    0.422

Residual standard error: 0.9822 on 96 degrees of freedom
Multiple R-squared:  0.008441,    Adjusted R-squared:  -0.02255 
F-statistic: 0.2724 on 3 and 96 DF,  p-value: 0.8452

你要找的t值在那里。通常,我们宁愿查看 p 值并在 p 值小于预定义值时拒绝 H0,并称变量(统计上)显着。在大多数情况下,这个预定义的 (alpha-) 值是 0.05 aka 5%。所以在我的例子中,没有一个解释变量是重要的,因为它们的 p 值都在 5% 以上。