Is there a way to use geom_smooth
when the y
variable in the formula is transformed? For example:
#This works:
myplot <- qplot(speed, dist, data=cars)
(myplot + geom_smooth(method="lm", formula=y~log(x)))
#does not work
(myplot + geom_smooth(method="lm", formula=log(y)~x))
What I am after is a line like this:
myplot + geom_line(aes(x=speed, y=exp(predict(lm(log(dist)~speed)))))