[SciPy-User] Problems with fitting Weibell distribution

Warren Weckesser warren.weckesser at gmail.com
Mon Jan 5 08:44:10 EST 2015


On Mon, Jan 5, 2015 at 7:45 AM, Alun (Griffin PC) <alun at griffinpc.co.uk>
wrote:

>  Hi Wayne
>
> no - but that is what I am trying to do!  My plot is attached.  I am using
> SciPy v12
>
>

I just tried it with scipy 0.12.1, and I got the same plot you got.  Any
chance you can upgrade scipy?

Warren



> best regards
>
> Alun
>
>
> On 05/01/2015 12:40, Warren Weckesser wrote:
>
>
>
> On Mon, Jan 5, 2015 at 7:27 AM, Alun (Griffin PC) <alun at griffinpc.co.uk>
> wrote:
>
>>  Hi
>>
>> I am trying to fit a Weibull distribution to some data, with the
>> following code:
>>
>> # Python script to fit metocean data
>>
>> import scipy.stats as s
>> import numpy as np
>> import matplotlib.pyplot as plt
>>
>> # Load data
>>
>> data = np.loadtxt("meteo.prn",skiprows=1,usecols=(4,))
>>
>> # Fit data
>>
>> p0, p1, p2, p3 = s.exponweib.fit(data, floc=0)
>>
>> # Plot data
>>
>> x = np.linspace(data.min(), data.max(), 1000)
>> y = s.exponweib(p0, p1, p2, p3).pdf(x)
>>
>> plt.plot(x, y)
>> plt.hist(data, data.max(), normed=True)
>> plt.show()
>>
>> Unfortunately, I don't get a distribution that looks anything like the
>> inputs.  I have searched the web and the above code is based on a couple of
>> other posts but I am getting confused about the arguments that the fit
>> function returns and which the EXPONWEIB function needs.  All help greatly
>> appreciated!
>>
>> Thanks!!
>>
>> Alun Griffiths
>>
>>
>
>  When I run your script with scipy 0.14.0, I get the attached figure.  Is
> that what you get?
>
>  Warren
>
>
>
>> _______________________________________________
>> SciPy-User mailing list
>> SciPy-User at scipy.org
>> http://mail.scipy.org/mailman/listinfo/scipy-user
>>
>>
>
>
> _______________________________________________
> SciPy-User mailing listSciPy-User at scipy.orghttp://mail.scipy.org/mailman/listinfo/scipy-user
>
>
>
> _______________________________________________
> SciPy-User mailing list
> SciPy-User at scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20150105/341881d3/attachment.html>


More information about the SciPy-User mailing list