Error when fitting the scipy.stats.erlang distribution

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP

Error when fitting the scipy.stats.erlang distribution



I'm new to this, but I have some data that I am trying to fit to various distributions.



Right now I'm just trying to figure out what I am doing wrong. Here is an example.


data = np.array([-0.00363649, 0.00329399, 0.00648754, -0.00115784,
-0.00020446, -0.0223319])

scipy.stats.erlang.fit(data)



This returns the warning:


RuntimeWarning: The shape parameter of the erlang distribution has been given a non-integer value 2.1.
RuntimeWarning: The shape parameter of the erlang distribution has been given a non-integer value 1.9.
.
.
.



It does this a lot of times starting with 2.1 and then descending. I'm a little confused about what is happening.




1 Answer
1



By definition, the Erlang distribution has an integer shape parameter. Other than that, it is the same the gamma distribution.



The SciPy implementation of the Erlang distribution is basically the same as the gamma distribution, but it generates a warning when you give a non-integer value for the shape parameter. The fit method of the SciPy distributions does not do discrete optimization, so it will pass non-integer values to the Erlang distribution methods, and that results in the warnings.


fit



To avoid this, use the gamma distribution instead of the Erlang distribution.






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Comments

Popular posts from this blog

Executable numpy error

PySpark count values by condition

Mass disable jenkins jobs