python - Fitting data to a Generalized extreme value distribution -
i've been trying use scipy.stats.genextreme fit data generalized extreme value distribution. i've tried of methods find, don't know why won't fit data.
i've tried both these methods:
import numpy np matplotlib import pyplot plt scipy.stats import genextreme gev datan = [0.0, 0.0, 0.122194513716, 0.224438902743, 0.239401496259, 0.152119700748, 0.127182044888, 0.069825436409, 0.0299251870324, 0.0199501246883, 0.00997506234414, 0.00498753117207, 0.0] t = np.linspace(1,13,13) fit = gev.fit(datan,loc=3) pdf = gev.pdf(t, *fit) plt.plot(t, pdf) plt.plot(t, datan, "o") print(fit)
as as
popt, pcov = curve_fit(gev.pdf,t, datan) plt.plot(t,gev.pdf(*popt),'r-')
the second method resulted in
" valueerror: unable determine number of fit parameters."
thanks can give me!
according scipy.stats documentation at:
https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.genextreme.html
the fit() method uses raw data, , looks passing binned histogram data in call to:
fit = gev.fit(datan,loc=3)
try passing in raw data see if works need.
Comments
Post a Comment