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

From: Richard Chandler <rchandler_at_forwild.umass.edu>
Date: Sat 21 Jan 2006 - 05:37:05 EST


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

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Sat Jan 21 05:49:40 2006

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:42:08 EST