添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

Stack Exchange Network

Stack Exchange network consists of 181 Q&A communities including Stack Overflow , the largest, most trusted online community for developers to learn, share their knowledge, and build their careers. Visit Stack Exchange

Cross Validated is a question and answer site for people interested in statistics, machine learning, data analysis, data mining, and data visualization. It only takes a minute to sign up.

Sign up to join this community

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams Residuals: Min 1Q Median 3Q Max -5.661e-16 -1.157e-16 4.273e-17 2.153e-16 4.167e-16 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 5.000e+00 2.458e-16 2.035e+16 <2e-16 *** xdata 1.000e+00 3.961e-17 2.525e+16 <2e-16 *** Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Residual standard error: 3.598e-16 on 8 degrees of freedom Multiple R-squared: 1, Adjusted R-squared: 1 F-statistic: 6.374e+32 on 1 and 8 DF, p-value: < 2.2e-16

How do I extract the standard errors of the regression coefficients from either fit or out? I can't seem to figure it out. Thanks!

$\begingroup$

It's useful to see what kind of objects are contained within another object. Using names() or str() can help here.

Note that out <- summary(fit) is the summary of the linear regression object.

names(out)
str(out)

The simplest way to get the coefficients would probably be:

out$coefficients[ , 2] #extract 2nd column from the coefficients object in out
                $\begingroup$
                But the question asks about the standard error of the coefficients, no?
                $\endgroup$
– ziggystar
                May 22, 2014 at 15:05
                $\begingroup$
                I would like to note that the question concerned the standard errors of the regression coefficients and not the values of the coefficients themselves. The above answer is misleading in this case. The correct answer was given by @Quazi Irfan in the commentary to the question.
                $\endgroup$
– Marek Fiołka
                Feb 26, 2022 at 18:17
                $\begingroup$
                Use the name instead of the column index : out$coefficients[, "Std. Error"]
                $\endgroup$
– Julien
                Jan 20 at 11:01