Fabian Stolz Fabian Stolz - 1 year ago 107
R Question

R: standard error output from lm object

We got a lm object from and want to extract the standard error

lm_aaa<- lm(aaa~x+y+z)

I know the function summary, names and coefficients.
However, summary seems to be the only way to manually access the standard error.
Have you any idea how I can just output se?


Answer Source

The output of from the summary function is just an R list. So you can use all the standard list operations. For example:

#some data (taken from Roland's example)
x = c(1,2,3,4)
y = c(2.1,3.9,6.3,7.8)

#fitting a linear model
fit = lm(y~x)
m = summary(fit)

The m object or list has a number of attributes. You can access them using the bracket or named approach:


A handy function to know about is, str. This function provides a summary of the objects attributes, i.e.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download