I implemented a loop to eliminate the 0 values from the sample dataset.
x=[1,4,4,7,11,13,15,15,17,18,19,19,20,20,22,23,28,29,31,32,36,37,47,48,49,50,54,54,55,59,59,61,61,66,72,72,75,78,78,81,93,96,99,108,113,114,120,120,120,123,124,129,131,137,145,151,156,171,176,182,188,189,195,203,208,215,217,217,217,224,228,233,255,271,275,275,275,286,291,312,312,312,315,326,326,329,330,336,338,345,348,354,361,364,369,378,390,457,467,498,517,566,644,745,871,1312,1357,1613,1630]
from numpy import linspace
import scipy.stats
import numpy as np
p_set=linspace(0.0,1,10,endpoint=True)
q_set=linspace(0.0,1,10,endpoint=True)
temp=0
for k in x:
if (scipy.stats.gamma.pdf(k,2,1)==0.0):
x.remove(k)
print(x)
for k in x:
temp+=np.log(scipy.stats.gamma.pdf(k,2,1)).sum()
but this appears
RuntimeWarning: divide by zero encountered in log
I printed the x to check and realised that two values are not eliminated from the list. the values are 0000000e+000. what can be the reason? and how will i deal with this??