KillerSnail
KillerSnail

Reputation: 3591

How do I find out what the .fit function of a scipy stat distribution returns?

I tried running .fit on a dweibull distribution from scipy.stats

I get a list of three values but what are they? looking here: Scipy Documentation

I can't see any description of what fit returns.

Upvotes: 3

Views: 2374

Answers (1)

ev-br
ev-br

Reputation: 26030

It's a tuple of <shapes>, loc, scale. dweibull has one shape parameter, so you get three items. norm does not have shape parameters, hence you only get two for loc and scale, etc

The idiom is that you can unpack the output of fit into a call to pdf, cdf et al:

>>> from scipy import stats
>>> data = stats.beta.rvs(a=1, b=2, size=100, random_state=101)
>>> xxx = stats.beta.fit(data)
>>> stats.beta.pdf(0.1, *xxx)
1.7748574630838663
>>> stats.beta.mean(*xxx)
0.33473342172664911

Upvotes: 4

Related Questions