title: MLE error: initial value in 'vmmin' is not finite
body: <p>We simulated a data set and created a model.</p>
  <pre class="lang-r prettyprint-override"><code>set.seed(459)
  
  # seed mass
  n &lt;- 1000
  seed.mass &lt;- round(rnorm(n, mean = 250, sd = 75),digits = 1)
  
  ## Setting up the deterministic function
  detFunc &lt;- function(a,b,x){
    return(exp(a+b*x)) / (1+exp(a+b*x))
  }
  
  # logit link function for the binomial
  inv.link &lt;- function(z){   
    p &lt;-1/(1+exp(-z))
    return(p)
    }
  
  #setting a and b values
  a &lt;- -2.109
  b &lt;- 0.02
  
  # Simulating data 
  germination &lt;- (rbinom(n = n, size = 10,
                          p = inv.link(detFunc(x = seed.mass, a = a, b = b))
                          ))/10
  
  ## make data frame
  mydata &lt;- data.frame(&quot;predictor&quot; = seed.mass, &quot;response&quot; = germination)
  
  # plotting the data
  tmp.x &lt;- seq(0,1e3,length.out=500)
  plot(germination ~ seed.mass,
       xlab = &quot;seed mass (mg)&quot;,
       ylab = &quot;germination proportion&quot;)
    lines(tmp.x,inv.link(detFunc(x = tmp.x, a = a, b = b)),col=&quot;red&quot;,lwd=2)
  </code></pre>
  <p>When we check the model we created and infer the parameters, we get an error:</p>
  <blockquote>
  <p>Error in optim(par = c(a = -2.109, b = 0.02), fn = function (p) : initial value in 'vmmin' is not finite</p>
  </blockquote>
  <pre class="lang-r prettyprint-override"><code>library(bbmle)
    mod1&lt;-mle2(response ~ dbinom(size = 10,
                          p = inv.link(detFunc(x = predictor, a = a, b = b))
                          ),
               data = mydata,
               start = list(&quot;a&quot;= -2.109 ,&quot;b&quot;= 0.02))
  </code></pre>
  <p>We're stumped and can't figure out why we're getting this error.</p>