[R] Extract information from the summary of 'lm'

From: Jun Ding <dingjun_cn_at_yahoo.com>
Date: Wed 21 Jun 2006 - 12:25:02 EST


Hi Everyone,

I just don't know how to extract the information I want from the summary of a linear regression model fitting.

For example, I fit the following simple linear regression model:

results = lm(y_var ~ x_var)

summary(results) gives me:

Call:
lm(formula = y_var ~ x_var)

Residuals:

    Min 1Q Median 3Q Max
-5.9859 -1.5849 0.4574 2.0163 4.6015

Coefficients:

            Estimate Std. Error t value Pr(>|t|)    
(Intercept)  -1.7782     0.5948  -2.990 0.004879 ** 
x_var         2.1237     0.5073   4.187 0.000162 ***

---

Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

I can get the esitmates (i.e. -1.7782 and 2.1237) of coefficients by calling

results$coefficients

But I don't know how to get the corresponding t values and P values for those coefficients. I am running a lot of regression models and I can not run 'summary' every time to get the t and P values for each model.

Can anybody give me some hints? Thank you very much!

Best,

Jun



Jun Ding, Ph.D. student
Department of Biostatistics
University of Michigan
Ann Arbor, MI, 48105

R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Wed Jun 21 12:31:48 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Wed 21 Jun 2006 - 14:11:13 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.