2017-04-14 104 views
2

我一直試圖使用scipy.stats.genextreme來將我的數據擬合到廣義極值分佈。我嘗試了所有可以找到的方法,但我不知道它爲什麼不適合數據。將數據擬合到廣義極值分佈

我已經試過這兩種方法:

import numpy as np 
from matplotlib import pyplot as plt 
from scipy.stats import genextreme as 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) 

以及

popt, pcov = curve_fit(gev.pdf,t, dataN) 
plt.plot(t,gev.pdf(*popt),'r-') 

This is the result I got for the first one

第二種方法導致這個

" ValueError: Unable to determine number of fit parameters." 

謝謝尋求任何幫助,你可以給我!

回答