I have a set of x and y coordinates that I want to fit to a gamma distribution.
points = {8: 54.79,
10: 92.76,
12: 97.92,
25: 175.84,
50: 788.32,
75: 1024.77,
}
x_to_fit = np.array(list(points.keys()))
y_to_fit = np.array(list(points.values()))
I want to use these points to determine the optimal values of a gamma distribution so I try running the following line.
def gamma(percentiles, mu sigma):
return stats.gamma.ppf(percentiles, mu, sigma)
popt, pcov = curve_fit(gamma, x_to_fit, y_to_fit)
When I run this I get the following error: RuntimeError: Optimal parameters not found: Number of calls to function has reached maxfev = 600.
My question is, how do I find the popt for the given coordinates and then once I find the popt how do I extrapolate y values given some x values (ie x = np.array([10,12,16,20,22,36,50,100,200,250,500,1000])?