Statsmodels fit distribution among 0 and 1
<p>I am trying to fit a beta distribution that should be defined between 0 and 1 on a data set that only has samples in a subrange. My problem is that using the <code>fit()</code> function will cause the fitted PDF to be defined only between my smallest and largest values. 
For instance, if my dataset has samples between 0.2 and 0.3, what I get is a PDF defined between 0.2 and 0.3, instead of between 0 and 1, as it should be. The code I am using is:</p>

<pre><code>ps1 = beta.fit(selected, loc=0, scale=1)
</code></pre>

<p>Am I missing something? 
Thanks in advance!</p>

<p>I came up with a partial solution that does the trick for me: I replicate my samples (for the datasets that are too small) and add dummy samples at 0 and 1. Although that increases the fit error, it is low enough for my purpose.
Also, I asked in Google groups and got <a href="https://groups.google.com/d/msg/pystatsmodels/p3LMyERf6C4/8eE6J08-AgAJ" rel="nofollow">this answer</a> that works fine, but its giving me some errors occasionally. I hope this helps anyone with that problem. </p>

python numpy statistics statsmodels