title: Adding Multiple Regression Line Equations, R2 and SSE on the same graph
body: <p>In R, I am using <code>stat_poly_eq()</code> to annotate the equation from a linear model on a plot, and I encounter 2 issues: </p>
  
  <ol>
  <li><p>How can I annotate three separate equations, one for each group and
  another with the the whole data?    </p></li>
  <li><p>How can I add the corresponding error sum of squares (SSE) on each
  equation?</p></li>
  </ol>
  
  <p>As shown <a href="https://stackoverflow.com/questions/7549694/ggplot2-adding-regression-line-equation-and-r2-on-graph?rq=1">here</a>, the following code produces a general equation including all data: </p>
  
  <pre><code>x &lt;- runif(200, 0, 100)
  y &lt;- 5*x + rnorm(200, 0, 10)
  df &lt;- data.frame(x, y)
  df$GENDER[1:100] &lt;- 1
  df$GENDER[101:nrow(df)] &lt;- 2
  
  
  
  formula &lt;- y  ~ poly(x, 1, raw = TRUE)
  
  
  my_features &lt;- list(scale_shape_manual(values=c(16, 1)),
                    geom_smooth(method = "lm", aes(group = 1), 
                                formula = formula, colour = "Black", 
                                fill = "grey70"),
                    geom_smooth(method = "lm", aes(group = factor(GENDER), se = F),
                                formula = formula, colour = "Black"),
                    stat_poly_eq(aes(label = paste(..eq.label.., ..rr.label.., sep = "~~~~")),
                                 formula = formula, parse = TRUE)
  )
  
  
  ggplot(df, aes(x = x, y = y, aes(shape = factor(GENDER)))) +
    geom_point(aes(shape = factor(GENDER))) + 
    my_features
  </code></pre>