公卫百科  > 所属分类  >  R/S+   
[0] 评论[0] 编辑

获得回归模型的统计量

 You want the critical statistics and information regarding your regression, such as R2, the F statistic, confidence intervals for the coefficients, residuals, the ANOVA table,and so forth. 公卫论坛


Save the regression model in a variable, say m:
> m <- lm(y ~ u + v + w)
Then, use the following functions to extract regression statistics and information from 公卫论坛
the model:
anova(m)
ANOVA table
coefficients(m)
Model coefficients
coef(m)
Same as coefficients(m)
confint(m)
Confidence intervals for the regression coefficients 公卫人
deviance(m)
Residual sum of squares
effects(m)
Vector of orthogonal effects
fitted(m)
Vector of fitted y values
residuals(m)
Model residuals
resid(m)
Same as residuals(m)

公卫家园


summary(m)
Key statistics, such as R2, the F statistic, and the residual standard error (σ)
vcov(m)
Variance-covariance matrix of the main parameters
公卫论坛


> m <- lm(y ~ u + v + w)
> summary(m)
Call:
lm(formula = y ~ u + v + w)
Residuals:
    Min      1Q  Median      3Q     Max  公卫人
-3.3965 -0.9472 -0.4708  1.3730  3.1283 
Coefficients:
            Estimate Std. Error t value Pr(>|t|)   
公卫人

(Intercept)   1.4222     1.4036   1.013  0.32029   
u             1.0359     0.2811   3.685  0.00106 **

公卫论坛


v             0.9217     0.3787   2.434  0.02211 * 
w             0.7261     0.3652   1.988  0.05744 .  公卫家园
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 
Residual standard error: 1.625 on 26 degrees of freedom 公卫考场
Multiple R-squared: 0.4981,     Adjusted R-squared: 0.4402 
F-statistic: 8.603 on 3 and 26 DF,  p-value: 0.0003915

If you find it annoying to save the model in a variable, you are welcome to use one-
公卫论坛

liners such as this:
> summary(lm(y ~ u + v + w))

附件列表


0

词条内容仅供参考,如果您需要解决具体问题
(尤其在法律、医学等领域),建议您咨询相关领域专业人士。

如果您认为本词条还有待完善,请 编辑

上一篇 多重线性回归的实现    下一篇 线性回归的诊断

同义词

暂无同义词