Reputation: 485
I am trying to fit a random gamma distribution on my data using python. I have written so far following codes
a = 10
b = 1
n=25
n_classes = 16
true_val = []
for i in np.arange(n_classes):
gamma_process= np.cumsum(np.random.gamma(n,a,b)) # to get cummaltive sum of the fit
true_val = gamma_process
When I ran this code, it does not give any error but the value i am getting in true_val
is only one. I suppose to get list of values. I am not getting an idea where I am making a mistake. I would be grateful if you can help me on this. Thanks in advance
Upvotes: 1
Views: 361
Reputation: 516
That is due to size of gamma distribution. Please test when b>2.
In numpy gamma function,
numpy.random.gamma(shape, scale=1.0, size=None)
Please check again.
Upvotes: 0
Reputation: 3598
Try to append to list of results:
true_val = true_val + [gamma_process[0]]
or better:
true_val.append(float(gamma_process))
Now resulting list is of type integer.
Upvotes: 1