[R] How to get the intercept from lm?

Chuck Cleland ccleland at optonline.net
Fri Mar 10 11:43:18 CET 2006


coef(lmNNDens)[1]

?coef

Rainer M Krug wrote:
> Hi
> 
> I am using R 2.2.0 under SuSE 10
> 
> I want to use lm() to get the slope and intercept for several daatasets 
> and store them in a database. So far so good - but how do I extract the 
> slope and the intercept from the result from lm()?
> 
> my code looks like this:
> 
> lmNNDens <- lm(log(DensNN$MeanNN) ~ log(DensNN$MeanDensity))
> anovaLM <- anova(lmNNDens)
> 
> Results$slope[No] <- ???lmNNDens???
> Results$intercept[No] <- ???lmNNDens???
> 
> any help welcome,
> 
> 
> Rainer
> 
> 

-- 
Chuck Cleland, Ph.D.
NDRI, Inc.
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 452-1424 (M, W, F)
fax: (917) 438-0894




More information about the R-help mailing list