title: How to pass nlpr (n parameter logistic regression) to stat_smooth in ggplot?
body: <p>My data is as follows</p>
  
  <pre><code> # A tibble: 24 x 3
       time  OD600     strain
      &lt;dbl&gt;  &lt;dbl&gt;      &lt;chr&gt;
   1 0.0001 0.0001 M12-611020
   2 1.0000 0.0880 M12-611020
   3 3.0000 0.2110 M12-611020
   4 4.0000 0.2780 M12-611020
   5 4.5000 0.4040 M12-611020
   6 5.0000 0.6060 M12-611020
   7 5.5000 0.7780 M12-611020
   8 6.0000 0.9020 M12-611020
   9 6.5000 1.0240 M12-611020
  10 8.0000 1.1000 M12-611020
  11 0.0001 0.0001 M12-611025
  12 1.0000 0.0770 M12-611025
  13 3.0000 0.0880 M12-611025
  14 4.0000 0.1250 M12-611025
  15 5.0000 0.3040 M12-611025
  16 5.5000 0.4210 M12-611025
  17 6.0000 0.5180 M12-611025
  18 6.5000 0.6160 M12-611025
  19 7.0000 0.7180 M12-611025
  20 7.5000 0.8520 M12-611025
  21 8.0000 0.9400 M12-611025
  22 8.5000 0.9500 M12-611025
  23 9.0000 0.9680 M12-611025
  </code></pre>
  
  <p>I have 2 "strains" in the data.frame each with thier own set's of values for "time" and "OD600".</p>
  
  <p>I have so far been plotting using ggplot as follows (removing asthetics for simplicity) using "loess" to fit a curve:</p>
  
  <pre><code>growth_curve_SE &lt;- growth_curve + 
    stat_smooth(aes(group=strain,fill=strain, colour = strain) ,method = "loess", se = T, alpha=0.2 , span = 0.8) + 
    geom_point(aes(fill=factor(strain)),alpha=0.5 , size=3,shape = 21,colour = "black", stroke = 1)
  </code></pre>
  
  <p>What I ultimately want to achieve is fitting a 5 parameter logictical regression rather then "loess" for the method as it is a better model for the data and fits a more accurate curve. </p>
  
  <p>I used the package "nplr" to fit the regression for multiple strains using a list split as per strain:</p>
  
  <pre><code>strain_list &lt;- split(multi_strain, multi_strain$strain)
  
  np2 &lt;- lapply(strain_list, function(tmp) {nplr(tmp$time, tmp$OD600, useLog = F)})
  </code></pre>
  
  <p>Which fits the regression:</p>
  
  <pre><code>$`M12-611020`
  Instance of class nplr 
  
  Call:
  nplr(x = tmp$time, y = tmp$OD600, useLog = F)
  weights method: residuals
  
  5-P logistic model
  Bottom asymptote: 0.03026607 
  Top asymptote: 1.104278 
  Inflexion point at (x, y): 5.297454 0.6920488 
  Goodness of fit: 0.9946967 
  Weighted Goodness of fit: 0.9998141 
  Standard error: 0.0308006 0.01631115 
  
  
  $`M12-611025`
  Instance of class nplr 
  
  Call:
  nplr(x = tmp$time, y = tmp$OD600, useLog = F)
  weights method: residuals
  
  5-P logistic model
  Bottom asymptote: -0.0009875526 
  Top asymptote: 0.9902298 
  Inflexion point at (x, y): 6.329304 0.5919818 
  Goodness of fit: 0.9956551 
  Weighted Goodness of fit: 0.9998606 
  Standard error: 0.02541948 0.01577407 
  </code></pre>
  
  <p>Any ideas how I can achieve the same in ggplot using the "stat_smooth" command to use the 5 parameter logistic regression, either with or without the "nplr" package?</p>