I've run across a curious problem with stat_smooth(). I've found that
the manner in which the function fits a curve to the data points is
somehow dependent upon the limits placed upon the Y axis (changes to
the X axis have no effect). I have three sets of code below, and the
only difference is in ylim(). However, instead of just "zooming in/
out," the fit lines and the standard error shadings change quite
dramatically. It seems that the way they are drawn is dependent upon
the data points that are visible, rather than the full data set fed
into ggplot(data=). My first hope was that fullrange=T would fix it,
but no. I haven't been able to find any parameters that make the issue
go away or attenuate. Could you offer other avenues that I might
explore to solve this riddle?
The plots in question can be found here:
https://netfiles.umn.edu/xythoswfs/webui/_xy-16968792_1-t_CKvWxdm8
Thanks,
Jim
########################################
########################################
g1 <- ggplot(data=ST.diff.plot.long, aes(x=TR, y=SigChng, shape=HiLo,
colour=HiLo)) + geom_point()
g2 <- g1 + stat_smooth(method="loess", span=.3, se=T, lwd=2)
g3 <- g2 + scale_colour_manual("HiLo", 3:4) + opts(title="Medial OFC
psplot of [(S hi-lo) - (T hi-lo)] -- Split by HiLo ALT") +
ylim(c(-13,13)) + xlim(c(1,11)) + ylab("Standardized Signal Change")
print(g3)
g1 <- ggplot(data=ST.diff.plot.long, aes(x=TR, y=SigChng, shape=HiLo,
colour=HiLo)) + geom_point()
g2 <- g1 + stat_smooth(method="loess", span=.3, se=T, lwd=2)
g3 <- g2 + scale_colour_manual("HiLo", 3:4) + opts(title="Medial OFC
psplot of [(S hi-lo) - (T hi-lo)] -- Split by HiLo ALT") +
ylim(c(-3,3)) + xlim(c(1,11)) + ylab("Standardized Signal Change")
print(g3)
g1 <- ggplot(data=ST.diff.plot.long, aes(x=TR, y=SigChng, shape=HiLo,
colour=HiLo)) + geom_point()
g2 <- g1 + stat_smooth(method="loess", span=.3, se=T, lwd=2)
g3 <- g2 + scale_colour_manual("HiLo", 3:4) + opts(title="Medial OFC
psplot of [(S hi-lo) - (T hi-lo)] -- Split by HiLo ALT") + ylim(c(-.
3,.3)) + xlim(c(1,11)) + ylab("Standardized Signal Change")
print(g3)
########################################
########################################