Re: Trying to understand Distributions

Keith Sloan <[email protected]> Wed, 14 Jul 2021 18:24:31 +0100
Newsgroups gmane.comp.python.scientific.user
Message-ID <[email protected]>
Still confused by expon.fit only returning two ( same for norm) where as 
gamma returns a value for the shape as well as loc and scale
i.e. get error with

ax2 = fig.add_subplot(4, 1, 2)
ax2.set_ylabel('Count In Cyl')
ax2.set_xlabel(xfield)
#ae, be, ce = stats.expon.fit(RErange1[xfield].data)
ae, be = stats.expon.fit(RErange1[xfield].data)

xe0, xe1 = stats.expon.ppf([0.01, 0.99], loc=ae, scale=be)
xe = np.linspace(xe0,xe1,100)
ax2.plot(xg, stats.expon.pdf(xe, loc=ae, scale=be),'r-', lw=2, 
alpha=0.6, label='gamma pdf')
ax2.hist(RErange1[xfield].data, bins=binCount, density=True)

Does not like the ax2.plot

On 14/07/2021 15:56, Robert Kern wrote:
> On Wed, Jul 14, 2021 at 10:47 AM Keith Sloan <[email protected] 
> <mailto:[email protected]>> wrote:
>
>     Thanks for all the help but still experiencing further problems,
>     maybe it is just me but there seems inconsistencies between
>     distributions and fit, ppt and pdf calls.
>
>     1) Trying to fit exponential, fit does not give scale but pdf
>     seems to accept a scale value
>
> > ae, be = stats.expon.fit(RErange1[xfield].data)
>
> loc=ae, scale=be
>
> The last two parameters in the fit() results are always loc and scale.
>
> > xe0, xe1 = stats.expon.ppf([0.01, 0.99])
>
> Don't forget to pass in the fitted parameters.
>
>     2) Also a gamma plot of a second distribution is not showing curve
>
>
> Stop using int(ag) for the number of points in the linspace(). It's 
> usually an inappropriate value. In that second case, int(ag)==1.
>
> -- 
> Robert Kern
>
> _______________________________________________
> SciPy-User mailing list
> [email protected]
> https://mail.python.org/mailman/listinfo/scipy-user

-- 
========== Art & Ceramics ===========
https://www.instagram.com/ksloan1952/

_______________________________________________
SciPy-User mailing list
[email protected]
https://mail.python.org/mailman/listinfo/scipy-user