0

I tried the sample code by Saullo Castro to get the parameters of a gamma distribution, using scipy.

import scipy
import scipy.stats

size = 30000
x = scipy.arange(size)
y = scipy.int_(scipy.round_(scipy.stats.vonmises.rvs(5,size=size)*47))
dist = getattr(scipy.stats, 'gamma')
param = dist.fit(y)
dist.entropy(param)

gives me the entropy result, which does not make sense. Where am I wrong here?

array([ 5.54183717,         nan, -0.56062118])

In scipy documentation, it states that

entropy(a, loc=0, scale=1)  (Differential) entropy of the RV.

where

a is the array of parameters of the gamma distribution
Community
  • 1
  • 1
Michael
  • 1,398
  • 5
  • 24
  • 40
  • 2
    Can you provide the link to the documentation where you found: `a is the array of parameters of the gamma distribution`. [scipy.stats.rv_continuous.entropy](http://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.rv_continuous.entropy.html#scipy.stats.rv_continuous.entropy) suggests, that it should be `dist.entropy(*param)` instead. – cel Mar 15 '15 at 10:10
  • @cel Thank you very much for your help =) I forgot to add * a is the array of parameters of the gamma distribution is my own interpretation – Michael Mar 15 '15 at 10:30

0 Answers0