title: How to use Weibull curve fitting with loc parameter
body: <p>I am trying to fit my histogram values to a Weibull_min model, so I get the function from <a href="https://en.wikipedia.org/wiki/Weibull_distribution" rel="nofollow noreferrer">wikipedia</a> and <a href="https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.weibull_min.html" rel="nofollow noreferrer">scipy</a> and try to fit it with optimize.curvefit, it works ok with the wikipedia function; but if I add the loc parameter it doesn't fit and throws an error about: <code>OptimizeWarning: Covariance of the parameters could not be estimated category=OptimizeWarning</code></p>
  <pre><code>weibull = lambda x,c,scale,A: A*float(c)*((x)/float(scale))**(float(c)-1)*np.exp(-((x)/float(scale))**float(c))
      
  paramopt,paramcov = scipy.optimize.curve_fit(weibull,bins[nonzero_incorrectvals],probs)
      
  optres = my_weibull(bins,* paramopt)
      
  plt.plot(bins,optres,&quot;g-&quot;)
      
      
  weibull = lambda x,c,loc,scale,A: A*float(c)*((x-float(loc))/float(scale))**(float(c)-1)*np.exp(-((x-float(loc))/float(scale))**float(c))
      
  paramopt,paramcov = scipy.optimize.curve_fit(my_weibull,bins[nonzero_incorrectvals],probs)
  #(here I get the error : OptimizeWarning: Covariance of the parameters could not be estimated category=OptimizeWarning)
      
  optres = my_weibull(bins,* paramopt)
      
  plt.plot(bins,optres,&quot;y-&quot;)
  </code></pre>
  <p>Here is the resulting fit:
  <a href="https://i.stack.imgur.com/yaLrP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yaLrP.png" alt="enter image description here" /></a></p>
  <p>I don't understand why adding loc variable causes trouble.</p>