title: ggplot2: Logistic Regression - plot probabilities and regression line
body: <p>I have a data.frame containing a continuous predictor and a dichotomous response variable. </p>
  
  <pre><code>&gt; head(df)
    position response
  1        0        1
  2        3        1
  3       -4        0
  4       -1        0
  5       -2        1
  6        0        0
  </code></pre>
  
  <p>I can easily compute a logistic regression by means of the <code>glm()</code>-function, no problems up to this point. </p>
  
  <p>Next, <strong>I want to create a plot with <code>ggplot</code>, that contains both the empiric probabilities</strong> for each of the overall 11 predictor values, <strong>and the fitted regression line</strong>. </p>
  
  <p>I went ahead and computed the probabilities with <code>cast()</code> and saved them in another data.frame</p>
  
  <pre><code>&gt; probs
     position   prob
  1        -5 0.0500
  2        -4 0.0000
  3        -3 0.0000
  4        -2 0.2000
  5        -1 0.1500
  6         0 0.3684
  7         1 0.4500
  8         2 0.6500
  9         3 0.7500
  10        4 0.8500
  11        5 1.0000
  </code></pre>
  
  <p>I plotted the probabilities:</p>
  
  <pre><code>p &lt;- ggplot(probs, aes(x=position, y=prob)) + geom_point()
  </code></pre>
  
  <p>But when I try to add the fitted regression line</p>
  
  <pre><code>p &lt;- p + stat_smooth(method="glm", family="binomial", se=F)
  </code></pre>
  
  <p>it returns a warning: <code>non-integer #successes in a binomial glm!</code>. 
  I know that in order to plot the <code>stat_smooth</code> "correctly", I'd have to call it on the original <code>df</code> data with the dichotomous variable. However if I use the <code>df</code>data in <code>ggplot()</code>, I see no way to plot the probabilities. </p>
  
  <p><strong>How can I combine the probabilities and the regression line in one plot</strong>, in the way it's meant to be in ggplot2, i.e. without getting any warning or error messages? </p>