title: How to plot sigmoidal data in R - binary Y continuous X ggplot mixed effects logisitic regression
body: <p>Here's the data I'm working with:</p>
  <pre><code>data &lt;- data.frame(id = rep(1:3, each = 30), 
             intervention = rep(c(&quot;a&quot;,&quot;b&quot;),each= 2, times=45),
             area = rep(1:3, times=30), 
             &quot;dv1&quot; = rnorm(90, mean =10, sd=7),
             &quot;dv2&quot; = rnorm(90, mean =5, sd=3),
             outcome = rbinom(90, 1, prob=.5))
  
  data$id &lt;- as.factor(data$id)
  data$intervention &lt;- as.factor(data$intervention)
  data$area &lt;- as.factor(data$area)
  data$outcome &lt;- as.factor(data$outcome)
  </code></pre>
  <p>I'm trying to make sigmoidal plots for this mixed effects logistic regression model:</p>
  <pre><code>library(lmer4)
  glmer(
    outcome1 ~ dv1 + (1 | id/area), 
    data = data, 
    family = binomial(link = &quot;logit&quot;)
  )
  </code></pre>
  <p>Here's what I tried and failed with:</p>
  <pre><code>library(ggplot2)
  ggplot(data, aes(x=dv1, y=outcome1, color=factor(area))) + 
    facet_wrap(~id) +
    geom_point() + 
    stat_smooth(method=&quot;glm&quot;, method.args=list(family=&quot;binomial&quot;), color=&quot;black&quot;, se=F)
  
  Info    
  `geom_smooth()` using formula 'y ~ x'
  Warning 
  Computation failed in `stat_smooth()`: y values must be 0 &lt;= y &lt;= 1
  Computation failed in `stat_smooth()`: y values must be 0 &lt;= y &lt;= 1
  Computation failed in `stat_smooth()`: y values must be 0 &lt;= y &lt;= 1
  </code></pre>
  <p><a href="https://i.stack.imgur.com/mGEZY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mGEZY.png" alt="enter image description here" /></a></p>
  <p>Additionally, is this even the right way to plot logistic regression? Should I be pulling some data from the model itself or is plotting the raw data for illustrative reasons suffice?</p>