[R] how to extrac one coef from lm at a time

Ole Christensen o.christensen at lancaster.ac.uk
Tue May 21 17:38:47 CEST 2002

```
x <- 1:5
parms <- coef(lm(c(1:3,7,6) ~ x))

parms[1] is the intercept
parms[2] is the slope

Cheers

Ole

Antonio Olinto wrote:
>
> Hello R-Users,
>
> I have I simple question that I could not solve:
>
> How to extract the elevation and the slope values from a linear model (lm)
> separately?
>
> coef(model.lm) gives both of them.
>
> Thanks,
>
> Antonio Olinto
>
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._

--
Ole F. Christensen
Department of Mathematics and Statistics
Fylde College, Lancaster University
Lancaster, LA1 4YF, England
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._

```