[R] abline() or predict.lm() when log="x"

Richard Chandler rchandler at forwild.umass.edu
Fri Jan 20 19:37:05 CET 2006


Hello,

I'm trying to plot a fitted lm() line on a plot when the one
explanatory variable is log transformed and log="x". I get different
lines using abline and predict.lm(). 

#Example
x <- 1:100
y <- rnorm(100)
plot(y ~ x, log="x")
abline(lm(y ~ log(x)))
lines(x, predict(lm(y ~ log(x))), lwd=2)

I'm sure I'm missing something but could someone tell me which line is
correct? Thanks.

Richard 



-- 
Richard Chandler, M.S. candidate
Department of Natural Resources Conservation
UMass Amherst
(413)545-1237




More information about the R-help mailing list