[SciPy-user] use of rv_continuous "fit"?

Travis Oliphant oliphant at ee.byu.edu
Mon Aug 29 13:13:58 CDT 2005


lindeman at bard.edu wrote:

>Evidently I haven't grasped the Zen of SciPy's rv_continuous classes. I am
>trying to compose a simple snippet of code that would fit a normal curve to a
>vector of data (say, [-2.0, -1.0, -0.5, 0.0, 0.5, 1.0, 2.0]) -- which .fit seems
>that it ought to do, with about three lines of code, but I can't figure out the
>three lines. And I can't seem to find a single use of .fit anywhere on the Web.
>Sigh. Could someone please rescue the newbie?
>  
>

The idea is that this should be simple, but the .fit method has not been 
tested extensively.  With that caveat, I'm not sure I understand what 
you mean about fitting a normal curve to your vector of "data."

What exactly are you trying to do here?  Are you fitting a function to a 
normal curve?  or are you estimating the parameters of the normal 
distribution using data which represents samples drawn from a normal 
distribution.

The .fit method is for the latter.   Use something in optimize (i.e. 
optimize.leastsq) for the former.

-Travis O.





More information about the SciPy-user mailing list