I'm trying to learn how to highlight and annotate some points in the graph. For the purpose of a reproducible example, I'm using UBSprices dataset in alr4 package.
I'm drawing an ols line and a y=x line. I want to highlight and annotate points that are farthest from the OLS line (that is, highest residuals).
Here's my code so far:
ggplot(UBSprices, aes(x = bigmac2003, y = bigmac2009)) + geom_point() + geom_smooth(method = "lm", se = FALSE) +
geom_abline(color = "green", size = 1) + coord_fixed()
