[Rd] problem with abine(lm(...)) for plot(y~x, log='xy')
Spencer Graves
spencer.graves at prodsyse.com
Sun Aug 7 21:03:55 CEST 2016
Hello:
In the following plot, the fitted line plots 100 percent above
the points:
tstDat <- data.frame(x=10^(1:3), y=10^(1:3+.1*rnorm(3)))
tstFit <- lm(log(y)~log(x), tstDat)
plot(y~x, tstDat, log='xy')
abline(tstFit)
I can get the correct line with the following:
tstPredDat <- data.frame(x=10^seq(1, 3, len=2))
tstPred <- predict(tstFit, tstPredDat)
lines(tstPredDat$x, exp(tstPred))
I tried "abline(tstFit)" hoping it would work. If the error had
not been so obvious, I might not have noticed it.
Thanks for your work to build a better R (and through that a
better world).
Spencer Graves
More information about the R-devel
mailing list