Quantcast
Channel: Data Science, Analytics and Big Data discussions - Topics tagged data_science
Viewing all articles
Browse latest Browse all 787

Test the best-fit distribution and return parameter and 'p' values

$
0
0

@shruti.bothe wrote:

My data set fits gamma and weibull distribution. I need to compare which one is the best fit with respect to p values and return the shape and scale values, loc parameter needs to be set to zero

Also I have used this code:

x = np.arange(0,10,.1)
y1=file1.SMS
shape1, loc1, scale1 = gamma.fit(y1)
g1 = gamma.pdf( x=x, a=shape1, loc=loc1, scale=scale1)

fig, axes = plt.subplots(1, 3, figsize=(13,4))
ax = axes[0]
ax.hist(y1, bins=40, normed=True);
ax.plot(x, g1, 'r-', linewidth=6, alpha=.6)
ax.annotate(s='shape = %.3f\nloc = %.3f\nscale = %.3f' %(shape1, loc1, scale1), xy=(6,.2))
ax.set_title('gamma fit')

but it does not give the desired output

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 787

Trending Articles