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

Jonathan Baron baron at cattell.psych.upenn.edu
Tue May 21 18:02:21 CEST 2002


On 05/21/02 12:07, Antonio Olinto wrote:
>How to extract the elevation and the slope values from a linear model (lm)
>separately?
>
>coef(model.lm) gives both of them.

One way is
model.lm$coef[1]
for the intercept
and
model.lm$coef[2]
for the slope of the first predictor, and so on.
This assumes that
model.lm <- lm(....)

-- 
Jonathan Baron, Professor of Psychology, University of Pennsylvania
Home page: http://www.sas.upenn.edu/~baron
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list