[SciPy-user] Re: distribution.fit() methods

Jon Peirce jonathan.peirce at nottingham.ac.uk
Sat May 22 08:33:02 CDT 2004


Travis E. Oliphant wrote:
> Jon Peirce wrote:
> 
>> Hi there,
>>
>> I'm trying to fit a weibull function to some data using Scipy. It 
>> looks like I should be able to use exponweibull_gen.fit but I'm a bit 
>> puzzled about the arguments. According to the code the arguments  
>> (data, *args, **kwds) are needed, where *args seems to contain the 
>> shape parameters for the fit and **kwds contains the location and 
>> scale params.
>>
>> But if I'm fitting a function, surely I want to give xData and yData 
>> and *not* shape arguments (or maybe a first guess at those). Does 
>> anyone know how to use these methods?
>>
> 
> These fit methods are a fairly thin wrapper around optimize.fmin.  The 
> intended use is to take random variates you suspect as being weibull 
> distributed and find the maximum likelihood estimates of the shape, 
> location, and scale parameters.
> 
> Notice, it does not try to fit (x,y) coordinates to a weibull function.
> To do that you should just use an optimization method and with a fit 
> function that involves the exponweib.pdf function.
> 
> Please clarify what it is that you are trying to do.   Also, the 
> XXXXX_gen classes are not intended for general use unless you know what 
> you are doing.  What you want is exponweib.XXX --- this gives you a 
> realization of the XXXXX_gen class.
> 
> -Travis O.

Thanks (and sorry my post was kinda garbled - head wasn't screwed on 
tight enough yesterday!!)

I am now using exponweib.pdf and am able to use optimize.fmin to get the 
appropriate shape parameters - that's what I thought xxx.fit was doing, 
but I see now that it expects a raw variate rather than the pdf or cdf 
coordinates.

chrs, Jon



More information about the SciPy-user mailing list