
assigned issue to
 marked as task
 marked as trivial
 edited description
Issue #41
closed
I have experienced some unusual behaviour in the stat_poly_eq function from the ggpmisc package, that I suspect is a bug. If you draw the exact same with and without scaling the axes, then you'll get different estimates. This is very surprising behavior. Why should changing the scale of the graphical representation change the underlying model?
mtcars lm_eq = y~x ggplot(mtcars, aes(disp, drat)) + geom_point() + geom_smooth(method = "lm",formula=lm_eq) + scale_x_continuous(trans = "log10") + scale_y_continuous(trans = "log10") + theme_bw()+ facet_wrap(~cyl) + stat_poly_eq( aes(label = paste(stat(adj.rr.label), stat(eq.label),sep = "*\", \"*")), formula = lm_eq, rr.digits = 2, parse = TRUE,size=3)
vs.
ggplot(mtcars, aes(disp, drat)) + geom_point() + geom_smooth(method = "lm",formula=lm_eq) + theme_bw()+ facet_wrap(~cyl) + stat_poly_eq( aes(label = paste(stat(adj.rr.label), stat(eq.label),sep = "*\", \"*")), formula = lm_eq, rr.digits = 2, parse = TRUE,size=3)
Comments (2)

repo owner 
repo owner  changed status to closed
This is how ggplot works. Fitting of the smoother is done after scale transformations are applied, as can be seen the lines are straight in spite of the transformation. stat_poly_equation() gives the equation for this plotted line.
 Log in to comment
I will check, but this is expected behavior in ggplot. The smooth line is fitted to the data as plotted.