i have a linear regression problem which i solved using:
m=lm(value ~ mean, data=d)
and from this value i can get the R2 and the regression equation.
but i want to get the standard error(fitting error). i was able to see the value but i don’t know how to get it in order to store it inside a data frame.
i get the value using summary(m) and the result is something like this:
Call:
lm(formula = value ~ mean, data = d)
Residuals:
Min 1Q Median 3Q Max
-25.000 -15.909 -2.124 14.596 44.697
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 2.500e+01 1.064e+00 23.49 <2e-16 ***
mean -1.759e-06 1.536e+00 0.00 1
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 16.85 on 1298 degrees of freedom
Multiple R-squared: 1.01e-15, Adjusted R-squared: -0.0007704
F-statistic: 1.311e-12 on 1 and 1298 DF, p-value: 1
so the question is: how can i get access to these values??
thank you
The function
summaryjust returns an R list.We can use the usual list syntax to extract what we want. For example,
Returns a data frame of model fits
and
m[[6]]returns theResidual standard errorThere are a few convenience functions around, such as
coefficients(m)