From pdalgd at gmail.com  Sun Aug  7 21:21:22 2016
From: pdalgd at gmail.com (peter dalgaard)
Date: Sun, 7 Aug 2016 21:21:22 +0200
Subject: [Rd] problem with abine(lm(...)) for plot(y~x, log='xy')
In-Reply-To: <bf7e9c85-1f1b-84eb-cf53-e0628720d64d@effectivedefense.org>
References: <bf7e9c85-1f1b-84eb-cf53-e0628720d64d@effectivedefense.org>
Message-ID: <E4EDFE34-12E6-4F1A-9B99-9BF4069CAF54@gmail.com>

Try log10()...

-pd

> On 07 Aug 2016, at 21:03 , Spencer Graves <spencer.graves at prodsyse.com> wrote:
> 
> 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
> 
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23
Email: pd.mes at cbs.dk  Priv: PDalgd at gmail.com



[Rd] problem with abine(lm(...)) for plot(y~x, log='xy')
peter dalgaard