title: ggplot GLM fitted curve without interaction
body: <p>I want to add the fitted function from GLM on a <code>ggplot</code>. By default, it automatically create the plot with interaction. I am wondering, if I can plot the fitted function from the model without interaction. For example,</p>
  
  <pre><code>dta &lt;- read.csv("http://www.ats.ucla.edu/stat/data/poisson_sim.csv")
  dta &lt;- within(dta, {
    prog &lt;- factor(prog, levels=1:3, labels=c("General", "Academic", "Vocational"))
    id &lt;- factor(id)
  })
  
  plt &lt;- ggplot(dta, aes(math, num_awards, col = prog)) + 
      geom_point(size = 2) + 
      geom_smooth(method = "glm", , se = F, 
          method.args = list(family = "poisson"))
  
  print(plt)
  </code></pre>
  
  <p>gives the plot with interaction, <a href="https://i.stack.imgur.com/A81XZ.png" rel="noreferrer"><img src="https://i.stack.imgur.com/A81XZ.png" alt="Fig-1"></a></p>
  
  <p>However, I want the plot from the model,</p>
  
  <pre><code>`num_awards` = ß0 + ß1*`math` + ß2*`prog` + error
  </code></pre>
  
  <p>I tried to get this this way,</p>
  
  <pre><code>mod &lt;- glm(num_awards ~ math + prog, data = dta, family = "poisson")
  
  fun.gen &lt;- function(awd) exp(mod$coef[1] + mod$coef[2] * awd)
  fun.acd &lt;- function(awd) exp(mod$coef[1] + mod$coef[2] * awd + mod$coef[3])
  fun.voc &lt;- function(awd) exp(mod$coef[1] + mod$coef[2] * awd + mod$coef[4])
  
  ggplot(dta, aes(math, num_awards, col = prog)) +
      geom_point() +
      stat_function(fun = fun.gen, col = "red") +
      stat_function(fun = fun.acd, col = "green") +
      stat_function(fun = fun.voc, col = "blue") +
      geom_smooth(method = "glm", se = F, 
          method.args = list(family = "poisson"), linetype = "dashed")
  </code></pre>
  
  <p>The output plot is <a href="https://i.stack.imgur.com/s4hM3.png" rel="noreferrer"><img src="https://i.stack.imgur.com/s4hM3.png" alt="Fig2"></a></p>
  
  <p>Is there any simple way in <code>ggplot</code> to do this efficiently?</p>