title: python scipy stats pareto fit: how does it work
body: <p>... help and online documentation say the function scipy.stats.pareto.fit takes as variables the dataset to be fitted, and optionally b (the exponent), loc, scale.
  the result comes as triplet (exponent, loc, scale)</p>
  
  <p>generating data from the same distribution should result in the fit finding the parameters used for generating the data, e.g. (using the python 3 colsole)</p>
  
  <pre><code>$  python
  Python 3.3.0 (default, Dec 12 2012, 07:43:02) 
  [GCC 4.7.2] on linux
  Type "help", "copyright", "credits" or "license" for more information.
  &gt;&gt;&gt;
  </code></pre>
  
  <p>(in code lines below leaving out the python console prompt ">>>")</p>
  
  <pre><code>dataset=scipy.stats.pareto.rvs(1.5,size=10000)  #generating data
  scipy.stats.pareto.fit(dataset)
  </code></pre>
  
  <p>however this results in</p>
  
  <pre><code>(1.0, nan, 0.0)
  </code></pre>
  
  <p>(exponent 1, should be 1.5) and</p>
  
  <pre><code>dataset=scipy.stats.pareto.rvs(1.1,size=10000)  #generating data
  scipy.stats.pareto.fit(dataset)
  </code></pre>
  
  <p>results in </p>
  
  <pre><code>(1.0, nan, 0.0)
  </code></pre>
  
  <p>(exponent 1, should be 1.1) and </p>
  
  <pre><code>dataset=scipy.stats.pareto.rvs(4,loc=2.0,scale=0.4,size=10000)    #generating data
  scipy.stats.pareto.fit(dataset)
  </code></pre>
  
  <p>(exponent should be 4, loc should be 2, scale should be 0.4) in</p>
  
  <pre><code>(1.0, nan, 0.0)
  </code></pre>
  
  <p>etc.
  giving another exponent when calling the fit function </p>
  
  <pre><code>scipy.stats.pareto.fit(dataset,1.4)
  </code></pre>
  
  <p>returns always exactly this exponent </p>
  
  <pre><code>(1.3999999999999999, nan, 0.0)
  </code></pre>
  
  <p>The obvious question would be: do I misunderstand the purpose of this fit function completely, is it used somehow differently, or is it simply broken?</p>
  
  <p>a remark: before someone mentions that dedicated functions like those given on Aaron Clauset's web pages (<a href="http://tuvalu.santafe.edu/~aaronc/powerlaws/" rel="noreferrer">http://tuvalu.santafe.edu/~aaronc/powerlaws/</a>) are more reliable than the scipy.stats methods and should be used instead: that may be true, but they are also very very very very time consuming and do for datasets of 10000 points take many many hours (maybe days, weeks, years) on a normal PC.</p>
  
  <p>edit: oh: the parameter of the fit function is not the exponent of the distribution but exponent minus 1 (but this does not change the above issue)</p>