我在 R MASS 包中使用 rlm 来回归多元线性模型。它适用于许多样本,但我得到了特定模型的准零系数:
Call: rlm(formula = Y ~ X1 + X2 + X3 + X4, data = mymodel, maxit = 50, na.action = na.omit)
Residuals:
Min 1Q Median 3Q Max
-7.981e+01 -6.022e-03 -1.696e-04 8.458e-03 7.706e+01
Coefficients:
Value Std. Error t value
(Intercept) 0.0002 0.0001 1.8418
X1 0.0004 0.0000 13.4478
X2 -0.0004 0.0000 -23.1100
X3 -0.0001 0.0002 -0.5511
X4 0.0006 0.0001 8.1489
Residual standard error: 0.01086 on 49052 degrees of freedom
(83 observations deleted due to missingness)
为了比较,这些是 lm() 计算的系数:
Call:
lm(formula = Y ~ X1 + X2 + X3 + X4, data = mymodel, na.action = na.omit)
Residuals:
Min 1Q Median 3Q Max
-76.784 -0.459 0.017 0.538 78.665
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -0.016633 0.011622 -1.431 0.152
X1 0.046897 0.004172 11.240 < 2e-16 ***
X2 -0.054944 0.002184 -25.155 < 2e-16 ***
X3 0.022627 0.019496 1.161 0.246
X4 0.051336 0.009952 5.159 2.5e-07 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 2.574 on 49052 degrees of freedom
(83 observations deleted due to missingness)
Multiple R-squared: 0.0182, Adjusted R-squared: 0.01812
F-statistic: 227.3 on 4 and 49052 DF, p-value: < 2.2e-16
lm 图没有显示任何特别高的异常值,由 Cook 距离测量:
编辑
作为参考并根据Macro提供的答案确认结果后k
,在Huber估计器中设置调整参数的R命令是(k=100
在这种情况下):
rlm(y ~ x, psi = psi.huber, k = 100)