[R] Using termplot() with transformations of x
Peter Dunn
pdunn2 at usc.edu.au
Fri Aug 27 01:10:13 CEST 2010
Hi all
I was playing with termplot(), and came across what appears to be an inconsistency.
It would appreciate if someone could enlighten me:
> # First, generate some data:
> y <- rnorm(100)
> x <- runif(length(y),1,2)
> # Now find the log of x:
> logx <- log(x)
>
> # Now fit two models that are exactly the same, but specified differently:
> m1 <- lm(y~log(x)) # Using log in the call
> m2 <- lm(y~logx) # Using the variable logx
>
> # The two termplots() are different:
> par(mfrow=c(1,2))
> termplot(m1)
> termplot(m2)
I see two models that are identical, but produce different termplot()s. In both cases, the independent variable is log(x), but is just specified differently.
If this is intended, what is the logic? Or am I missing something?
Thanks.
P.
> sessionInfo()
R version 2.11.1 (2010-05-31)
x86_64-apple-darwin9.8.0
locale:
[1] en_AU.UTF-8/en_AU.UTF-8/C/C/en_AU.UTF-8/en_AU.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
Peter Dunn: Biostatistician (Room T4.12)
School of Health and Sport Science
Faculty of Science, Health and Education ML-34
University of the Sunshine Coast, Locked Bag 4
Maroochydore DC Qld 4558
Tel: +61 7 5456 5085
Fax: +61 7 5430 2896
Email: pdunn2 at usc.edu.au
www.usc.edu.au
CRICOS Provider Number: 01595D
This communication is intended for the recipient only and should not be forwarded, distributed or otherwise read by others without express permission. The views expressed in this email are not necessarily those of the University of the Sunshine Coast.
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
More information about the R-help
mailing list