[R] inverse for formula transformations on LHS
Stephen Milborrow
milbo at sonic.net
Sat May 18 14:05:19 CEST 2013
> Paul Johnson <pauljohn32 at gmail.com> wrote:
>
> m1 <- lm(log(y) ~ log(x), data = dat)
>
> termplot shows log(y) on the vertical. What if I want y on the vertical?
plotmo in the plotmo package has an inverse.func argument,
so something like the following might work for you?
library(MASS)
library(plotmo)
log.brain <- log(Animals$brain)
log.body <- log(Animals$body)
m2 <- lm(log.brain ~ log.body)
myplot <- function(...)
plotmo(m2, do.par=F, nrug=-1, col.resp=2, pch=20,
se=1, main="", xlab="log(body)", ...)
par(mfrow = c(2, 2))
myplot(ylab="log(brain)")
myplot(ylab="brain", inverse.func=exp)
termplot(m2, se=T, rug=T) # for comparison
More information about the R-help
mailing list