Say have a linear model LM that I want a qq plot of the residuals. Normally I would use the R base graphics:
qqnorm(residuals(LM), ylab=\"Residuals\")
qqline
Why not the following?
Given some vector, say,
myresiduals <- rnorm(100) ^ 2
ggplot(data=as.data.frame(qqnorm( myresiduals , plot=F)), mapping=aes(x=x, y=y)) +
geom_point() + geom_smooth(method="lm", se=FALSE)
But it seems strange that we have to use a traditional graphics function to prop up ggplot2.
Can't we get the same effect somehow by starting with the vector for which we want the quantile plot and then applying the appropriate "stat" and "geom" functions in ggplot2?
Does Hadley Wickham monitor these posts? Maybe he can show us a better way.