我在 R
中的大型数据集上使用 lm()
. 使用 summary()
可以获得关于这两个参数之间的线性回归的大量细节 .
我感到困惑的部分是哪一个是摘要的 Coefficients:
部分中的正确参数,用作相关系数?
Sample Data
c1 <- c(1:10)
c2 <- c(10:19)
output <- summary(lm(c1 ~ c2))
Summary
Call:
lm(formula = c1 ~ c2)
Residuals:
Min 1Q Median 3Q Max
-2.280e-15 -8.925e-16 -2.144e-16 4.221e-16 4.051e-15
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -9.000e+00 2.902e-15 -3.101e+15 <2e-16 ***
c2 1.000e+00 1.963e-16 5.093e+15 <2e-16 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 1.783e-15 on 8 degrees of freedom
Multiple R-squared: 1, Adjusted R-squared: 1
F-statistic: 2.594e+31 on 1 and 8 DF, p-value: < 2.2e-16
Is this the correlation coefficient I should use?
output$coefficients[2,1]
1
请建议,谢谢 .
1 回答
系数估计的完全方差协方差矩阵是:
特别是
sqrt(diag(vcov(fm)))
等于coef(summary(fm))[, 2]
相应的相关矩阵是:
系数估计值之间的相关性是: