title: R: Using fitdistrplus to fit curve over histogram of discrete data
body: <p>So I have this discrete set of data <code>my_dat</code> that I am trying to fit a curve over to be able to generate random variables based on <code>my_dat</code>.  I had great success using <code>fitdistrplus</code> on continuous data but have many errors when attempting to use it for discrete data.  </p>
  
  <p>Table settings:  </p>
  
  <pre><code>library(fitdistrplus)
  
  my_dat &lt;- c(2,5,3,3,3,1,1,2,4,6,
              3,2,2,8,3,4,3,3,4,4,
              2,1,5,3,1,2,2,4,3,4,
              2,4,1,6,2,3,2,1,2,4,
              5,1,2,3,2)
  </code></pre>
  
  <p>I take a look at the histogram of the data first:   </p>
  
  <pre><code>hist(my_dat)
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/ZxJ8u.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZxJ8u.jpg" alt="&lt;code&gt;hist(my_dat)&lt;/code&gt;"></a></p>
  
  <p>Since the data's discrete, I decide to try a binomial distribution or the negative binomial distribution to fit <strong>and this is where I run into trouble</strong>: Here I try to define each:    </p>
  
  <pre><code>fitNB3 &lt;- fitdist(my_dat, discrete = T, distr = "nbinom" ) #NaNs Produced
  fitB3 &lt;- fitdist(my_dat, discrete = T, distr = "binom")
  </code></pre>
  
  <p>I receive two errors:  </p>
  
  <ol>
  <li><code>fitNB3</code> seems to run but notes that "NaNs Produced" - can anyone let me 
  know why this is the case?  </li>
  <li><code>fitB3</code> doesn't run at all and provides me with the error:  "Error in start.arg.default(data10, distr = distname) :  Unknown starting values for distribution binom." - can anyone point out why this won't work here?  I am unclear about providing a starting number given that the data is discrete (I attempted to use <code>start = 1</code> in the <code>fitdist</code> function but I received another error:  "Error in fitdist(my_dat, discrete = T, distr = "binom", start = 1) : the function mle failed to estimate the parameters, with the error code 100"</li>
  </ol>
  
  <p>I've been spinning my wheels for a while on this but I would be take any feedback regarding these errors.  </p>