[R] Linear Regression

Dimitris Rizopoulos dimitris.rizopoulos at med.kuleuven.be
Tue Oct 2 13:36:00 CEST 2007


look at ?summary.lm(), and specifically at the `Value' section, e.g., 
try this:

lmFit <- lm(weight ~ group - 1)
summ.lmFit <- summary(lmFit)
summ.lmFit$coefficients
summ.lmFit$r.squared


I hope it helps.

Best,
Dimitris

----
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven

Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http://med.kuleuven.be/biostat/
     http://www.student.kuleuven.be/~m0390867/dimitris.htm


----- Original Message ----- 
From: "livia" <yn19832 at msn.com>
To: <r-help at r-project.org>
Sent: Tuesday, October 02, 2007 1:04 PM
Subject: [R] Linear Regression


>
> Hello,
>
> I would like to fit a linear regression and when I use summary(), I 
> got the
> following result:
>
> Call:
> lm(formula = weight ~ group - 1)
>
> Residuals:
>    Min      1Q  Median      3Q     Max
> -1.0710 -0.4938  0.0685  0.2462  1.3690
>
> Coefficients:
>         Estimate Std. Error t value Pr(>|t|)
> groupCtl   5.0320     0.2202   22.85 9.55e-15 ***
> groupTrt   4.6610     0.2202   21.16 3.62e-14 ***
> ---
> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
>
> Residual standard error: 0.6964 on 18 degrees of freedom
> Multiple R-Squared: 0.9818,     Adjusted R-squared: 0.9798
> F-statistic: 485.1 on 2 and 18 DF,  p-value: < 2.2e-16
>
> In fact, I do not need them all. Is there a way of exacting part of 
> the
> infomation, like the Coefficient or Multiple R-Squared?
> -- 
> View this message in context: 
> http://www.nabble.com/Linear-Regression-tf4554258.html#a12996725
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 


Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm



More information about the R-help mailing list