[SciPy-User] Problems with fitting Weibell distribution

Alun (Griffin PC) alun at griffinpc.co.uk
Mon Jan 5 07:45:28 EST 2015


Hi Wayne

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

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 <mailto: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 <mailto:SciPy-User at scipy.org>
>     http://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/c4e286e5/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: figure_1.png
Type: image/png
Size: 21694 bytes
Desc: not available
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20150105/c4e286e5/attachment.png>


More information about the SciPy-User mailing list