Re: Trying to understand distributions

Robert Kern <[email protected]> Tue, 13 Jul 2021 00:19:51 -0400
Newsgroups gmane.comp.python.scientific.user
Message-ID <CAF6FJivSfQ=596BQ7AzepukJxAeLscP34bVqfniBcBVYvn8EWw@mail.gmail.com>
On Mon, Jul 12, 2021 at 11:42 PM Keith Sloan <[email protected]> wrote:

> And can get what looks like a gamma fit with
>
> ax3 = fig.add_subplot(4, 1, 3)
> ag1, bg1, cg1 =stats.gamma.fit(counts)
>
Again, do not pass `counts` to `fit()`. `fit()` works on the raw data. Omit
this plot.

> print(ag1, bg1, cg1)
> x = np.linspace(stats.gamma.ppf(0.1, ag1),stats.gamma.ppf(0.99, ag1),
> int(ag1))
> ax3.plot(x, stats.gamma.pdf(x, ag1),'r-', lw=5, alpha=0.6, label='gamma
> pdf')
>
> ax4 = fig.add_subplot(4, 1, 4)
> ag2, bg2, cg2 =stats.gamma.fit(RErange1[xfield].data)
> print(ag2, bg2, cg2)
> x = np.linspace(stats.gamma.ppf(0.1, ag2),stats.gamma.ppf(0.99, ag2),
> int(ag2))
> ax4.plot(x, stats.gamma.pdf(x, ag2),'r-', lw=5, alpha=0.6, label='gamma
> pdf')
>
Again, you are omitting bg2 and cg2  from the `ppf()` and `pdf()` calls.
You need to pass all of them.

-- 
Robert Kern

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