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

lindeman at bard.edu lindeman at bard.edu
Mon Aug 29 15:48:23 CDT 2005


Travis, sorry for the enigmatic problem formulation -- yes, I mean the latter,
estimating the parameters of the normal distribution using data which represents
samples drawn from a normal distribution. (Obviously, my numbers aren't actually
drawn from a normal distribution, which may be what threw you off.)

I have assumed that I would call stats.norm.fit with a vector as the first
argument -- which returns ValueError: Not enough input arguments. So far I can't
find any form of second argument that doesn't return ValueError: Too many input
arguments. But even when I look at the source code, I'm still not sure what I
should be doing -- so evidently I am missing something pretty basic.

Quoting Travis Oliphant <oliphant at ee.byu.edu>:

> 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.
> 
> 
> 
> _______________________________________________
> SciPy-user mailing list
> SciPy-user at scipy.net
> http://www.scipy.net/mailman/listinfo/scipy-user
> 




More information about the SciPy-user mailing list