简体   繁体   English

从摘要中获取变量?

[英]Get variables from summary?

I want to grab the Standard Error column when I do summary on a linear regression model. 在对线性回归模型进行汇总时,我想获取“标准误差”列。 The output is below: 输出如下:

         Estimate Std. Error z value Pr(>|z|)    
(Intercept) -8.436954   0.616937 -13.676  < 2e-16 ***
x1          -0.138902   0.024247  -5.729 1.01e-08 ***
x2           0.005978   0.009142   0.654  0.51316    `
...

I just want the Std. 我只想要标准。 Error column values stored into a vector. 错误列值存储到向量中。 How would I go about doing so? 我将如何去做? I tried model$coefficients[,2] but that keeps giving me extra values. 我尝试使用model $ coefficients [,2],但一直为我提供额外的价值。 If anyone could help that would be great. 如果有人可以帮助,那就太好了。

Say fit is the linear model, then summary(fit)$coefficients[,2] has the standard errors. fit为线性模型,则summary(fit)$coefficients[,2]具有标准误差。 Type ?summary.lm . 键入?summary.lm

fit <- lm(y~x, myData)
summary(fit)$coefficients[,1]   # the coefficients
summary(fit)$coefficients[,2]   # the std. error in the coefficients
summary(fit)$coefficients[,3]   # the t-values
summary(fit)$coefficients[,4]   # the p-values

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM