查看R中lm中的各项结果

1. summary

summary(fit_all)
Call:
lm(formula = A$BRAY ~ A$DIST)
Residuals:
Min1QMedian3QMax
-0.4751 -0.15840.02020.20310.3990
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 4.751e-01 2.250e-0221.11<2e-16 ***
A$DIST5.938e-044.208e-0514.11<2e-16 ***
---
Signif. codes:0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
【查看R中lm中的各项结果】Residual standard error: 0.2347 on 250 degrees of freedom
Multiple R-squared:0.4433, Adjusted R-squared:0.4411
F-statistic: 199.1 on 1 and 250 DF,p-value: < 2.2e-16
T检验是检验解释变量的显著性的; R-squared是查看方程拟合程度的; F检验是检验方程整体显著性的;
2. coef(lm.fit)直接出变量的系数。向量形式,用[ ]指示取哪些系数
coef(fit_all)[1]
(Intercept)
0.4750591
> coef(fit_all)[2]
A$DIST
0.0005937671
3. summary(lm.fit)$coefficients[,'Pr(>|t|)']取P值。
summary(fit_all)$coefficients[,'Pr(>|t|)']
(Intercept)A$DIST
1.705975e-57 1.202421e-33

    推荐阅读